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 --> 8function test_string(safe) 9 ilib_verbose(0); 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/string_test.c",pathconvert(TMPDIR+"/api_c/" + safe + "/string_test.c",%F)); 13 cflags = ""; 14 if safe == "unsafe" then 15 cflags = "-D__API_SCILAB_UNSAFE__"; 16 end 17 ilib_build("libstring" + safe,["string_test","sci_string_test", "csci6"],"string_test.c",[],"","",cflags); 18 exec("loader.sce"); 19 in1 = ["one.one", "one.two", "one.three", "one.four"; "two.one", "two.two", "two.three", "two.four"; "three.one", "three.two", "three.three", "three.four"]; 20 in2 = "IBM©"; 21 [out1, out2] = string_test(in1, in2); 22 ref(:,:,1) = in1 + ".one"; 23 ref(:,:,2) = in1 + ".two"; 24 assert_checkequal(out1, ref); 25 assert_checkequal(out2, "HAL©"); 26 disp("OK"); 27endfunction 28test_string("safe"); 29 "OK" 30test_string("unsafe"); 31 "OK" 32