From 58c3c8e497f55ec36403943c984baf10fa445364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Wa=C5=9Bko?= Date: Tue, 7 Jun 2022 10:16:55 +0200 Subject: [PATCH] update tests --- test/Table_Tests/src/Common_Table_Spec.enso | 15 +++++++-------- .../Table_Tests/src/Database/Postgresql_Spec.enso | 2 +- test/Table_Tests/src/Database/Sqlite_Spec.enso | 2 +- test/Table_Tests/src/Table_Spec.enso | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/test/Table_Tests/src/Common_Table_Spec.enso b/test/Table_Tests/src/Common_Table_Spec.enso index 2dba769d8bf4..a434d61cb24c 100644 --- a/test/Table_Tests/src/Common_Table_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Spec.enso @@ -11,7 +11,7 @@ from Standard.Table.Data.Position as Position_Module import all import Standard.Table.Data.Sort_Column_Selector import Standard.Table.Data.Sort_Column -type Test_Selection supports_case_sensitive_columns=True order_by=True natural_ordering=False case_insensitive_ordering=False order_by_unicode_normalization_by_default=False +type Test_Selection supports_case_sensitive_columns=True order_by=True natural_ordering=False case_insensitive_ordering=True order_by_unicode_normalization_by_default=False case_insensitive_ascii_only=False ## A common test suite for shared operations on the Table API. @@ -702,16 +702,15 @@ spec prefix table_builder test_selection pending=Nothing = t2.at "delta" . to_vector . should_equal ["a03", "a1", "a10", "a2"] t2.at "alpha" . to_vector . should_equal [0, 2, 3, 1] - # TODO [RW] This test must actually be verified in practice. Test.specify "should support case insensitive ordering" pending=(if test_selection.case_insensitive_ordering.not then "Case insensitive ordering is not supported.") <| t1 = table.order_by (Sort_Column_Selector.By_Name [Sort_Column.Name "eta"]) text_ordering=(Text_Ordering case_sensitive=Case_Insensitive) - t1.at "eta" . to_vector . should_equal ["Aleph", "alpha", "Beta", "bądź"] + expected = case test_selection.case_insensitive_ascii_only of + True -> ["Aleph", "alpha", "Beta", "bądź"] + False -> ["Aleph", "alpha", "bądź", "Beta"] + t1.at "eta" . to_vector . should_equal expected - t2 = table.order_by (Sort_Column_Selector.By_Name [Sort_Column.Name "eta"]) text_ordering=(Text_Ordering case_sensitive=Case_Insensitive (Locale.new "pl" "PL")) - t2.at "eta" . to_vector . should_equal ["Aleph", "alpha", "bądź", "Beta"] - - t3 = table.order_by (Sort_Column_Selector.By_Name [Sort_Column.Name "eta"]) - t3.at "eta" . to_vector . should_equal ["Aleph", "Beta", "alpha", "bądź"] + t2 = table.order_by (Sort_Column_Selector.By_Name [Sort_Column.Name "eta"]) text_ordering=(Text_Ordering case_sensitive=True) + t2.at "eta" . to_vector . should_equal ["Aleph", "Beta", "alpha", "bądź"] Test.specify "should support natural and case insensitive ordering at the same time" pending=(if (test_selection.natural_ordering.not || test_selection.case_insensitive_ordering.not) then "Natural ordering or case sensitive ordering is not supported.") <| t1 = table.order_by (Sort_Column_Selector.By_Name [Sort_Column.Name "psi"]) text_ordering=(Text_Ordering sort_digits_as_numbers=True case_sensitive=Case_Insensitive) diff --git a/test/Table_Tests/src/Database/Postgresql_Spec.enso b/test/Table_Tests/src/Database/Postgresql_Spec.enso index 886b90bd82cc..2cc517b54350 100644 --- a/test/Table_Tests/src/Database/Postgresql_Spec.enso +++ b/test/Table_Tests/src/Database/Postgresql_Spec.enso @@ -99,7 +99,7 @@ run_tests connection pending=Nothing = Common_Spec.spec prefix connection pending=pending here.postgres_specific_spec connection pending=pending - common_selection = Common_Table_Spec.Test_Selection supports_case_sensitive_columns=True order_by=False + common_selection = Common_Table_Spec.Test_Selection supports_case_sensitive_columns=True Common_Table_Spec.spec prefix table_builder test_selection=common_selection pending=pending selection = Aggregate_Spec.Test_Selection first_last_row_order=False aggregation_problems=False diff --git a/test/Table_Tests/src/Database/Sqlite_Spec.enso b/test/Table_Tests/src/Database/Sqlite_Spec.enso index d2114081952a..e385e3dcd9f3 100644 --- a/test/Table_Tests/src/Database/Sqlite_Spec.enso +++ b/test/Table_Tests/src/Database/Sqlite_Spec.enso @@ -62,7 +62,7 @@ spec = Common_Spec.spec prefix connection here.sqlite_specific_spec connection - common_selection = Common_Table_Spec.Test_Selection supports_case_sensitive_columns=False order_by=True natural_ordering=False case_insensitive_ordering=False + common_selection = Common_Table_Spec.Test_Selection supports_case_sensitive_columns=False order_by=True natural_ordering=False case_insensitive_ordering=False case_insensitive_ascii_only=True Common_Table_Spec.spec prefix table_builder test_selection=common_selection ## For now `advanced_stats`, `first_last`, `text_shortest_longest` and diff --git a/test/Table_Tests/src/Table_Spec.enso b/test/Table_Tests/src/Table_Spec.enso index 79b1479620ea..7daeb13ab16b 100644 --- a/test/Table_Tests/src/Table_Spec.enso +++ b/test/Table_Tests/src/Table_Spec.enso @@ -635,7 +635,7 @@ spec = t_3 = Table.new [c_3_1, c_3_2, c_3_3] t_3.default_visualization.should_equal Visualization.Id.table - selection = Common_Table_Spec.Test_Selection supports_case_sensitive_columns=True order_by=False + selection = Common_Table_Spec.Test_Selection supports_case_sensitive_columns=True order_by=False natural_ordering=True case_insensitive_ordering=True order_by_unicode_normalization_by_default=True Common_Table_Spec.spec "[In-Memory] " table_builder=Table.new test_selection=selection Test.group "Use First Row As Names" <|