[D] Ported r12557 (char enum values).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12630 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6c0f3f1a7d
commit
f9def91f30
3 changed files with 57 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ module enum_thorough_runme;
|
|||
import enum_thorough.enum_thorough;
|
||||
import enum_thorough.AnonStruct;
|
||||
import enum_thorough.colour;
|
||||
import enum_thorough.DifferentTypes;
|
||||
import enum_thorough.FirStruct;
|
||||
import enum_thorough.HairStruct;
|
||||
import enum_thorough.IgnoreTest;
|
||||
|
|
@ -421,4 +422,26 @@ void main() {
|
|||
if (cast(int)repeatTest(repeat.llast) != 3) throw new Exception("repeatTest 5 failed");
|
||||
if (cast(int)repeatTest(repeat.end) != 3) throw new Exception("repeatTest 6 failed");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (cast(int)differentTypesTest(DifferentTypes.typeint) != 10) throw new Exception("differentTypes 1 failed");
|
||||
if (cast(int)differentTypesTest(DifferentTypes.typeboolfalse) != 0) throw new Exception("differentTypes 2 failed");
|
||||
if (cast(int)differentTypesTest(DifferentTypes.typebooltrue) != 1) throw new Exception("differentTypes 3 failed");
|
||||
if (cast(int)differentTypesTest(DifferentTypes.typebooltwo) != 2) throw new Exception("differentTypes 4 failed");
|
||||
if (cast(int)differentTypesTest(DifferentTypes.typechar) != 'C') throw new Exception("differentTypes 5 failed");
|
||||
if (cast(int)differentTypesTest(DifferentTypes.typedefaultint) != 'D') throw new Exception("differentTypes 6 failed");
|
||||
|
||||
int global_enum = global_typeint;
|
||||
if (cast(int)globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
|
||||
global_enum = global_typeboolfalse;
|
||||
if (cast(int)globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
|
||||
global_enum = global_typebooltrue;
|
||||
if (cast(int)globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
|
||||
global_enum = global_typebooltwo;
|
||||
if (cast(int)globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
|
||||
global_enum = global_typechar;
|
||||
if (cast(int)globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
|
||||
global_enum = global_typedefaultint;
|
||||
if (cast(int)globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import std.exception;
|
|||
import enum_thorough.enum_thorough;
|
||||
import enum_thorough.AnonStruct;
|
||||
import enum_thorough.colour;
|
||||
import enum_thorough.DifferentTypes;
|
||||
import enum_thorough.FirStruct;
|
||||
import enum_thorough.HairStruct;
|
||||
import enum_thorough.IgnoreTest;
|
||||
|
|
@ -422,4 +423,26 @@ void main() {
|
|||
enforce(cast(int)repeatTest(repeat.llast) == 3, "repeatTest 5 failed");
|
||||
enforce(cast(int)repeatTest(repeat.end) == 3, "repeatTest 6 failed");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
enforce(cast(int)differentTypesTest(DifferentTypes.typeint) == 10, "differentTypes 1 failed");
|
||||
enforce(cast(int)differentTypesTest(DifferentTypes.typeboolfalse) == 0, "differentTypes 2 failed");
|
||||
enforce(cast(int)differentTypesTest(DifferentTypes.typebooltrue) == 1, "differentTypes 3 failed");
|
||||
enforce(cast(int)differentTypesTest(DifferentTypes.typebooltwo) == 2, "differentTypes 4 failed");
|
||||
enforce(cast(int)differentTypesTest(DifferentTypes.typechar) == 'C', "differentTypes 5 failed");
|
||||
enforce(cast(int)differentTypesTest(DifferentTypes.typedefaultint) == 'D', "differentTypes 6 failed");
|
||||
|
||||
int global_enum = global_typeint;
|
||||
enforce(cast(int)globalDifferentTypesTest(global_enum) == 10, "global differentTypes 1 failed");
|
||||
global_enum = global_typeboolfalse;
|
||||
enforce(cast(int)globalDifferentTypesTest(global_enum) == 0, "global differentTypes 2 failed");
|
||||
global_enum = global_typebooltrue;
|
||||
enforce(cast(int)globalDifferentTypesTest(global_enum) == 1, "global differentTypes 3 failed");
|
||||
global_enum = global_typebooltwo;
|
||||
enforce(cast(int)globalDifferentTypesTest(global_enum) == 2, "global differentTypes 4 failed");
|
||||
global_enum = global_typechar;
|
||||
enforce(cast(int)globalDifferentTypesTest(global_enum) == 'C', "global differentTypes 5 failed");
|
||||
global_enum = global_typedefaultint;
|
||||
enforce(cast(int)globalDifferentTypesTest(global_enum) == 'D', "global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue