Java/C# - test extra constructor to handle enum items initialised by another enum item for %javaconst(1)/%csconst(1)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7868 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
675ceb3327
commit
7ff35f487a
8 changed files with 79 additions and 0 deletions
|
|
@ -358,6 +358,14 @@ public class runme {
|
|||
i.MemberInstance = Instances.memberinstance3;
|
||||
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
|
||||
}
|
||||
{
|
||||
if ((int)enum_thorough.repeatTest(repeat.one) != 1) throw new Exception("repeatTest 1 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.initial) != 1) throw new Exception("repeatTest 2 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.two) != 2) throw new Exception("repeatTest 3 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.three) != 3) throw new Exception("repeatTest 4 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.last) != 3) throw new Exception("repeatTest 5 failed");
|
||||
if ((int)enum_thorough.repeatTest(repeat.end) != 3) throw new Exception("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -358,6 +358,14 @@ public class runme {
|
|||
i.MemberInstance = Instances.memberinstance3;
|
||||
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.one) != 1) throw new Exception("repeatTest 1 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.initial) != 1) throw new Exception("repeatTest 2 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.two) != 2) throw new Exception("repeatTest 3 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.three) != 3) throw new Exception("repeatTest 4 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.last) != 3) throw new Exception("repeatTest 5 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simple.end) != 3) throw new Exception("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -358,6 +358,14 @@ public class runme {
|
|||
i.MemberInstance = Instances.memberinstance3;
|
||||
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.one).swigValue != 1) throw new Exception("repeatTest 1 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.initial).swigValue != 1) throw new Exception("repeatTest 2 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.two).swigValue != 2) throw new Exception("repeatTest 3 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.three).swigValue != 3) throw new Exception("repeatTest 4 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.last).swigValue != 3) throw new Exception("repeatTest 5 failed");
|
||||
if (enum_thorough_typesafe.repeatTest(repeat.end).swigValue != 3) throw new Exception("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -474,4 +474,27 @@ struct Instances {
|
|||
|
||||
%}
|
||||
|
||||
// Repeated values
|
||||
#if defined(SWIGJAVA)
|
||||
%javaconst(1);
|
||||
#elif defined(SWIGCSHARP)
|
||||
%csconst(1);
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
namespace RepeatSpace {
|
||||
typedef enum
|
||||
{
|
||||
one = 1,
|
||||
initial = one,
|
||||
two,
|
||||
three,
|
||||
last = three,
|
||||
end = last
|
||||
} repeat;
|
||||
repeat repeatTest(repeat e) { return e; }
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -369,6 +369,14 @@ public class enum_thorough_proper_runme {
|
|||
i.setMemberInstance(Instances.memberinstance3);
|
||||
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_proper.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.last).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,6 +369,14 @@ public class enum_thorough_runme {
|
|||
i.setMemberInstance(Instances.memberinstance3);
|
||||
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
|
||||
if (enum_thorough.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
|
||||
if (enum_thorough.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
|
||||
if (enum_thorough.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
|
||||
if (enum_thorough.repeatTest(repeat.last).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,6 +369,14 @@ public class enum_thorough_simple_runme {
|
|||
i.setMemberInstance(Instances.memberinstance3);
|
||||
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.one) != 1) throw new RuntimeException("repeatTest 1 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.two) != 2) throw new RuntimeException("repeatTest 3 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.three) != 3) throw new RuntimeException("repeatTest 4 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.last) != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.end) != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,6 +369,14 @@ public class enum_thorough_typeunsafe_runme {
|
|||
i.setMemberInstance(Instances.memberinstance3);
|
||||
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
|
||||
}
|
||||
{
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.one) != 1) throw new RuntimeException("repeatTest 1 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.two) != 2) throw new RuntimeException("repeatTest 3 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.three) != 3) throw new RuntimeException("repeatTest 4 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.last) != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.end) != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue