scilab: implement test li_std_string
This commit is contained in:
parent
35ef7b774b
commit
139449f424
3 changed files with 72 additions and 3 deletions
|
|
@ -83,11 +83,22 @@ void test_const_pointer_throw() throw(const std::string *) {
|
|||
std::string *Structure::StaticMemberString2 };
|
||||
*/
|
||||
|
||||
|
||||
%inline %{
|
||||
std::string GlobalString;
|
||||
std::string GlobalString2 = "global string 2";
|
||||
const std::string ConstGlobalString = "const global string";
|
||||
|
||||
#ifdef SWIGSCILAB
|
||||
%rename(St) MemberString;
|
||||
%rename(Str) MemberString;
|
||||
%rename(Str2) MemberString2;
|
||||
%rename(StaticStr) StaticMemberString;
|
||||
%rename(StaticStr2) StaticMemberString2;
|
||||
%rename(ConstStr) ConstMemberString;
|
||||
%rename(ConstStaticStr) ConstStaticMemberString;
|
||||
#endif
|
||||
|
||||
struct Structure {
|
||||
std::string MemberString;
|
||||
std::string MemberString2;
|
||||
|
|
|
|||
58
Examples/test-suite/scilab/li_std_string_extra_runme.sci
Normal file
58
Examples/test-suite/scilab/li_std_string_extra_runme.sci
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
exec("swigtest.start", -1);
|
||||
|
||||
x = "hello";
|
||||
|
||||
// li_std_string tests
|
||||
|
||||
// Function tests
|
||||
|
||||
if test_ccvalue(x) <> x then swigtesterror(); end
|
||||
if test_cvalue(x) <> x then swigtesterror(); end
|
||||
if test_value(x) <> x then swigtesterror(); end
|
||||
|
||||
if test_const_reference(x) <> x then swigtesterror(); end
|
||||
if test_reference_input(x) <> x then swigtesterror(); end
|
||||
if test_reference_inout(x) <> x+x then swigtesterror(); end
|
||||
|
||||
//if test_reference_out() <> "test_reference_out message" then swigtesterror(); end
|
||||
//if test_const_pointer_out() <> "x" then swigtesterror(); end
|
||||
|
||||
s = "initial string";
|
||||
|
||||
// Global variable tests
|
||||
|
||||
if GlobalString2_get() <> "global string 2" then swigtesterror(); end
|
||||
GlobalString2_set(s);
|
||||
if GlobalString2_get() <> s then swigtesterror(); end
|
||||
|
||||
if ConstGlobalString_get() <> "const global string" then swigtesterror(); end
|
||||
|
||||
// Member variable tests
|
||||
|
||||
myStructure = new_Structure();
|
||||
if Structure_Str2_get(myStructure) <> "member string 2" then swigtesterror(); end
|
||||
|
||||
Structure_Str2_set(myStructure, s);
|
||||
if Structure_Str2_get(myStructure) <> s then swigtesterror(); end
|
||||
|
||||
if Structure_ConstStr_get(myStructure) <> "const member string" then swigtesterror(); end
|
||||
|
||||
if Structure_StaticStr2_get() <> "static member string 2" then swigtesterror(); end
|
||||
|
||||
Structure_StaticStr2_set(s);
|
||||
if Structure_StaticStr2_get() <> s then swigtesterror(); end
|
||||
|
||||
if Structure_ConstStaticStr_get() <> "const static member string" then swigtesterror(); end
|
||||
|
||||
|
||||
if stdstring_empty() <> "" then swigtesterror(); end
|
||||
if c_empty() <> "" then swigtesterror(); end
|
||||
|
||||
|
||||
// li_std_string_extra tests
|
||||
|
||||
//if test_value_basic1(x) <> x then swigtesterror(); end
|
||||
//if test_value_basic2(x) <> x then swigtesterror(); end
|
||||
//if test_value_basic3(x) <> x then swigtesterror(); end
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
Loading…
Add table
Add a link
Reference in a new issue