public void ParameterRangeTest()
{
LBFGSComparer[] tests =
{
new LBFGSComparer() { m = -1 },
new LBFGSComparer() { epsilon = -1 },
new LBFGSComparer() { past = -1 },
new LBFGSComparer() { delta = -1},
new LBFGSComparer() { max_iterations = -1 },
new LBFGSComparer() { linesearch = (LineSearch)5 },
new LBFGSComparer() { max_linesearch = -1 },
new LBFGSComparer() { min_step = -1},
new LBFGSComparer() { max_step = -1 },
new LBFGSComparer() { ftol = -1 },
new LBFGSComparer() { wolfe = -1 },
new LBFGSComparer() { gtol = -1 },
new LBFGSComparer() { xtol = -1 },
new LBFGSComparer() { orthantwise_c = -1 },
new LBFGSComparer() { orthantwise_start = -1 },
new LBFGSComparer() { orthantwise_end = -1 },
new LBFGSComparer()
{
linesearch = LineSearch.RegularWolfe,
wolfe = -1
},
new LBFGSComparer()
{
linesearch = LineSearch.StrongWolfe,
wolfe = -1
},
new LBFGSComparer()
{
orthantwise_end = 2,
orthantwise_start = 3,
},
};
var problem = problems[0];
for (int i = 0; i < tests.Length; i++)
{
var test = tests[i];
string actual = String.Empty;
string expected = String.Empty;
try { test.Actual(problem); }
catch (Exception ex)
{
actual = ex.Data["Code"] as string;
if (actual == null)
throw;
}
test.Expected(problem);
expected = test.NativeCode;
if (actual == String.Empty)
actual = test.ActualMessage;
Assert.AreEqual(expected, actual);
Assert.AreNotEqual(String.Empty, actual);
}
}