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
78 lines
2.5 KiB
Elixir
78 lines
2.5 KiB
Elixir
defmodule Tilly.BDD.AtomBoolOpsTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
alias Tilly.BDD.AtomBoolOps
|
|
|
|
describe "compare_elements/2" do
|
|
test "correctly compares atoms" do
|
|
assert AtomBoolOps.compare_elements(:apple, :banana) == :lt
|
|
assert AtomBoolOps.compare_elements(:banana, :apple) == :gt
|
|
assert AtomBoolOps.compare_elements(:cherry, :cherry) == :eq
|
|
end
|
|
end
|
|
|
|
describe "equal_element?/2" do
|
|
test "correctly checks atom equality" do
|
|
assert AtomBoolOps.equal_element?(:apple, :apple) == true
|
|
assert AtomBoolOps.equal_element?(:apple, :banana) == false
|
|
end
|
|
end
|
|
|
|
describe "hash_element/1" do
|
|
test "hashes atoms consistently" do
|
|
assert is_integer(AtomBoolOps.hash_element(:foo))
|
|
assert AtomBoolOps.hash_element(:foo) == AtomBoolOps.hash_element(:foo)
|
|
assert AtomBoolOps.hash_element(:foo) != AtomBoolOps.hash_element(:bar)
|
|
end
|
|
end
|
|
|
|
describe "leaf operations" do
|
|
test "empty_leaf/0 returns false" do
|
|
assert AtomBoolOps.empty_leaf() == false
|
|
end
|
|
|
|
test "any_leaf/0 returns true" do
|
|
assert AtomBoolOps.any_leaf() == true
|
|
end
|
|
|
|
test "is_empty_leaf?/1" do
|
|
assert AtomBoolOps.is_empty_leaf?(false) == true
|
|
assert AtomBoolOps.is_empty_leaf?(true) == false
|
|
end
|
|
|
|
test "union_leaves/3" do
|
|
assert AtomBoolOps.union_leaves(%{}, false, false) == false
|
|
assert AtomBoolOps.union_leaves(%{}, true, false) == true
|
|
assert AtomBoolOps.union_leaves(%{}, false, true) == true
|
|
assert AtomBoolOps.union_leaves(%{}, true, true) == true
|
|
end
|
|
|
|
test "intersection_leaves/3" do
|
|
assert AtomBoolOps.intersection_leaves(%{}, false, false) == false
|
|
assert AtomBoolOps.intersection_leaves(%{}, true, false) == false
|
|
assert AtomBoolOps.intersection_leaves(%{}, false, true) == false
|
|
assert AtomBoolOps.intersection_leaves(%{}, true, true) == true
|
|
end
|
|
|
|
test "negation_leaf/2" do
|
|
assert AtomBoolOps.negation_leaf(%{}, false) == true
|
|
assert AtomBoolOps.negation_leaf(%{}, true) == false
|
|
end
|
|
end
|
|
|
|
describe "test_leaf_value/1" do
|
|
test "returns :empty for false" do
|
|
assert AtomBoolOps.test_leaf_value(false) == :empty
|
|
end
|
|
|
|
test "returns :full for true" do
|
|
assert AtomBoolOps.test_leaf_value(true) == :full
|
|
end
|
|
|
|
# Conceptual test if atoms had other leaf values
|
|
# test "returns :other for other values" do
|
|
# assert AtomBoolOps.test_leaf_value(:some_other_leaf_marker) == :other
|
|
# end
|
|
end
|
|
end
|