| require("enums") | |
| catch_undef_globs() -- catch "undefined" global variables | |
| -- check values | |
| assert(enums.CSP_ITERATION_FWD==0) | |
| assert(enums.CSP_ITERATION_BWD==11) | |
| assert(enums.ABCDE==0) | |
| assert(enums.FGHJI==1) | |
| assert(enums.boo==0) | |
| assert(enums.hoo==5) | |
| assert(enums.globalinstance1==0) | |
| assert(enums.globalinstance2==1) | |
| assert(enums.globalinstance3==30) | |
| assert(enums.AnonEnum1==0) | |
| assert(enums.AnonEnum2==100) | |
| assert(enums.WideCharW==string.byte("w")) | |
| assert(enums.WideCharE==0xE9) | |
| assert(enums.WideCharSmile==0x263A) | |
| -- In C enums from struct are exported into global namespace (without prefixing with struct name) | |
| -- In C++ they are prefixed (as compatibility thing). | |
| -- We are emulating xor :) | |
| assert(enums.BAR1 ~= enums.Foo_BAR1) -- It is either C style, or C++ style, but not both | |
| assert((enums.BAR1 ~= nil ) or (enums.Foo_BAR1 ~= nil)) | |
| assert(enums.Phoo ~= enums.iFoo_Phoo) | |
| assert((enums.Phoo == 50) or (enums.iFoo_Phoo == 50)) | |
| -- no point in checking fns, C will allow any value |