diff options
| -rw-r--r-- | nimterop/types.nim | 5 | ||||
| -rw-r--r-- | tests/include/test.h | 10 | ||||
| -rw-r--r-- | tests/tnimterop_c.nim | 6 |
3 files changed, 21 insertions, 0 deletions
diff --git a/nimterop/types.nim b/nimterop/types.nim index d161ddb..5b4ad5f 100644 --- a/nimterop/types.nim +++ b/nimterop/types.nim @@ -70,4 +70,9 @@ template defineEnum*(typ) = proc `xor`*(x: int, y: typ): typ {.borrow.} proc `xor`*(x, y: typ): typ {.borrow.} + proc `/`(x, y: typ): typ = + return (x.float / y.float).int.typ + proc `/`*(x: typ, y: int): typ = `/`(x, y.typ) + proc `/`*(x: int, y: typ): typ = `/`(x.typ, y) + proc `$` *(x: typ): string {.borrow.}
\ No newline at end of file diff --git a/tests/include/test.h b/tests/include/test.h index 91bfd75..cb4dd59 100644 --- a/tests/include/test.h +++ b/tests/include/test.h @@ -156,6 +156,16 @@ typedef struct dstruct2 { void **(*tcv)(int **param1); } DSTRUCT2; +// Issue #131 +enum +{ + TDEFL_LZ_CODE_BUF_SIZE = 64 * 1024, + TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13) / 10, + TDEFL_BOGUS_1 = (1024 * 128) / TDEFL_LZ_CODE_BUF_SIZE, + TDEFL_BOGUS_2 = TDEFL_LZ_CODE_BUF_SIZE / 64, + TDEFL_BOGUS_3 = TDEFL_OUT_BUF_SIZE / TDEFL_BOGUS_1 +}; + #ifdef __cplusplus } #endif diff --git a/tests/tnimterop_c.nim b/tests/tnimterop_c.nim index 9f37141..1c30387 100644 --- a/tests/tnimterop_c.nim +++ b/tests/tnimterop_c.nim @@ -172,3 +172,9 @@ ds.field1 = di ds2.field1 = addr cstr ds2.tcv = test_call10 check ds2.tcv(di) == nil + +# Issue #131 +check TDEFL_OUT_BUF_SIZE == 85196 +check TDEFL_BOGUS_1 == 2 +check TDEFL_BOGUS_2 == 1024 +check TDEFL_BOGUS_3 == (85196 / 2).int |
