@@ -21,3 +21,44 @@ TEST_CASE("SMT core theory \"not\".", "[core][smt2_incremental]")
21
21
cbmc_invariants_should_throwt invariants_throw;
22
22
CHECK_THROWS (smt_core_theoryt::make_not (smt_bit_vector_constant_termt{0 , 1 }));
23
23
}
24
+
25
+ TEST_CASE (" SMT core theory \" =\" ." , " [core][smt2_incremental]" )
26
+ {
27
+ SECTION (" Bool sorted term comparison" )
28
+ {
29
+ const smt_bool_literal_termt true_term{true };
30
+ const smt_bool_literal_termt false_term{false };
31
+ const auto bool_comparison = smt_core_theoryt::equal (true_term, false_term);
32
+ CHECK (bool_comparison.get_sort () == smt_bool_sortt{});
33
+ CHECK (
34
+ bool_comparison.function_identifier () ==
35
+ smt_identifier_termt{" =" , smt_bool_sortt{}});
36
+ REQUIRE (bool_comparison.arguments ().size () == 2 );
37
+ REQUIRE (bool_comparison.arguments ()[0 ].get () == true_term);
38
+ REQUIRE (bool_comparison.arguments ()[1 ].get () == false_term);
39
+ }
40
+
41
+ SECTION (" Bit vector sorted term comparison" )
42
+ {
43
+ const smt_bit_vector_constant_termt two{2 , 8 };
44
+ const smt_bit_vector_constant_termt three{3 , 8 };
45
+ const auto bit_vector_comparison = smt_core_theoryt::equal (two, three);
46
+ CHECK (bit_vector_comparison.get_sort () == smt_bool_sortt{});
47
+ CHECK (
48
+ bit_vector_comparison.function_identifier () ==
49
+ smt_identifier_termt{" =" , smt_bool_sortt{}});
50
+ REQUIRE (bit_vector_comparison.arguments ().size () == 2 );
51
+ REQUIRE (bit_vector_comparison.arguments ()[0 ].get () == two);
52
+ REQUIRE (bit_vector_comparison.arguments ()[1 ].get () == three);
53
+ }
54
+
55
+ SECTION (" Mismatch sort invariant" )
56
+ {
57
+ cbmc_invariants_should_throwt invariants_throw;
58
+ CHECK_THROWS (smt_core_theoryt::equal (
59
+ smt_bit_vector_constant_termt{2 , 8 },
60
+ smt_bit_vector_constant_termt{2 , 16 }));
61
+ CHECK_THROWS (smt_core_theoryt::equal (
62
+ smt_bit_vector_constant_termt{2 , 8 }, smt_bool_literal_termt{true }));
63
+ }
64
+ }
0 commit comments