Updated tests for constants.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8457 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
689a94c1f6
commit
29a4b0aca4
2 changed files with 23 additions and 14 deletions
|
|
@ -3,15 +3,34 @@
|
|||
%predicate predicateMethod();
|
||||
%bang bangMethod();
|
||||
|
||||
|
||||
/* This gets mapped to a constant */
|
||||
%constant bool constant1 = false;
|
||||
|
||||
%immutable TestConstants::constant4;
|
||||
|
||||
|
||||
%inline %{
|
||||
|
||||
/* ============ Test Constants Names ============== */
|
||||
typedef enum {One, Two, Three, Four, Five} finger;
|
||||
const char BeginString_FIX44a[8] = "FIX.a.a";
|
||||
|
||||
class TestConstants {
|
||||
public:
|
||||
/* This gets mapped to a constant */
|
||||
static const int constant2 = 1;
|
||||
const char *constant3;
|
||||
const char *constant4;
|
||||
};
|
||||
|
||||
const TestConstants * constant4[5];
|
||||
const int constant5[2] = {10, 20};
|
||||
|
||||
|
||||
/* ============ Test Method Names ============== */
|
||||
class my_class {
|
||||
public:
|
||||
static const int const1 = 1;
|
||||
|
||||
my_class() {}
|
||||
|
||||
int methodOne()
|
||||
{
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -9,11 +9,6 @@ if not Naming::MyClass
|
|||
raise RuntimeError, 'Invalid class name for MyClass'
|
||||
end
|
||||
|
||||
# Check constant names
|
||||
if not Naming::MyClass::CONST1
|
||||
raise RuntimeError, 'Invalid constant name for CONST1'
|
||||
end
|
||||
|
||||
|
||||
# Check method names
|
||||
if not Naming::MyClass.instance_methods.include?('method_one')
|
||||
|
|
@ -42,11 +37,6 @@ if not Naming::MyClass.instance_methods.include?('bang_method!')
|
|||
raise RuntimeError, 'Invalid method name for bang_method!'
|
||||
end
|
||||
|
||||
# Run all these methods as a sanity check
|
||||
if Naming::MyClass::CONST1 != 1
|
||||
raise RuntimeError, "Incorrect value for CONST1"
|
||||
end
|
||||
|
||||
my_class = Naming::MyClass.new()
|
||||
|
||||
if my_class.method_one != 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue