Skip to content

Commit

Permalink
fix other in memory tests that I forgot about
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Apr 17, 2023
1 parent 6b5b24b commit cfcf532
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,26 @@ type Value_Type
Value_Type.Date -> True
Value_Type.Date_Time _ -> True
Value_Type.Time -> True
## Not all mixed types are ordered, but some can, so we allow ordering
for mixed columns.
Value_Type.Mixed -> True
_ -> False

## PRIVATE
Specifies if values of the given type can be compared for ordering.
are_comparable : Value_Type -> Value_Type -> Boolean
are_comparable type_1 type_2 =
find_bucket typ =
buckets = [["Integer", "Float", "Decimal"], ["Char"], ["Date"], ["Date_Time"], ["Time"]]
buckets = [["Integer", "Float", "Decimal"], ["Char"], ["Date"], ["Date_Time"], ["Time"], ["Mixed"]]
ctor_name = Meta.meta typ . constructor . name
buckets.index_of bucket->
bucket.contains ctor_name

find_bucket type_1 == find_bucket type_2
bucket_1 = find_bucket type_1
bucket_2 = find_bucket type_2
if bucket_1.is_nothing || bucket_2.is_nothing then False else
if (type_1 == Value_Type.Mixed) || (type_2 == Value_Type.Mixed) then True else
bucket_1 == bucket_2


## PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ spec setup =
t = table_builder [["ix", [1, 2, 3, 4]], ["X", [Nothing, "A", "", " "]]]
check_problem result =
result.should_fail_with Invalid_Value_Type
result.catch.expected . should_equal Value_Type.Char
result.catch.expected . should_equal "Char"

check_problem (t.filter "X" (Filter_Condition.Starts_With (t.at "ix")))
check_problem (t.filter "X" (Filter_Condition.Ends_With (t.at "ix")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ spec setup =

test result =
result.should_fail_with Invalid_Value_Type
result.catch.expected.should_equal Value_Type.Char
result.catch.expected.should_equal "Char"

test <|
t1.join t2 on=(Join_Condition.Equals_Ignore_Case "X" "W") on_problems=Problem_Behavior.Ignore
Expand Down
5 changes: 4 additions & 1 deletion test/Table_Tests/src/In_Memory/Table_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,10 @@ spec =
False -> True
Nothing -> Nothing
negated_column_vector = column_vector.map not
t = Table.new [["X", column_vector]]
## A workaround to ensure that X has Boolean type.
It can be removed with
t0 = Table.new [["X", [True]+column_vector]]
t = t0.drop 1
in_column = Column.from_vector "in" in_vector

expected_vector = column_vector.filter (Filter_Condition.Is_In in_vector)
Expand Down

0 comments on commit cfcf532

Please sign in to comment.