@@ -59,7 +59,7 @@ class TheoriesBuilderTests extends AnyFunSuite with TestHelpers {
59
59
" %d - %s" .format(counter, theoryString)
60
60
}
61
61
62
-
62
+
63
63
val f1 = GreaterEquals (NumeralLit (42 ), NumeralLit (12 ))
64
64
mkTest(f1, SatStatus , uniqueName())
65
65
@@ -95,7 +95,7 @@ class TheoriesBuilderTests extends AnyFunSuite with TestHelpers {
95
95
" %d - %s" .format(counter, theoryString)
96
96
}
97
97
98
-
98
+
99
99
val f1 = GreaterEquals (NumeralLit (42 ), NumeralLit (12 ))
100
100
mkTest(f1, SatStatus , uniqueName())
101
101
@@ -119,6 +119,8 @@ class TheoriesBuilderTests extends AnyFunSuite with TestHelpers {
119
119
}
120
120
121
121
{
122
+ import theories .Core .Equals
123
+ import theories .Ints .NumeralLit
122
124
import theories .FixedSizeBitVectors ._
123
125
val theoryString = " Theory of Bit Vectors"
124
126
var counter = 0
@@ -127,7 +129,6 @@ class TheoriesBuilderTests extends AnyFunSuite with TestHelpers {
127
129
" %d - %s" .format(counter, theoryString)
128
130
}
129
131
130
-
131
132
val f1 = SGreaterEquals (BitVectorConstant (42 , 32 ), BitVectorConstant (12 , 32 ))
132
133
mkTest(f1, SatStatus , uniqueName())
133
134
@@ -160,5 +161,25 @@ class TheoriesBuilderTests extends AnyFunSuite with TestHelpers {
160
161
161
162
val f11 = UGreaterEquals (BitVectorLit (List (true , false )), BitVectorLit (List (true , false )))
162
163
mkTest(f11, SatStatus , uniqueName())
164
+
165
+ val f12 = Equals (Int2BV (8 , NumeralLit (42 )), BitVectorConstant (42 , 8 ))
166
+ mkTest(f12, SatStatus , uniqueName())
167
+
168
+ val f13 = Equals (BV2Nat (BitVectorConstant (42 , 8 )), NumeralLit (42 ))
169
+ mkTest(f13, SatStatus , uniqueName())
170
+
171
+ val f14 = Equals (Int2BV (8 , NumeralLit (24 )), BitVectorConstant (123 , 8 ))
172
+ mkTest(f14, UnsatStatus , uniqueName())
173
+
174
+ val f15 = Equals (BV2Nat (BitVectorConstant (42 , 8 )), NumeralLit (123 ))
175
+ mkTest(f15, UnsatStatus , uniqueName())
176
+
177
+ // Testing that Int2BV wraps around for integer exceeding the BV size
178
+ val f16 = Equals (Int2BV (8 , NumeralLit (42 + 256 * 3 )), BitVectorConstant (42 , 8 ))
179
+ mkTest(f16, SatStatus , uniqueName())
180
+
181
+ // Int2BV does not care about the sign
182
+ val f17 = Equals (Int2BV (8 , NumeralLit (- 214 )), BitVectorConstant (42 , 8 ))
183
+ mkTest(f17, SatStatus , uniqueName())
163
184
}
164
185
}
0 commit comments