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// <-- CLI SHELL MODE --> 8ilib_verbose(0); 9function test_double(safe) 10 mkdir(pathconvert(TMPDIR+"/api_c/" + safe)); 11 cd(pathconvert(TMPDIR+"/api_c/" + safe)); 12 copyfile(SCI+"/modules/api_scilab/tests/unit_tests/api_c/double_test.c",pathconvert(TMPDIR+"/api_c/" + safe + "/double_test.c",%F)); 13 cflags = ""; 14 if safe == "unsafe" then 15 cflags = "-D__API_SCILAB_UNSAFE__"; 16 end 17 18 ilib_build("libdouble" + safe,["double_test","sci_double_test", "csci6"],"double_test.c",[],"","",cflags); 19 exec("loader.sce"); 20 21 in1 = rand(3,4); 22 in2 = rand(); 23 [out1, out2, out3] = double_test(in1, in2); 24 assert_checkequal(out1, in1 * 10); 25 ref(:,:, 1) = in1 * 10; 26 ref(:,:, 2) = in1 * 100; 27 assert_checkequal(out2, ref); 28 assert_checkequal(out3, in2 * 1000); 29 disp("OK"); 30endfunction 31test_double("safe"); 32 "OK" 33test_double("unsafe"); 34 "OK" 35