From 1a78f5b6136cbe0530a095985babc3e48e0b7d40 Mon Sep 17 00:00:00 2001 From: Lucas Jeub Date: Mon, 1 Jul 2024 17:36:35 +0200 Subject: [PATCH] more tests --- .../test_rust_disk_storage_workflow.yml | 1 + .../src/executor/table_provider/edge.rs | 2 +- raphtory/src/disk_graph/graph_impl/mod.rs | 55 +++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_rust_disk_storage_workflow.yml b/.github/workflows/test_rust_disk_storage_workflow.yml index 942708407c..0c5f5f8ccc 100644 --- a/.github/workflows/test_rust_disk_storage_workflow.yml +++ b/.github/workflows/test_rust_disk_storage_workflow.yml @@ -14,6 +14,7 @@ jobs: runs-on: '${{ matrix.os }}' env: CARGO_NET_GIT_FETCH_WITH_CLI: true + RUST_BACKTRACE: 1 strategy: matrix: include: diff --git a/raphtory-cypher/src/executor/table_provider/edge.rs b/raphtory-cypher/src/executor/table_provider/edge.rs index fe54dfe23e..435bf7260e 100644 --- a/raphtory-cypher/src/executor/table_provider/edge.rs +++ b/raphtory-cypher/src/executor/table_provider/edge.rs @@ -99,7 +99,7 @@ impl EdgeListTableProvider { fn lift_nested_arrow_schema(graph: &DiskGraph, layer_id: usize) -> Result, ExecError> { let arrow2_fields = graph.as_ref().layer(layer_id).edges_data_type(); - let a2_dt = crate::arrow2::datatypes::ArrowDataType::Struct(arrow2_fields.clone()); + let a2_dt = crate::arrow2::datatypes::ArrowDataType::Struct(arrow2_fields.to_vec()); let a_dt: DataType = a2_dt.into(); let schema = match a_dt { DataType::Struct(fields) => { diff --git a/raphtory/src/disk_graph/graph_impl/mod.rs b/raphtory/src/disk_graph/graph_impl/mod.rs index b14ba813a5..cbe137e6fa 100644 --- a/raphtory/src/disk_graph/graph_impl/mod.rs +++ b/raphtory/src/disk_graph/graph_impl/mod.rs @@ -1203,6 +1203,61 @@ mod storage_tests { inner_merge_test(&[], &[]) } + #[test] + fn test_one_empty_graph() { + inner_merge_test(&[], &[(0, 0, 0)]) + } + + #[test] + fn inbounds_not_merging() { + inner_merge_test(&[], &[(0, 0, 0), (0, 0, 1), (0, 0, 2)]) + } + + #[test] + fn inbounds_not_merging_take2() { + inner_merge_test( + &[(0, 0, 2)], + &[ + (0, 1, 0), + (0, 0, 0), + (0, 0, 0), + (0, 0, 0), + (0, 0, 0), + (0, 0, 0), + (0, 0, 0), + ], + ) + } + + #[test] + fn offsets_panic_overflow() { + inner_merge_test( + &[ + (0, 0, 4), + (0, 0, 4), + (0, 0, 0), + (0, 0, 4), + (0, 1, 2), + (0, 3, 4), + ], + &[(0, 0, 5), (0, 2, 0)], + ) + } + + #[test] + fn inbounds_not_merging_take3() { + inner_merge_test( + &[ + (0, 0, 4), + (0, 0, 4), + (0, 0, 0), + (0, 0, 4), + (0, 1, 2), + (0, 3, 4), + ], + &[(0, 0, 3), (0, 0, 4), (0, 2, 2), (0, 0, 5), (0, 0, 6)], + ) + } #[test] fn test_merge_1_edge() { let g1 = Graph::new();