1// ============================================================================= 2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3// Copyright (C) 2017 - Scilab Enterprises 4// 5// This file is distributed under the same license as the Scilab package. 6// ============================================================================= 7 8// <-- NO CHECK REF --> 9// <-- CLI SHELL MODE --> 10 11ilib_verbose(0); 12 13tmpDir = fullfile(TMPDIR, "api_c"); 14mkdir(tmpDir); 15cd(tmpDir); 16copyfile(fullfile(SCI, "modules/api_scilab/tests/unit_tests/api_c/optional.c"), .. 17 fullfile(tmpDir, "optional.c")); 18 19ilib_build("liboptional", ["optional_args", "sci_optional_args"], "optional.c", .. 20 [], "", "", ""); 21exec("loader.sce"); 22 23ret = optional_args(); 24assert_checkequal(ret, "John Doe, 77 years old, does not have a driving license."); 25ret = optional_args(name="Bill"); 26assert_checkequal(ret, "Bill, 77 years old, does not have a driving license."); 27ret = optional_args(name="Bill", age=22); 28assert_checkequal(ret, "Bill, 22 years old, does not have a driving license."); 29ret = optional_args(age=22, name="Bill"); 30assert_checkequal(ret, "Bill, 22 years old, does not have a driving license."); 31ret = optional_args(name="Bill", age=22, driving_license=%t); 32assert_checkequal(ret, "Bill, 22 years old, has a driving license."); 33ret = optional_args(name="Walter", driving_license=%t); 34assert_checkequal(ret, "Walter, 77 years old, has a driving license."); 35 36ulink(0);