diff --git a/src/edge_table.rs b/src/edge_table.rs index 446575171..21def03a8 100644 --- a/src/edge_table.rs +++ b/src/edge_table.rs @@ -6,6 +6,7 @@ use crate::{EdgeId, NodeId}; use ll_bindings::{tsk_edge_table_free, tsk_edge_table_init}; /// Row of an [`EdgeTable`] +#[derive(Debug)] pub struct EdgeTableRow { pub id: EdgeId, pub left: Position, diff --git a/src/individual_table.rs b/src/individual_table.rs index dad6d5b4c..d8f1e5e5b 100644 --- a/src/individual_table.rs +++ b/src/individual_table.rs @@ -7,6 +7,7 @@ use crate::{tsk_id_t, tsk_size_t, TskitError}; use ll_bindings::{tsk_individual_table_free, tsk_individual_table_init}; /// Row of a [`IndividualTable`] +#[derive(Debug)] pub struct IndividualTableRow { pub id: IndividualId, pub flags: IndividualFlags, diff --git a/src/migration_table.rs b/src/migration_table.rs index 69a80bebe..45a0bba00 100644 --- a/src/migration_table.rs +++ b/src/migration_table.rs @@ -8,6 +8,7 @@ use crate::{MigrationId, NodeId, PopulationId}; use ll_bindings::{tsk_migration_table_free, tsk_migration_table_init}; /// Row of a [`MigrationTable`] +#[derive(Debug)] pub struct MigrationTableRow { pub id: MigrationId, pub left: Position, diff --git a/src/mutation_table.rs b/src/mutation_table.rs index e108d5197..c31523ab3 100644 --- a/src/mutation_table.rs +++ b/src/mutation_table.rs @@ -7,6 +7,7 @@ use crate::{MutationId, NodeId, SiteId}; use ll_bindings::{tsk_mutation_table_free, tsk_mutation_table_init}; /// Row of a [`MutationTable`] +#[derive(Debug)] pub struct MutationTableRow { pub id: MutationId, pub site: SiteId, diff --git a/src/node_table.rs b/src/node_table.rs index d07a7678e..73d66ab3e 100644 --- a/src/node_table.rs +++ b/src/node_table.rs @@ -8,6 +8,7 @@ use crate::{IndividualId, NodeId, PopulationId}; use ll_bindings::{tsk_node_table_free, tsk_node_table_init}; /// Row of a [`NodeTable`] +#[derive(Debug)] pub struct NodeTableRow { pub id: NodeId, pub time: Time, diff --git a/src/population_table.rs b/src/population_table.rs index d7fac9a80..74ba8e345 100644 --- a/src/population_table.rs +++ b/src/population_table.rs @@ -7,7 +7,7 @@ use crate::TskitError; use ll_bindings::{tsk_population_table_free, tsk_population_table_init}; /// Row of a [`PopulationTable`] -#[derive(Eq)] +#[derive(Eq, Debug)] pub struct PopulationTableRow { pub id: PopulationId, pub metadata: Option>, diff --git a/src/site_table.rs b/src/site_table.rs index 987eec2dc..d9842f387 100644 --- a/src/site_table.rs +++ b/src/site_table.rs @@ -8,6 +8,7 @@ use crate::TskitError; use ll_bindings::{tsk_site_table_free, tsk_site_table_init}; /// Row of a [`SiteTable`] +#[derive(Debug)] pub struct SiteTableRow { pub id: SiteId, pub position: Position, diff --git a/tests/test_tables.rs b/tests/test_tables.rs index a06dddef4..7af9bc2bb 100644 --- a/tests/test_tables.rs +++ b/tests/test_tables.rs @@ -45,8 +45,22 @@ mod test_adding_rows_without_metadata { // are held in an Option. match tables.$table().row(id) { Some(row) => { - // assert_eq!(row, row); - assert!(row.metadata.is_none()) + assert!(row.metadata.is_none()); + + // A row equals itself + let row2 = tables.$table().row(id).unwrap(); + assert_eq!(row, row2); + + // create a second row w/identical payload + if let Ok(id2) = tables.$adder($($payload),*) { + if let Some(row2) = tables.$table().row(id2) { + // The rows have different id + assert_ne!(row, row2); + } else { + panic!("Expected Some(row2) from {} table", stringify!(table)) + } + } + }, None => panic!("Expected Some(row) from {} table", stringify!(table)) }