fix #15 by re-enabling nim cpp on c file and selectively disabling failing things

This commit is contained in:
Timothee Cour 2018-12-29 14:49:01 -08:00
commit 6cc1e66ee2
2 changed files with 20 additions and 5 deletions

View file

@ -18,7 +18,7 @@ proc execCmd(cmd:string)=
task test, "Test":
execCmd "nim c -r tests/tnimterop_c.nim"
# execCmd "nim cpp -r tests/tnimterop_c.nim"
execCmd "nim cpp -r tests/tnimterop_c.nim"
execCmd "nim cpp -r tests/tnimterop_cpp.nim"
# when defined(windows):
# execCmd "nim c -r tests/tmath.nim"

View file

@ -54,7 +54,11 @@ s.field1 = 5
s2.field1 = 6
s3.field1 = 7
s4.field2[2] = 5
s4.field3[3] = enum1
when defined(cpp):
discard # TODO
else: # TODO: what's `defined(cpp)` for c ?
s4.field3[3] = enum1
s5.tci = test_call_int
s5.tcp = test_call_param
s5.tcp8 = test_call_param8
@ -71,13 +75,24 @@ check test_call_int() == 5
check test_call_param(5).field1 == 5
check test_call_param2(5, s2).field1 == 11
check test_call_param3(5, s).field1 == 10
check test_call_param4(e) == e2
# error: assigning to 'enum ENUM' from incompatible type 'NI' (aka 'long long')
when defined(cpp):
discard # TODO
else:
check test_call_param4(e) == e2
check test_call_param5(5.0).field2 == 5.0
check test_call_param6(u2) == 'c'
u.field1 = 4
check test_call_param7(u) == 4
check test_call_param8(addr i) == 25.0
check i == 25
when defined(cpp):
# TODO
# note: candidate function not viable: no known conversion from 'NI *' (aka 'long long *') to 'int *' for 1st argument
# check test_call_param8(cast[ptr int](addr i)) == 25.0
discard
else:
check test_call_param8(addr i) == 25.0
check i == 25
check e3 == enum7
check e4 == enum11