Example #1
0
        public void TestIterationCounter()
        {
            int         maxiter = 2;
            EndCriteria ec      = new EndCriteria(maxiter, 1e-8, 100, 100);

            Assert.AreEqual(ec.maxIteration, maxiter);

            ec.iterationCounter++;

            Assert.IsTrue(!ec.CheckIterations());
            Assert.AreEqual(ec.Criteria, EndCriteria.CriteriaType.None);

            ec.iterationCounter++;

            Assert.IsTrue(ec.CheckIterations());
            Assert.AreEqual(ec.Criteria, EndCriteria.CriteriaType.MaximumIteration);

            ec.Reset();
            Assert.AreEqual(ec.iterationCounter, 0);
            Assert.IsTrue(!ec.CheckIterations());
            Assert.AreEqual(ec.Criteria, EndCriteria.CriteriaType.None);
        }