Fix scoped enums and add scoped enum example
PR #309 broke scoped enums, which failed to compile because the added:
value == value2
comparison isn't valid for a scoped enum (they aren't implicitly
convertible to the underlying type). This commit fixes it by
explicitly converting the enum value to its underlying type before
doing the comparison.
It also adds a scoped enum example to the constants-and-functions
example that triggers the problem fixed in this commit.
diff --git a/example/example-constants-and-functions.py b/example/example-constants-and-functions.py
index f9292ee..0a5224a 100755
--- a/example/example-constants-and-functions.py
+++ b/example/example-constants-and-functions.py
@@ -6,6 +6,7 @@
from example import test_function
from example import some_constant
from example import EMyEnumeration
+from example import ECMyEnum, test_ecenum
from example import EFirstEntry
from example import ExampleWithEnum
from example import return_bytes
@@ -20,6 +21,8 @@
print(test_function(7))
print(test_function(EMyEnumeration.EFirstEntry))
print(test_function(EMyEnumeration.ESecondEntry))
+test_ecenum(ECMyEnum.Three)
+test_ecenum(ECMyEnum.Two)
print("enum->integer = %i" % int(EMyEnumeration.ESecondEntry))
print("integer->enum = %s" % str(EMyEnumeration(2)))