PageRenderTime 20ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/python/enum/runme.py

#
Python | 31 lines | 19 code | 9 blank | 3 comment | 0 complexity | f2b0bf8220ef313c0effe73a97493d68 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1# file: example.py
 2
 3import example
 4
 5# ----- Object creation -----
 6
 7# Print out the value of some enums
 8print "*** color ***"
 9print "    RED    =", example.RED
10print "    BLUE   =", example.BLUE
11print "    GREEN  =", example.GREEN
12
13print "\n*** Foo::speed ***"
14print "    Foo_IMPULSE   =", example.Foo.IMPULSE
15print "    Foo_WARP      =", example.Foo.WARP
16print "    Foo_LUDICROUS =", example.Foo.LUDICROUS
17
18print "\nTesting use of enums with functions\n"
19
20example.enum_test(example.RED, example.Foo.IMPULSE)
21example.enum_test(example.BLUE,  example.Foo.WARP)
22example.enum_test(example.GREEN, example.Foo.LUDICROUS)
23example.enum_test(1234,5678)
24
25print "\nTesting use of enum with class method"
26f = example.Foo()
27
28f.enum_test(example.Foo.IMPULSE)
29f.enum_test(example.Foo.WARP)
30f.enum_test(example.Foo.LUDICROUS)
31