Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AdRiley committed Jan 31, 2025
1 parent 34c5e97 commit 26547f3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/Table_Tests/src/Util_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -97,31 +97,35 @@ add_specs suite_builder =
group_builder.specify "Two Tables Are Equal" <|
expected_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"], Column.from_vector "Col2" ["Who", "guards", "the", "guards?"]]
actual_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"], Column.from_vector "Col2" ["Who", "guards", "the", "guards?"]]
actual_table.should_equal expected_table
actual_table.should_equal expected_table
group_builder.specify "Two Tables Are Equal Ignoring Order" <|
expected_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"], Column.from_vector "Col2" ["Who", "guards", "the", "guards?"]]
actual_table = Table.new [Column.from_vector "Col1" ["ipsos", "custodiet", "custodes?", "Quis"], Column.from_vector "Col2" ["the" , "guards", "guards?", "Who"]]
actual_table.should_equal expected_table ignore_order=True
group_builder.specify "Two Tables With Different Values" <|
expected_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"], Column.from_vector "Col2" ["Who", "guards", "the", "guards?"]]
actual_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"], Column.from_vector "Col2" ["Who", "guards", "teh", "guards?"]]
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH")
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH" False)
res.catch.message.should_end_with 'Column: Col2 differs at row 2.\n\t Actual : teh\n\t Expected: the\n\t.'
group_builder.specify "Tables different number of columns" <|
expected_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"]]
actual_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"], Column.from_vector "Col2" ["Who", "guards", "the", "guards?"]]
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH")
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH" False)
res.catch.message.should_end_with "Expected 1 columns, but got 2."
group_builder.specify "Tables different number of columns2" <|
expected_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"], Column.from_vector "Col2" ["Who", "guards", "the", "guards?"]]
actual_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"]]
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH")
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH" False)
res.catch.message.should_end_with "Expected 2 columns, but got 1."
group_builder.specify "Tables With Mismatched Column names" <|
expected_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"], Column.from_vector "Col2" ["Who", "guards", "the", "guards?"]]
actual_table = Table.new [Column.from_vector "Col" ["Quis", "custodiet", "ipsos", "custodes?"], Column.from_vector "Col2" ["Who", "guards", "the", "guards?"]]
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH")
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH" False)
res.catch.message.should_end_with "Expected column name Col1, but got Col."
group_builder.specify "Comparing a Table to non Table" <|
expected_table = 42
actual_table = Table.new [Column.from_vector "Col1" ["Quis", "custodiet", "ipsos", "custodes?"]]
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH")
res = Panic.recover Test_Failure_Error (table_should_equal_impl actual_table expected_table "LOCATION_PATH" False)
res.catch.message.should_equal "Got a Table, but expected a 42 (at LOCATION_PATH)."

type DB_Tables
Expand Down

0 comments on commit 26547f3

Please sign in to comment.