checkpoint failing test after fixing tests checkpoint checkpoint checkpoint re-work asd checkpoint checkpoint checkpoint mix proj checkpoint mix first parser impl checkpoint fix tests re-org parser checkpoint strings fix multiline strings tuples checkpoint maps checkpoint checkpoint checkpoint checkpoint fix weird eof expression parse error checkpoint before typing checkpoint checpoint checkpoint checkpoint checkpoint ids in primitive types checkpoint checkpoint fix tests initial annotation checkpoint checkpoint checkpoint union subtyping conventions refactor - split typer typing tuples checkpoint test refactor checkpoint test refactor parsing atoms checkpoint atoms wip lists checkpoint typing lists checkopint checkpoint wip fixing correct list typing map discussion checkpoint map basic typing fix tests checkpoint checkpoint checkpoint checkpoint fix condition typing fix literal keys in map types checkpoint union types checkpoint union type checkpoint row types discussion & bidirectional typecheck checkpoint basic lambdas checkpoint lambdas typing application wip function application checkpoint checkpoint checkpoint cduce checkpoint checkpoint checkpoint checkpoint checkpoint checkpoint checkpoint
73 lines
2.3 KiB
Elixir
73 lines
2.3 KiB
Elixir
defmodule Tilly.BDD.StringBoolOpsTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
alias Tilly.BDD.StringBoolOps
|
|
|
|
describe "compare_elements/2" do
|
|
test "correctly compares strings" do
|
|
assert StringBoolOps.compare_elements("apple", "banana") == :lt
|
|
assert StringBoolOps.compare_elements("banana", "apple") == :gt
|
|
assert StringBoolOps.compare_elements("cherry", "cherry") == :eq
|
|
end
|
|
end
|
|
|
|
describe "equal_element?/2" do
|
|
test "correctly checks string equality" do
|
|
assert StringBoolOps.equal_element?("apple", "apple") == true
|
|
assert StringBoolOps.equal_element?("apple", "banana") == false
|
|
end
|
|
end
|
|
|
|
describe "hash_element/1" do
|
|
test "hashes strings consistently" do
|
|
assert is_integer(StringBoolOps.hash_element("foo"))
|
|
assert StringBoolOps.hash_element("foo") == StringBoolOps.hash_element("foo")
|
|
assert StringBoolOps.hash_element("foo") != StringBoolOps.hash_element("bar")
|
|
end
|
|
end
|
|
|
|
describe "leaf operations" do
|
|
test "empty_leaf/0 returns false" do
|
|
assert StringBoolOps.empty_leaf() == false
|
|
end
|
|
|
|
test "any_leaf/0 returns true" do
|
|
assert StringBoolOps.any_leaf() == true
|
|
end
|
|
|
|
test "is_empty_leaf?/1" do
|
|
assert StringBoolOps.is_empty_leaf?(false) == true
|
|
assert StringBoolOps.is_empty_leaf?(true) == false
|
|
end
|
|
|
|
test "union_leaves/3" do
|
|
assert StringBoolOps.union_leaves(%{}, false, false) == false
|
|
assert StringBoolOps.union_leaves(%{}, true, false) == true
|
|
assert StringBoolOps.union_leaves(%{}, false, true) == true
|
|
assert StringBoolOps.union_leaves(%{}, true, true) == true
|
|
end
|
|
|
|
test "intersection_leaves/3" do
|
|
assert StringBoolOps.intersection_leaves(%{}, false, false) == false
|
|
assert StringBoolOps.intersection_leaves(%{}, true, false) == false
|
|
assert StringBoolOps.intersection_leaves(%{}, false, true) == false
|
|
assert StringBoolOps.intersection_leaves(%{}, true, true) == true
|
|
end
|
|
|
|
test "negation_leaf/2" do
|
|
assert StringBoolOps.negation_leaf(%{}, false) == true
|
|
assert StringBoolOps.negation_leaf(%{}, true) == false
|
|
end
|
|
end
|
|
|
|
describe "test_leaf_value/1" do
|
|
test "returns :empty for false" do
|
|
assert StringBoolOps.test_leaf_value(false) == :empty
|
|
end
|
|
|
|
test "returns :full for true" do
|
|
assert StringBoolOps.test_leaf_value(true) == :full
|
|
end
|
|
end
|
|
end
|