public static void TestTryCombine([PexAssumeUnderTest] StatementLoopOverGroupItems target, IStatement statement)
 {
     var canComb = target.TryCombineStatement(statement, null);
     Assert.IsNotNull(statement, "Second statement null should cause a failure");
     var allSame = target.CodeItUp().Zip(statement.CodeItUp(), (f, s) => f == s).All(t => t);
     Assert.IsTrue(allSame == canComb || target.Statements.Count() == 0, "not expected combination!");
 }
 public static void TestTryCombine([PexAssumeUnderTest] StatementRecordPairValues target, IStatement statement)
 {
     var canComb = target.TryCombineStatement(statement, null);
     Assert.IsNotNull(statement, "Second statement null should cause a failure");
     var allSame = target.CodeItUp().Zip(statement.CodeItUp(), (f, s) => f == s).All(t => t);
     Assert.AreEqual(allSame, canComb, "not expected combination!");
 }
 public static void TestTryCombine([PexAssumeUnderTest] StatementLoopOverSortedPairValue target, IStatement statement)
 {
     var canComb = target.TryCombineStatement(statement, null);
     Assert.IsNotNull(statement, "Second statement null should cause a failure");
     var allSame = target.CodeItUp().Zip(statement.CodeItUp(), (f, s) => f == s).All(t => t);
     Assert.IsTrue(allSame == canComb || target.Statements.Count() == 0, "not expected combination!");
 }
Пример #4
0
        public static void TestTryCombine([PexAssumeUnderTest] StatementLoopOverGroups target, IStatement statement)
        {
            var canComb = target.TryCombineStatement(statement, null);

            Assert.IsNotNull(statement, "Second statement null should cause a failure");
            var allSame = target.CodeItUp().Zip(statement.CodeItUp(), (f, s) => f == s).All(t => t);

            Assert.AreEqual(allSame, canComb, "not expected combination!");
        }
 public bool TestTryCombine([PexAssumeUnderTest] StatementIncrementInteger statement, IStatement toCombineWith)
 {
     var result = statement.TryCombineStatement(toCombineWith, null);
     if (toCombineWith != null)
     {
         var identical = statement.CodeItUp().Zip(toCombineWith.CodeItUp(), (f, s) => f == s).All(v => v == true);
         Assert.AreEqual(identical, result, "Combined but not the same");
     }
     return result;
 }
        public bool TestTryCombine([PexAssumeUnderTest] StatementIncrementInteger statement, IStatement toCombineWith)
        {
            var result = statement.TryCombineStatement(toCombineWith, null);

            if (toCombineWith != null)
            {
                var identical = statement.CodeItUp().Zip(toCombineWith.CodeItUp(), (f, s) => f == s).All(v => v == true);
                Assert.AreEqual(identical, result, "Combined but not the same");
            }
            return(result);
        }
        public bool TryCombineStatementTest([PexAssumeUnderTest] StatementRecordIndicies target, IStatement statement)
        {
            var result = target.TryCombineStatement(statement, null);

            if (statement == null)
                Assert.Fail("Null statement should have caused an exception");

            var allSame = target.CodeItUp().Zip(statement.CodeItUp(), (f, s) => f == s).All(t => t);
            Assert.AreEqual(allSame, result, "not expected combination!");

            return result;
        }
        public IStatement TestRename([PexAssumeUnderTest] IStatement statement, [PexAssumeNotNull] string oldname, [PexAssumeNotNull] string newname)
        {
            var origianllines = statement.CodeItUp().ToArray();

            statement.RenameVariable(oldname, newname);
            var finallines = statement.CodeItUp().ToArray();

            Assert.AreEqual(origianllines.Length, finallines.Length, "# of lines change during variable rename");

            var varReplacer = new Regex(string.Format(@"\b{0}\b", oldname));

            var sharedlines = origianllines.Zip(finallines, (o, n) => Tuple.Create(o, n));

            foreach (var pair in sharedlines)
            {
                var orig         = pair.Item1;
                var origReplafce = varReplacer.Replace(orig, newname);
                Assert.AreEqual(origReplafce, pair.Item2, "expected the renaming to be pretty simple.");
            }

            return(statement);
        }
        public bool TryCombineStatementTest([PexAssumeUnderTest] StatementRecordIndicies target, IStatement statement)
        {
            var result = target.TryCombineStatement(statement, null);

            if (statement == null)
            {
                Assert.Fail("Null statement should have caused an exception");
            }

            var allSame = target.CodeItUp().Zip(statement.CodeItUp(), (f, s) => f == s).All(t => t);

            Assert.AreEqual(allSame, result, "not expected combination!");

            return(result);
        }
Пример #10
0
 internal static IEnumerable <string> DumpCode(this IStatement block)
 {
     return(block.CodeItUp());
 }