scilab: fix tests having too long identifier names

This commit is contained in:
Simon Marchetto 2014-09-29 14:52:05 +02:00
commit 7307d967d0
16 changed files with 97 additions and 45 deletions

View file

@ -4,6 +4,10 @@
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) DirectorTest; %warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) DirectorTest;
#if defined(SWIGSCILAB)
%rename(DirTest) DirectorTest;
#endif
%apply signed char {char, const char}; %apply signed char {char, const char};
%apply const signed char & {const char &}; %apply const signed char & {const char &};

View file

@ -1,5 +1,5 @@
/* Test %apply for char *, signed char *, unsigned char * /* Test %apply for char *, signed char *, unsigned char *
This won't work in all situations, so does not necessarily have to be implemented. See This won't work in all situations, so does not necessarily have to be implemented. See
http://groups.google.com.ai/group/comp.lang.c++.moderated/browse_thread/thread/ad5873ce25d49324/0ae94552452366be?lnk=raot */ http://groups.google.com.ai/group/comp.lang.c++.moderated/browse_thread/thread/ad5873ce25d49324/0ae94552452366be?lnk=raot */
%module(directors="1") apply_strings %module(directors="1") apply_strings
@ -7,6 +7,11 @@
%warnfilter(SWIGWARN_TYPEMAP_VARIN_UNDEF) DigitsGlobalB; %warnfilter(SWIGWARN_TYPEMAP_VARIN_UNDEF) DigitsGlobalB;
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK) DigitsGlobalC; %warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK) DigitsGlobalC;
#if defined(SWIGSCILAB)
%rename(TNum) TNumber;
%rename(DirTest) DirectorTest;
#endif
%apply char * {UCharPtr}; %apply char * {UCharPtr};
%apply char * {SCharPtr}; %apply char * {SCharPtr};
%apply const char * {CUCharPtr}; %apply const char * {CUCharPtr};
@ -53,12 +58,12 @@ typedef struct {
TAscii DigitsMemberA[20]; TAscii DigitsMemberA[20];
TAscii *DigitsMemberB; TAscii *DigitsMemberB;
} TNumber; } TNumber;
TAscii DigitsGlobalA[20]; TAscii DigitsGlobalA[20];
TAscii DigitsGlobalB[] = {(unsigned char)'A', (unsigned char)'B', 0}; TAscii DigitsGlobalB[] = {(unsigned char)'A', (unsigned char)'B', 0};
TAscii *DigitsGlobalC; TAscii *DigitsGlobalC;
%} %}
// Director test // Director test
%feature("director"); %feature("director");

View file

@ -1,5 +1,9 @@
%module array_member %module array_member
#if defined(SWIGSCILAB)
%rename(RayPkt) RayPacketData;
#endif
%inline %{ %inline %{
typedef struct Foo { typedef struct Foo {

View file

@ -1,4 +1,9 @@
%module array_typedef_memberin %module array_typedef_memberin
#if defined(SWIGSCILAB)
%rename(ExDetail) ExampleDetail;
#endif
%inline %{ %inline %{
typedef short Eight[8]; typedef short Eight[8];
typedef const short ConstEight[8]; typedef const short ConstEight[8];

View file

@ -7,6 +7,10 @@ This test case tests that various types of arrays are working.
#include <stdlib.h> #include <stdlib.h>
%} %}
#if defined(SWIGSCILAB)
%rename(ArrSt) ArrayStruct;
#endif
%inline %{ %inline %{
#define ARRAY_LEN 2 #define ARRAY_LEN 2

View file

@ -2,16 +2,20 @@
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) kMaxIOCTLSpaceParmsSize; %warnfilter(SWIGWARN_RUBY_WRONG_NAME) kMaxIOCTLSpaceParmsSize;
#define kMaxIOCTLSpaceParmsSize 128 #ifdef SWIGSCILAB
%rename(Parms) sm_channel_ix_dump_parms;
#endif
#define kMaxIOCTLSpaceParmsSize 128
%{ %{
#define kMaxIOCTLSpaceParmsSize 128 #define kMaxIOCTLSpaceParmsSize 128
%} %}
%inline %{ %inline %{
typedef struct sm_channel_ix_dump_parms { typedef struct sm_channel_ix_dump_parms {
unsigned data[(kMaxIOCTLSpaceParmsSize - ((4*sizeof(int)) + (2*sizeof(unsigned))))/sizeof(unsigned)]; unsigned data[(kMaxIOCTLSpaceParmsSize - ((4*sizeof(int)) + (2*sizeof(unsigned))))/sizeof(unsigned)];
} SM_CHANNEL_IX_DUMP_PARMS; } SM_CHANNEL_IX_DUMP_PARMS;
%} %}

View file

@ -1,5 +1,10 @@
// bool typemaps check // bool typemaps check
%module bools %module bools
#if defined(SWIGSCILAB)
%rename(BoolSt) BoolStructure;
#endif
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK); /* memory leak when setting a ptr/ref variable */ %warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK); /* memory leak when setting a ptr/ref variable */
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) constbool; /* Ruby, wrong class name */ %warnfilter(SWIGWARN_RUBY_WRONG_NAME) constbool; /* Ruby, wrong class name */

View file

@ -4,6 +4,11 @@ This testcase primarily test constant pointers, eg int* const. Only a getter is
%module constant_pointers %module constant_pointers
#if defined(SWIGSCILAB)
%rename(MbrVar) MemberVariablesTest;
%rename(RetVal) ReturnValuesTest;
#endif
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK); /* memory leak when setting a ptr/ref variable */ %warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK); /* memory leak when setting a ptr/ref variable */
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG); /* Setting a pointer/reference variable may leak memory. */ %warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG); /* Setting a pointer/reference variable may leak memory. */

