From: <sla...@us...> - 2012-03-19 00:34:05
|
Revision: 9957 http://octave.svn.sourceforge.net/octave/?rev=9957&view=rev Author: slackydeb Date: 2012-03-19 00:33:59 +0000 (Mon, 19 Mar 2012) Log Message: ----------- ga: add unit test for ga Modified Paths: -------------- trunk/octave-forge/main/ga/inst/ga.m Modified: trunk/octave-forge/main/ga/inst/ga.m =================================================================== --- trunk/octave-forge/main/ga/inst/ga.m 2012-03-19 00:33:47 UTC (rev 9956) +++ trunk/octave-forge/main/ga/inst/ga.m 2012-03-19 00:33:59 UTC (rev 9957) @@ -129,6 +129,7 @@ ## type of arguments # TODO +# TODO: test that each field in the user-specified "problem" structure is checked ## flawless execution with right arguments %!shared f, nvars @@ -148,7 +149,11 @@ %!test x = ga (f, nvars, [], [], [], [], [], [], @(x) [[], []]); %!test x = ga (f, nvars, [], [], [], [], [], [], @nonlcon); %!test x = ga (f, nvars, [], [], [], [], [], [], @(x) [[], []], gaoptimset ()); -# TODO: %!test x = ga (problem); +%!test # TODO: convert to error after implementing private ga-specific createOptimProblem. All fields in the user-specified structure should be checked +%! problem = struct ("fitnessfcn", @rastriginsfcn, +%! "nvars", 2, +%! "options", gaoptimset ()); +%! x = ga (problem); %!test x = ga (struct ("fitnessfcn", @rastriginsfcn, "nvars", 2, "options", gaoptimset ("FitnessLimit", 1e-7, "Generations", 1000))); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |