Add runtime tests for char in compound expression patch

This commit is contained in:
Jiulong Wang 2016-09-08 17:59:22 -07:00
commit b5358ffeba
2 changed files with 12 additions and 2 deletions

View file

@ -413,6 +413,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.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.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.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; int global_enum = enum_thorough_typesafe.global_typeint;
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed"); if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
@ -426,6 +428,10 @@ public class runme {
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed"); if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
global_enum = enum_thorough_typesafe.global_typedefaultint; global_enum = enum_thorough_typesafe.global_typedefaultint;
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed"); 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");
} }
} }
} }

View file

@ -577,7 +577,9 @@ enum DifferentTypes {
typebooltrue = true, typebooltrue = true,
typebooltwo, typebooltwo,
typechar = 'C', typechar = 'C',
typedefaultint typedefaultint,
typecharcompound='A'+1,
typecharcompound2='B' << 2
}; };
DifferentTypes differentTypesTest(DifferentTypes n) { return n; } DifferentTypes differentTypesTest(DifferentTypes n) { return n; }
@ -587,7 +589,9 @@ enum {
global_typebooltrue = true, global_typebooltrue = true,
global_typebooltwo, global_typebooltwo,
global_typechar = 'C', global_typechar = 'C',
global_typedefaultint global_typedefaultint,
global_typecharcompound='A'+1,
global_typecharcompound2='B' << 2
}; };
int globalDifferentTypesTest(int n) { return n; } int globalDifferentTypesTest(int n) { return n; }
} }