public void RelativeConvergenceConstructorTest()
{
var criteria = new RelativeConvergence(iterations: 0, tolerance: 0.1);
int progress = 1;
do
{
// Do some processing...
// Update current iteration information:
criteria.NewValue = 12345.6 / progress++;
} while (!criteria.HasConverged);
// The method will converge after reaching the
// maximum of 11 iterations with a final value
// of 1234.56:
int iterations = criteria.CurrentIteration; // 11
double value = criteria.OldValue; // 1234.56
Assert.AreEqual(11, criteria.CurrentIteration);
Assert.AreEqual(1234.56, criteria.OldValue);
}
}