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
68 lines
2.1 KiB
Elixir
68 lines
2.1 KiB
Elixir
defmodule Tilly.BDD.IntegerBoolOpsTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
alias Tilly.BDD.IntegerBoolOps
|
|
|
|
describe "compare_elements/2" do
|
|
test "correctly compares integers" do
|
|
assert IntegerBoolOps.compare_elements(1, 2) == :lt
|
|
assert IntegerBoolOps.compare_elements(2, 1) == :gt
|
|
assert IntegerBoolOps.compare_elements(1, 1) == :eq
|
|
end
|
|
end
|
|
|
|
describe "equal_element?/2" do
|
|
test "correctly checks equality of integers" do
|
|
assert IntegerBoolOps.equal_element?(1, 1) == true
|
|
assert IntegerBoolOps.equal_element?(1, 2) == false
|
|
end
|
|
end
|
|
|
|
describe "hash_element/1" do
|
|
test "returns the integer itself as hash" do
|
|
assert IntegerBoolOps.hash_element(123) == 123
|
|
assert IntegerBoolOps.hash_element(-5) == -5
|
|
end
|
|
end
|
|
|
|
describe "leaf operations" do
|
|
test "empty_leaf/0 returns false" do
|
|
assert IntegerBoolOps.empty_leaf() == false
|
|
end
|
|
|
|
test "any_leaf/0 returns true" do
|
|
assert IntegerBoolOps.any_leaf() == true
|
|
end
|
|
|
|
test "is_empty_leaf?/1" do
|
|
assert IntegerBoolOps.is_empty_leaf?(false) == true
|
|
assert IntegerBoolOps.is_empty_leaf?(true) == false
|
|
end
|
|
end
|
|
|
|
describe "union_leaves/3" do
|
|
test "computes boolean OR" do
|
|
assert IntegerBoolOps.union_leaves(%{}, true, true) == true
|
|
assert IntegerBoolOps.union_leaves(%{}, true, false) == true
|
|
assert IntegerBoolOps.union_leaves(%{}, false, true) == true
|
|
assert IntegerBoolOps.union_leaves(%{}, false, false) == false
|
|
end
|
|
end
|
|
|
|
describe "intersection_leaves/3" do
|
|
test "computes boolean AND" do
|
|
assert IntegerBoolOps.intersection_leaves(%{}, true, true) == true
|
|
assert IntegerBoolOps.intersection_leaves(%{}, true, false) == false
|
|
assert IntegerBoolOps.intersection_leaves(%{}, false, true) == false
|
|
assert IntegerBoolOps.intersection_leaves(%{}, false, false) == false
|
|
end
|
|
end
|
|
|
|
describe "negation_leaf/2" do
|
|
test "computes boolean NOT" do
|
|
assert IntegerBoolOps.negation_leaf(%{}, true) == false
|
|
assert IntegerBoolOps.negation_leaf(%{}, false) == true
|
|
end
|
|
end
|
|
end
|