Add more test case for char const expression in enum
This commit is contained in:
parent
822ff096ef
commit
9e53432aef
2 changed files with 15 additions and 0 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");
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue