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