public void DoClone() { var builder = new SimpleExprBuilder(true); var dummyV = SymbooglixLibTests.MapProxyTests.GetVariable("dummy", BPLType.Int); // Hack dummyV.SetMetadata((int)Symbooglix.Annotation.AnnotationIndex.PROGRAM_LOCATION, new ProgramLocation(dummyV)); var v = new SymbolicVariable("foo", dummyV); var id = builder.Identifier(v); var c0 = new Constraint(builder.Gt(id, builder.ConstantInt(0))); var c1 = new Constraint(builder.Lt(id, builder.ConstantInt(10))); var CM0 = new ConstraintManager(); CM0.AddConstraint(c0); CM0.AddConstraint(c1); var copy = CM0.Clone(); Assert.AreNotSame(CM0, copy); Assert.AreEqual(CM0.Count, copy.Count); Assert.AreEqual(CM0.GetHashCode(), copy.GetHashCode()); Assert.IsTrue(CM0.Equals(copy)); // Modify original and check copy has not changed CM0.AddConstraint(new Constraint(builder.Lt(id, builder.ConstantInt(8)))); Assert.AreNotEqual(copy.GetHashCode(), CM0.GetHashCode()); Assert.IsFalse(CM0.Equals(copy)); Assert.AreEqual(2, copy.Count); Assert.AreEqual(3, CM0.Count); }