View file

@ -1,5 +1,9 @@
%module enum_missing %module enum_missing
#if defined(SWIGSCILAB)
%rename(AvCodecCtx) AVCodecContext;
#endif
// Test when SWIG does not parse the enum definition // Test when SWIG does not parse the enum definition
%{ %{
enum AVPixelFormat { enum AVPixelFormat {

View file

@ -1,5 +1,11 @@
%module li_stdint %module li_stdint
#if defined(SWIGSCILAB)
%rename(StdI) StdInts;
%rename(StdIf) StdIntFasts;
%rename(StdIl) StdIntLeasts;
#endif
%include <stdint.i> %include <stdint.i>
%inline %{ %inline %{

View file

@ -3,6 +3,7 @@
#if defined(SWIGSCILAB) #if defined(SWIGSCILAB)
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) ovr_val; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) ovr_val;
%rename(TestDir) TestDirector;
#endif #endif
%{ %{

View file

@ -1,42 +1,41 @@
exec("swigtest.start", -1); exec("swigtest.start", -1);
smallnum = int8(-127); smallnum = -127;
if CharValFunction(smallnum) <> smallnum then swigtesterror(); end checkequal(CharValFunction(smallnum), smallnum, "CharValFunction(smallnum)");
if CCharValFunction(smallnum) <> smallnum then swigtesterror(); end checkequal(CCharValFunction(smallnum), smallnum, "CCharValFunction(smallnum)");
if CCharRefFunction(smallnum) <> smallnum then swigtesterror(); end checkequal(CCharRefFunction(smallnum), smallnum, "CCharRefFunction(smallnum)");
try try
globalchar_set(smallnum); globalchar_set(smallnum);
catch catch
swigtesterror(); swigtesterror();
end end
if globalchar_get() <> smallnum then swigtesterror(); end checkequal(globalchar_get(), smallnum, "globalchar_get()");
checkequal(globalconstchar_get(), -110, "globalconstchar_get()");
if globalconstchar_get() <> -110 then swigtesterror(); end
try try
directorTest = new_DirectorTest(); dirTest = new_DirTest();
catch catch
swigtesterror(); swigtesterror();
end end
if DirectorTest_CharValFunction(directorTest, smallnum) <> smallnum then swigtesterror(); end checkequal(DirTest_CharValFunction(dirTest, smallnum), smallnum, "DirTest_CharValFunction(dirTest, smallnum)");
if DirectorTest_CCharValFunction(directorTest, smallnum) <> smallnum then swigtesterror(); end checkequal(DirTest_CCharValFunction(dirTest, smallnum), smallnum, "DirTest_CCharValFunction(dirTest, smallnum)");
if DirectorTest_CCharRefFunction(directorTest, smallnum) <> smallnum then swigtesterror(); end checkequal(DirTest_CCharRefFunction(dirTest, smallnum), smallnum, "DirTest_CCharRefFunction(dirTest, smallnum)");
// TODO Too long identifiers // TODO Too long identifiers
//if DirectorTest_memberchar_get(directorTest) <> -111 then swigtesterror(); end //if dirTest_memberchar_get(dirTest) <> -111 then swigtesterror(); end
//try //try
// DirectorTest_memberchar_set(directorTest, smallnum) // dirTest_memberchar_set(dirTest, smallnum)
//catch //catch
// swigtesterror(); // swigtesterror();
//end //end
//if DirectorTest_memberchar_get(directorTest) <> smallnum then swigtesterror(); end //if dirTest_memberchar_get(dirTest) <> smallnum then swigtesterror(); end
//if DirectorTest_memberconstchar_get(directorTest) <> -112 then swigtesterror(); end //if dirTest_memberconstchar_get(dirTest) <> -112 then swigtesterror(); end
try try
delete_DirectorTest(directorTest); delete_DirTest(dirTest);
catch catch
swigtesterror(); swigtesterror();
end end

View file

@ -2,15 +2,15 @@ exec("swigtest.start", -1);
testString = "Scilab test string"; testString = "Scilab test string";
if UCharFunction(testString) <> testString then swigtesterror(); end checkequal(UCharFunction(testString), testString, "UCharFunction(testString)");
if SCharFunction(testString) <> testString then swigtesterror(); end checkequal(SCharFunction(testString), testString, "SCharFunction(testString)");
if CUCharFunction(testString) <> testString then swigtesterror(); end checkequal(CUCharFunction(testString), testString, "CUCharFunction(testString)");
if CSCharFunction(testString) <> testString then swigtesterror(); end checkequal(CSCharFunction(testString), testString, "CSCharFunction(testString)");
//if CharFunction(testString) <> testString then swigtesterror(); end //checkequal(CharFunction(testString), testString, "CharFunction(testString)");
//if CCharFunction(testString) <> testString then swigtesterror(); end //checkequal(CCharFunction(testString), testString, "CCharFunction(testString)");
try try
tNumber = new_TNumber() tNum = new_TNum();
catch catch
swigtesterror(); swigtesterror();
end end
@ -19,25 +19,25 @@ end
//TNumber_DigitsMemberB_get() //TNumber_DigitsMemberB_get()
//TNumber_DigitsMemberB_set //TNumber_DigitsMemberB_set
try try
delete_TNumber(tNumber) delete_TNum(tNum);
catch catch
swigtesterror(); swigtesterror();
end end
try try
directorTest = new_DirectorTest(); dirTest = new_DirTest();
catch catch
swigtesterror(); swigtesterror();
end end
if DirectorTest_UCharFunction(directorTest, testString) <> testString then swigtesterror(); end checkequal(DirTest_UCharFunction(dirTest, testString), testString, "DirTest_UCharFunction");
if DirectorTest_SCharFunction(directorTest, testString) <> testString then swigtesterror(); end checkequal(DirTest_SCharFunction(dirTest, testString), testString, "DirTest_SCharFunction(dirTest, testString)");
if DirectorTest_CUCharFunction(directorTest, testString) <> testString then swigtesterror(); end checkequal(DirTest_CUCharFunction(dirTest, testString), testString, "DirTest_CUCharFunction(dirTest, testString)");
if DirectorTest_CSCharFunction(directorTest, testString) <> testString then swigtesterror(); end checkequal(DirTest_CSCharFunction(dirTest, testString), testString, "DirTest_CSharFunction(dirTest, testString)");
//if DirectorTest_CharFunction(directorTest, testString) <> testString then swigtesterror(); end //checkequal(DirTest_CharFunction(dirTest, testString), testString, "DirTest_CharFunction(dirTest, testString)");
//if DirectorTest_CCharFunction(directorTest, testString) <> testString then swigtesterror(); end //checkequal(DirTest_CCharFunction(dirTest, testString), testString, "DirTest_CCharFunction(dirTest, testString)");
try try
delete_DirectorTest(directorTest); delete_DirTest(dirTest);
catch catch
swigtesterror(); swigtesterror();
end end

View file

@ -13,8 +13,8 @@ checkBool(bool2_get(), %f);
checkBool(bo(%t), %t); checkBool(bo(%t), %t);
checkBool(bo(%f), %f); checkBool(bo(%f), %f);
bs = new_BoolStructure(); bs = new_BoolSt();
checkBool(BoolStructure_m_bool1_get(bs), %t); checkBool(BoolSt_m_bool1_get(bs), %t);
checkBool(BoolStructure_m_bool2_get(bs), %f); checkBool(BoolSt_m_bool2_get(bs), %f);
exec("swigtest.quit", -1); exec("swigtest.quit", -1);

View file

@ -39,7 +39,6 @@ int too_long_function_identifier_name_2() { return 22; };
struct st { struct st {
int m_identifier_name; int m_identifier_name;
int too_long_member_identifier_name; int too_long_member_identifier_name;
int too_long_member_function_name() { return 31; };
}; };
%} %}

View file

@ -4,6 +4,13 @@ This testcase tests whether the sizeof operator on a pointer is working.
%module sizeof_pointer %module sizeof_pointer
#if defined(SWIGSCILAB)
%rename(SizePtrTst) SizeofPointerTest;
#endif
%inline %{ %inline %{
#define NO_PROBLEM sizeof(char) #define NO_PROBLEM sizeof(char)