1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2// Copyright (C) 2009-2011 - DIGITEO - Michael Baudin 3// 4// Copyright (C) 2012 - 2016 - Scilab Enterprises 5// 6// This file is hereby licensed under the terms of the GNU GPL v2.0, 7// pursuant to article 5.3.4 of the CeCILL v.2.1. 8// This file was originally licensed under the terms of the CeCILL v2.1, 9// and continues to be available under such terms. 10// For more information, see the COPYING file which you should have received 11// along with this program. 12 13// <-- CLI SHELL MODE --> 14 15// 16// val = optimget ( options , key ) 17// 18op = optimset (); 19op = optimset(op,'TolX',1.e-12); 20val = optimget(op,'TolX'); 21assert_checkequal ( val , 1.e-12 ); 22 23// 24// val = optimget ( options , key , value ) with non-empty value 25// 26op = optimset (); 27op = optimset(op,'TolX',1.e-12); 28val = optimget(op,'TolX' , 1.e-5); 29assert_checkequal ( val , 1.e-12 ); 30// 31// val = optimget ( options , key , value ) with empty value 32// 33op = optimset (); 34val = optimget(op,'TolX' , 1.e-5); 35assert_checkequal ( val , 1.e-5 ); 36 37// 38// val = optimget ( options , key ) with ambiguous key 39// 40op = optimset (); 41op = optimset(op,'TolX',1.e-12); 42cmd = "optimget(op,''Tol'' )"; 43assert_checkerror(cmd,"%s: Ambiguous property name %s matches several fields : %s",[],"optimget","Tol","TolFun TolX"); 44 45// 46// Test with wrong number of arguments 47// 48op = optimset (); 49cmd = "optimget ( op )"; 50assert_checkerror(cmd,"%s: Wrong number of arguments : %d expected while %d given",[],"optimget",2,1); 51 52// 53// Test with wrong number of arguments 54// 55op = optimset (); 56cmd = "optimget ( op , ""TolX"" , 1.e-12 , 1.e-13)"; 57assert_checkerror(cmd,"%s: Wrong number of arguments : %d expected while %d given",[],"optimget",2,4); 58// 59// val = optimget ( options , key ) with leading characters only 60// 61op = optimset (); 62op = optimset ( op , 'MaxFunEvals' , 1000 ); 63val = optimget ( op , 'MaxF' ); 64assert_checkequal ( val , 1000 ); 65// 66// val = optimget ( options , key , default ) 67// 68default = optimset ( 'fminsearch' ); 69op = optimset (); 70value = optimget(op,'TolX',default.TolX); 71assert_checkequal ( value , 1.e-4 ); 72 73