Example #1
0
 public void TestToExpressionString()
 {
     concatNode = new ExprConcatNode();
     concatNode.AddChildNode(new SupportExprNode("a"));
     concatNode.AddChildNode(new SupportExprNode("b"));
     Assert.AreEqual("\"a\"||\"b\"", ExprNodeUtilityPrint.ToExpressionStringMinPrecedenceSafe(concatNode));
     concatNode.AddChildNode(new SupportExprNode("c"));
     Assert.AreEqual("\"a\"||\"b\"||\"c\"", ExprNodeUtilityPrint.ToExpressionStringMinPrecedenceSafe(concatNode));
 }
Example #2
0
        public void TestEvaluate()
        {
            concatNode.AddChildNode(new SupportExprNode("x"));
            concatNode.AddChildNode(new SupportExprNode("y"));
            SupportExprNodeUtil.Validate(container, concatNode);
            Assert.AreEqual(typeof(string), concatNode.Forge.EvaluationType);
            Assert.AreEqual("xy", concatNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            concatNode.AddChildNode(new SupportExprNode("z"));
            SupportExprNodeUtil.Validate(container, concatNode);
            Assert.AreEqual("xyz", concatNode.Forge.ExprEvaluator.Evaluate(null, false, null));
        }
Example #3
0
        private void RunAssertionThreading(ThreadingProfile threadingProfile)
        {
            concatNode = new ExprConcatNode();
            var textA = "This is the first text";
            var textB = "Second text";
            var textC = "Third text, some more";

            foreach (var text in Arrays.AsList(textA, textB, textC))
            {
                concatNode.AddChildNode(new ExprConstantNodeImpl(text));
            }

            concatNode.Validate(SupportExprValidationContextFactory.MakeEmpty(container, threadingProfile));

            var numThreads = 4;
            var numLoop    = 10000;

            var threads = new List <Pair <Thread, SupportConcat> >(numThreads);

            for (var i = 0; i < numThreads; i++)
            {
                var supportConcat = new SupportConcat(concatNode, numLoop, textA + textB + textC);
                var thread        = new Thread(supportConcat.Run);
                threads.Add(new Pair <Thread, SupportConcat>(thread, supportConcat));
                thread.Start();
            }

            foreach (var threadPair in threads)
            {
                threadPair.First.Join();
                Assert.IsFalse(threadPair.Second.IsFail);
            }
        }