aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-06-15 14:47:02 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-06-15 15:13:55 -0300
commitc2683738a2c42447a03f0a6f369e89447374ab54 (patch)
treed9dda084f8af1d90c60f98d77b77719bdf5cdc2a /tests
parent34c5a73107e90e874e3f392a7effb4c598882190 (diff)
Added test function with an integer argument that have an enum as default value.
Diffstat (limited to 'tests')
-rw-r--r--tests/libsample/samplenamespace.cpp6
-rw-r--r--tests/libsample/samplenamespace.h2
-rwxr-xr-xtests/samplebinding/enum_test.py6
3 files changed, 14 insertions, 0 deletions
diff --git a/tests/libsample/samplenamespace.cpp b/tests/libsample/samplenamespace.cpp
index 86bd3404..7ad20083 100644
--- a/tests/libsample/samplenamespace.cpp
+++ b/tests/libsample/samplenamespace.cpp
@@ -87,5 +87,11 @@ doSomethingWithArray(const unsigned char* data, unsigned int size, const char* f
// to check compilation issues, i.e. if it compiles, it's ok.
}
+int
+enumItemAsDefaultValueToIntArgument(int value)
+{
+ return value;
+}
+
} // namespace SampleNamespace
diff --git a/tests/libsample/samplenamespace.h b/tests/libsample/samplenamespace.h
index b050bd55..7109a6c4 100644
--- a/tests/libsample/samplenamespace.h
+++ b/tests/libsample/samplenamespace.h
@@ -68,6 +68,8 @@ LIBSAMPLE_API inline double powerOfTwo(double num) {
LIBSAMPLE_API void doSomethingWithArray(const unsigned char* data, unsigned int size, const char* format = 0);
+LIBSAMPLE_API int enumItemAsDefaultValueToIntArgument(int value = ZeroIn);
+
class SomeClass
{
public:
diff --git a/tests/samplebinding/enum_test.py b/tests/samplebinding/enum_test.py
index 0d4be229..65ec1af3 100755
--- a/tests/samplebinding/enum_test.py
+++ b/tests/samplebinding/enum_test.py
@@ -66,6 +66,12 @@ class EnumTest(unittest.TestCase):
'''Calling the constructor of non-extensible enum with a string.'''
self.assertRaises(TypeError, SampleNamespace.InValue, '1')
+ def testEnumItemAsDefaultValueToIntArgument(self):
+ '''Calls function with an enum item as default value to an int argument.'''
+ self.assertEqual(SampleNamespace.enumItemAsDefaultValueToIntArgument(), SampleNamespace.ZeroIn)
+ self.assertEqual(SampleNamespace.enumItemAsDefaultValueToIntArgument(SampleNamespace.ZeroOut), SampleNamespace.ZeroOut)
+ self.assertEqual(SampleNamespace.enumItemAsDefaultValueToIntArgument(123), 123)
+
class EnumOverloadTest(unittest.TestCase):
'''Test case for overloads involving enums'''