summaryrefslogtreecommitdiff
path: root/Source/UnitTests
diff options
context:
space:
mode:
authorGravatar Dan Liew <daniel.liew@imperial.ac.uk>2015-02-12 11:51:20 +0000
committerGravatar Dan Liew <daniel.liew@imperial.ac.uk>2015-02-12 11:51:20 +0000
commit59fdb656f09cb4f51fc60d30d8c1bef59f5f908d (patch)
tree3686031fea5c60fd545ccbeb4ee0ceae2b06a73d /Source/UnitTests
parentb1bd1bca3bab1912924e7401cee111bce8c28422 (diff)
Protect Bitvector field of BvExtractExpr when it is immutable.
Diffstat (limited to 'Source/UnitTests')
-rw-r--r--Source/UnitTests/CoreTests/ExprImmutability.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/UnitTests/CoreTests/ExprImmutability.cs b/Source/UnitTests/CoreTests/ExprImmutability.cs
index 98e7158f..b83983b6 100644
--- a/Source/UnitTests/CoreTests/ExprImmutability.cs
+++ b/Source/UnitTests/CoreTests/ExprImmutability.cs
@@ -269,6 +269,15 @@ namespace CoreTests
Assert.IsTrue(concat.Immutable);
concat.E1 = lhs; // Should throw
}
+
+ [Test(), ExpectedException(typeof(InvalidOperationException))]
+ public void ProtectedBvExtract()
+ {
+ var bv = new LiteralExpr(Token.NoToken, Microsoft.Basetypes.BigNum.FromInt(0), 32, /*immutable=*/true);
+ var extract = new BvExtractExpr(Token.NoToken, bv, 32, 0, /*immutable=*/true);
+ Assert.IsTrue(extract.Immutable);
+ extract.Bitvector = bv; // Should throw
+ }
}
}