public void ConcatExtractsNoFold() { var cfb = GetConstantFoldingBuilder(); var id0 = GetVarAndIdExpr("x", BasicType.GetBvType(16)).Item2; var id1 = GetVarAndIdExpr("y", BasicType.GetBvType(16)).Item2; var msb = cfb.BVEXTRACT(id0, 16, 8); var lsb = cfb.BVEXTRACT(id1, 8, 0); // Different variables so this should not be simplified to a single extract var result = cfb.BVCONCAT(msb, lsb); // FIXME: Can't check type due to bugs in Boogie. It tries to change the type on immutabl Expr // CheckIsBvType(result, 16); Assert.IsTrue(result.Type.IsBv); Assert.AreEqual(16, result.Type.BvBits); var asBvConcat = ExprUtil.AsBVCONCAT(result); Assert.IsNotNull(asBvConcat); Assert.AreSame(msb, asBvConcat.E0); Assert.AreSame(lsb, asBvConcat.E1); }
public void noFold() { var pair = GetSimpleAndConstantFoldingBuilder(); var sb = pair.Item1; var cfb = pair.Item2; var id0 = GetVarAndIdExpr("foo0", BasicType.GetBvType(8)).Item2; var id1 = GetVarAndIdExpr("foo1", BasicType.GetBvType(8)).Item2; var foldedResult = cfb.BVCONCAT(id0, id1); var simpleResult = sb.BVCONCAT(id0, id1); // FIXME: Typechecking a BvConcatExpr is broken in Boogie, it tries to change the type! //CheckIsBvType(foldedResult, 16); Assert.IsTrue(foldedResult.Type.IsBv); Assert.AreEqual(16, foldedResult.Type.BvBits); Assert.AreEqual(simpleResult, foldedResult); var asBvConcat = ExprUtil.AsBVCONCAT(foldedResult); Assert.IsNotNull(asBvConcat); Assert.AreSame(id0, asBvConcat.E0); Assert.AreSame(id1, asBvConcat.E1); }