diff options
author | Cody Piersall <cody.piersall@gmail.com> | 2019-02-02 13:11:37 -0600 |
---|---|---|
committer | Cody Piersall <cody.piersall@gmail.com> | 2019-02-02 13:11:37 -0600 |
commit | b695f1211931bd04e3e0dddca4b8d8426f68de10 (patch) | |
tree | c680b3af03de1db844b4f232bed8fdddf83bb2c3 /testing/cffi0 | |
parent | bd9ae66c6172d9ceb4730ce6d0c275e29f2e3070 (diff) | |
download | cffi-b695f1211931bd04e3e0dddca4b8d8426f68de10.tar.gz |
Add support for more binary ops in enum definitions.
Diffstat (limited to 'testing/cffi0')
-rw-r--r-- | testing/cffi0/test_parsing.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py index 2d75850..fb25ea0 100644 --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -409,7 +409,17 @@ def test_const_pointer_to_pointer(): def test_enum(): ffi = FFI() ffi.cdef(""" - enum Enum { POS = +1, TWO = 2, NIL = 0, NEG = -1, OP = (POS+TWO)-1}; + enum Enum { + POS = +1, + TWO = 2, + NIL = 0, + NEG = -1, + ADDSUB = (POS+TWO)-1, + DIVMULINT = (3 * 3) / 2, + SHIFT = (1 << 3) >> 1, + BINOPS = (0x7 & 0x1) | 0x8, + XOR = 0xf ^ 0xa + }; """) needs_dlopen_none() C = ffi.dlopen(None) @@ -417,7 +427,11 @@ def test_enum(): assert C.TWO == 2 assert C.NIL == 0 assert C.NEG == -1 - assert C.OP == 2 + assert C.ADDSUB == 2 + assert C.DIVMULINT == 4 + assert C.SHIFT == 4 + assert C.BINOPS == 0b1001 + assert C.XOR == 0b0101 def test_stdcall(): ffi = FFI() @@ -466,3 +480,4 @@ def test_error_invalid_syntax_for_cdef(): e = py.test.raises(CDefError, ffi.cdef, 'void foo(void) {}') assert str(e.value) == ('<cdef source string>:1: unexpected <FuncDef>: ' 'this construct is valid C but not valid in cdef()') + |