Merge branch 'jiulongw-master'
* jiulongw-master: Fix go wrapper compilation error Fix missing semicolon in golang wrapper Fix extra quote escape in golang Fix #define error when value contains char in compound expression Add more test case for char const expression in enum Revert "Add enum test cases with const char in compound expression" Add runtime tests for char in compound expression patch Add enum test cases with const char in compound expression Fix enum error when value contains char in compound expression
This commit is contained in:
commit
f89b8836dd
6 changed files with 82 additions and 42 deletions
|
|
@ -405,6 +405,10 @@ public class runme {
|
|||
if (enum_thorough_typesafe.repeatTest(repeat.llast).swigValue != 3) throw new Exception("repeatTest 5 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.end).swigValue != 3) throw new Exception("repeatTest 6 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typesafe.enumWithMacroTest(enumWithMacro.ABCD).swigValue != (('A' << 24) | ('B' << 16) | ('C' << 8) | 'D')) throw new Exception("enumWithMacroTest 1 failed");
|
||||
if (enum_thorough_typesafe.enumWithMacroTest(enumWithMacro.ABCD2).swigValue != enum_thorough_typesafe.enumWithMacroTest(enumWithMacro.ABCD).swigValue) throw new Exception("enumWithMacroTest 2 failed");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typeint).swigValue != 10) throw new Exception("differentTypes 1 failed");
|
||||
|
|
@ -413,6 +417,8 @@ public class runme {
|
|||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typeboolfalse).swigValue != 0) throw new Exception("differentTypes 4 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typechar).swigValue != (int)'C') throw new Exception("differentTypes 5 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typedefaultint).swigValue != (int)'D') throw new Exception("differentTypes 6 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typecharcompound).swigValue != (int)'A' + 1) throw new Exception("differentTypes 7 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typecharcompound2).swigValue != (int)'B' << 2) throw new Exception("differentTypes 8 failed");
|
||||
|
||||
int global_enum = enum_thorough_typesafe.global_typeint;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
|
||||
|
|
@ -426,6 +432,10 @@ public class runme {
|
|||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typedefaultint;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typecharcompound;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != (int)'A' + 1) throw new Exception("global differentTypes 7 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typecharcompound2;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != (int)'B' << 2) throw new Exception("global differentTypes 8 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -569,6 +569,17 @@ repeat repeatTest(repeat e) { return e; }
|
|||
}
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
namespace EnumWithMacro {
|
||||
#define PACK(C1,C2,C3,C4) ((C1<<24)|(C2<<16)|(C3<<8)|C4)
|
||||
typedef enum {
|
||||
ABCD = PACK('A','B','C','D'),
|
||||
ABCD2 = ABCD
|
||||
} enumWithMacro;
|
||||
enumWithMacro enumWithMacroTest(enumWithMacro e) { return e; }
|
||||
}
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
namespace DifferentSpace {
|
||||
enum DifferentTypes {
|
||||
|
|
@ -577,7 +588,9 @@ enum DifferentTypes {
|
|||
typebooltrue = true,
|
||||
typebooltwo,
|
||||
typechar = 'C',
|
||||
typedefaultint
|
||||
typedefaultint,
|
||||
typecharcompound='A'+1,
|
||||
typecharcompound2='B' << 2
|
||||
};
|
||||
DifferentTypes differentTypesTest(DifferentTypes n) { return n; }
|
||||
|
||||
|
|
@ -587,7 +600,9 @@ enum {
|
|||
global_typebooltrue = true,
|
||||
global_typebooltwo,
|
||||
global_typechar = 'C',
|
||||
global_typedefaultint
|
||||
global_typedefaultint,
|
||||
global_typecharcompound='A'+1,
|
||||
global_typecharcompound2='B' << 2
|
||||
};
|
||||
int globalDifferentTypesTest(int n) { return n; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
// Expressions - runtime tests check the type for any necessary type promotions of the expressions
|
||||
|
||||
#define INT_AND_BOOL 0xFF & true
|
||||
//#define INT_AND_CHAR 0xFF & 'A' /* FIXME compile error */
|
||||
#define INT_AND_CHAR 0xFF & 'A'
|
||||
#define INT_AND_INT 0xFF & 2
|
||||
#define INT_AND_UINT 0xFF & 2u
|
||||
#define INT_AND_LONG 0xFF & 2l
|
||||
|
|
@ -60,8 +60,7 @@
|
|||
#define INT_AND_ULLONG 0xFF & 2ull
|
||||
|
||||
#define BOOL_AND_BOOL true & true // Note integral promotion to type int
|
||||
//#define CHAR_AND_CHAR 'A' & 'B' // Note integral promotion to type int
|
||||
/* FIXME ABOVE */
|
||||
#define CHAR_AND_CHAR 'A' & 'B' // Note integral promotion to type int
|
||||
|
||||
|
||||
#define EXPR_MULTIPLY 0xFF * 2
|
||||
|
|
@ -88,6 +87,9 @@
|
|||
#define EXPR_LOR 0xFF || 1
|
||||
#define EXPR_CONDITIONAL true ? 2 : 2.2
|
||||
|
||||
#define EXPR_CHAR_COMPOUND_ADD 'A' + 12
|
||||
#define EXPR_CHAR_COMPOUND_LSHIFT 'B' << 6
|
||||
#define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p')
|
||||
|
||||
/// constant assignment in enum
|
||||
#if defined(SWIGCSHARP)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue