Added ilib_include_flag macro to handle platform
[scilab.git] / scilab / modules / dynamic_link / tests / unit_tests / ilib_include_flag.tst
1 // =============================================================================                                                                                                                                  
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab                                                                                                                                                                                                                                                                                                                              
3 // Copyright (C) 2010 - DIGITEO - Vincent LEJEUNE
4 // Copyright (C) 2011 - DIGITEO - Allan CORNET
5 //
6 //  This file is distributed under the same license as the Scilab package.
7 // =============================================================================
8
9 // Check failure case
10 if ( execstr('ilib_include_flag(3)','errcatch') == 0 ) then pause, end
11
12 // not a dir, should fail
13
14 if ( execstr('ilib_include_flag(/usr/include/stdlib.h)','errcatch')  == 0 ) then pause, end
15
16  // should not exist, should fail
17 if ( execstr('ilib_include_flag(/usr/my_exotic_dir/);','errcatch')  == 0 ) then pause, end
18
19 cd TMPDIR;
20 mkdir("myincludespath");
21
22 if getos() == "Windows" then 
23   ref_flag = " -I""" + WSCI + "/bin"" " + "-I""" + WSCI + "/modules"" -I""" + getlongpathname(TMPDIR) + filesep() + "myincludespath""";
24   ref_flag = strsubst(ref_flag, "/", filesep());
25 else
26   ref_flag = " -I" + SCI + "/bin " + "-I" + SCI + "/modules -I" + TMPDIR + filesep() + "myincludespath";
27 end 
28
29 includes_path = [ "bin" , "modules" , TMPDIR + filesep() + "myincludespath"];
30 cd SCI;
31 output_flag = ilib_include_flag(includes_path);
32
33 if (ref_flag ~= output_flag) then pause, end