Skip to content

Commit

Permalink
Merge pull request #254 from uclid-org/fix-253
Browse files Browse the repository at this point in the history
Fix data type hashing; fix 253
  • Loading branch information
FedericoAureliano committed Jul 17, 2024
2 parents 289628e + a063957 commit 86f2248
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/uclid/smt/SMTLanguage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ case object UndefinedType extends Type {

case class DataType(id : String, cstors : List[ConstructorType]) extends Type {
override val hashId = 111
override val hashCode = finalize(hashId, 0)
override val md5hashCode = computeMD5Hash
override val hashCode = computeHash(id, cstors)
override val md5hashCode = computeMD5Hash(id, cstors)
override def toString = "data " + cstors // TODO
override val typeNamePrefix = "data"
override def isUndefined = true
Expand Down
5 changes: 3 additions & 2 deletions src/test/scala/SMTLIB2Spec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,15 @@ class SMTLIB2Spec extends AnyFlatSpec {
"issue-187b.ucl" should "verify all assertions." in {
SMTLIB2Spec.expectedFails("./test/issue-187b.ucl", 0)
}
"issue-253.ucl" should "fail all 2 assertions." in {
SMTLIB2Spec.expectedFails("./test/issue-253.ucl", 2)
}
"issue-255.ucl" should "faill single assertion." in {
SMTLIB2Spec.expectedFails("./test/issue-255.ucl", 1)
}
"test-redundant-assign.ucl" should "verify all assertions." in {
SMTLIB2Spec.expectedFails("./test/test-redundant-assign.ucl", 0)
}


"test-history-1.ucl" should "verify all assertions." in {
SMTLIB2Spec.expectedFails("./test/test-history-1.ucl", 0)
}
Expand Down
19 changes: 19 additions & 0 deletions test/issue-253.ucl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module main {
datatype adt1 = A() | B();
datatype adt2 = C() | D();

var y: adt1;
var x: adt2;

init {
assert y == B();
assert x == C();
}


control {
bmc(0);
check;
print_results;
}
}

0 comments on commit 86f2248

Please sign in to comment.