Skip to content

Commit

Permalink
Clarify some test code
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 12, 2024
1 parent 531a92d commit b0e94e0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions crates/re_data_store/tests/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ fn data_store_dump_filtered() {
}

fn data_store_dump_filtered_impl(store1: &mut DataStore, store2: &mut DataStore) {
fn insert_table(store: &mut DataStore, table: &DataTable) {
for row in table.to_rows() {
let row = row.unwrap();
store.insert_row(&row).unwrap();
}
}

let timeline_frame_nr = Timeline::new_sequence("frame_nr");
let timeline_log_time = Timeline::log_time();
let frame1: TimeInt = 1.into();
Expand All @@ -183,29 +190,29 @@ fn data_store_dump_filtered_impl(store1: &mut DataStore, store2: &mut DataStore)

// Fill the first store.
for table in &tables {
insert_table_with_retries(store1, table);
insert_table(store1, table);
}
sanity_unwrap(store1);

// Dump frame1 from the first store into the second one.
for table in store1.to_data_tables((timeline_frame_nr, TimeRange::new(frame1, frame1)).into()) {
insert_table_with_retries(store2, &table);
insert_table(store2, &table);
}
// Dump frame2 from the first store into the second one.
for table in store1.to_data_tables((timeline_frame_nr, TimeRange::new(frame2, frame2)).into()) {
insert_table_with_retries(store2, &table);
insert_table(store2, &table);
}
// Dump frame3 from the first store into the second one.
for table in store1.to_data_tables((timeline_frame_nr, TimeRange::new(frame3, frame3)).into()) {
insert_table_with_retries(store2, &table);
insert_table(store2, &table);
}
// Dump the other frame3 from the first store into the second one.
for table in store1.to_data_tables((timeline_log_time, TimeRange::new(frame3, frame3)).into()) {
insert_table_with_retries(store2, &table);
insert_table_with_retries(store2, &table); // requires retries because we will get same row IDs
}
// Dump frame4 from the first store into the second one.
for table in store1.to_data_tables((timeline_frame_nr, TimeRange::new(frame4, frame4)).into()) {
insert_table_with_retries(store2, &table);
insert_table(store2, &table);
}
sanity_unwrap(store2);

Expand Down

0 comments on commit b0e94e0

Please sign in to comment.