Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Jun 7, 2022
1 parent 2960b04 commit 58c3c8e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
15 changes: 7 additions & 8 deletions test/Table_Tests/src/Common_Table_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/Table_Tests/src/Database/Postgresql_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/Table_Tests/src/Database/Sqlite_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/Table_Tests/src/Table_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -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" <|
Expand Down

0 comments on commit 58c3c8e

Please sign in to comment.