1// ============================================================================= 2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3// Copyright (C) 2015 - Scilab Enterprises - Antoine ELIAS 4// 5// This file is distributed under the same license as the Scilab package. 6// ============================================================================= 7 8// <-- CLI SHELL MODE --> 9 10function test_polynomial(safe) 11 ilib_verbose(0); 12 mkdir(pathconvert(TMPDIR+"/api_c/" + safe)); 13 cd(pathconvert(TMPDIR+"/api_c/" + safe)); 14 copyfile(SCI+"/modules/api_scilab/tests/unit_tests/api_c/polynomial_test.c",pathconvert(TMPDIR+"/api_c/" + safe + "/polynomial_test.c",%F)); 15 16 cflags = ""; 17 if safe == "unsafe" then 18 cflags = "-D__API_SCILAB_UNSAFE__"; 19 end 20 21 ilib_build("libpolynomial" + safe,["polynomial_test","sci_polynomial_test", "csci6"],"polynomial_test.c",[],"","",cflags); 22 exec("loader.sce"); 23 24 in1 = [10, 4*%s + 8, -5 + 6*%s - 7*%s**2;10, 4*%s + 8, -5 + 6*%s - 7*%s**2], 25 in2 = 1-%s**2; 26 27 [out1, out2] = polynomial_test(in1, in2); 28 assert_checkequal(out1, in1 *%s); 29 assert_checkequal(out2, -in2); 30 disp("OK"); 31endfunction 32 33test_polynomial("safe"); 34test_polynomial("unsafe"); 35