fixup
This commit is contained in:
parent
d00aeeafdd
commit
6a4158dab4
5 changed files with 9 additions and 40 deletions
|
|
@ -18,7 +18,7 @@ proc execCmd(cmd:string)=
|
||||||
|
|
||||||
task test, "Test":
|
task test, "Test":
|
||||||
execCmd "nim c -r tests/tnimterop_c.nim"
|
execCmd "nim c -r tests/tnimterop_c.nim"
|
||||||
execCmd "nim c -r tests/tnimterop_cpp.nim"
|
execCmd "nim cpp -r tests/tnimterop_cpp.nim"
|
||||||
|
|
||||||
task installWithDeps, "install dependencies":
|
task installWithDeps, "install dependencies":
|
||||||
for a in ["http://github.com/genotrance/nimtreesitter?subdir=treesitter",
|
for a in ["http://github.com/genotrance/nimtreesitter?subdir=treesitter",
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,4 @@ int test_call_int();
|
||||||
struct STRUCT1 _test_call_int_param_(int param1);
|
struct STRUCT1 _test_call_int_param_(int param1);
|
||||||
STRUCT2 test_call_int_param2(int param1, STRUCT2 param2);
|
STRUCT2 test_call_int_param2(int param1, STRUCT2 param2);
|
||||||
STRUCT2 test_call_int_param3(int param1, struct STRUCT1 param2);
|
STRUCT2 test_call_int_param3(int param1, struct STRUCT1 param2);
|
||||||
ENUM2 test_call_int_param4(enum ENUM param1);
|
ENUM2 test_call_int_param4(enum ENUM param1);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
#include "test2.hpp"
|
#include "test2.hpp"
|
||||||
|
|
||||||
// BUG: should complain
|
|
||||||
// # include test2.h
|
|
||||||
|
|
||||||
int test_call_int() {
|
int test_call_int() {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#define TEST_INT 512
|
#define TEST_INT 512
|
||||||
|
#define TEST_FLOAT 5.12
|
||||||
|
#define TEST_HEX 0x512
|
||||||
|
|
||||||
int test_call_int();
|
int test_call_int();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,44 +6,12 @@ cDebug()
|
||||||
cIncludeDir "$projpath/include"
|
cIncludeDir "$projpath/include"
|
||||||
cAddSearchDir "$projpath/include"
|
cAddSearchDir "$projpath/include"
|
||||||
cCompile cSearchPath "test2.cpp"
|
cCompile cSearchPath "test2.cpp"
|
||||||
# TODO: allow this to have correct language: cImport("test2.h")
|
|
||||||
cImport cSearchPath "test2.hpp"
|
cImport cSearchPath "test2.hpp"
|
||||||
|
|
||||||
check TEST_INT == 512
|
check TEST_INT == 512
|
||||||
|
check TEST_FLOAT == 5.12
|
||||||
|
check TEST_HEX == 0x512
|
||||||
check test_call_int() == 5
|
check test_call_int() == 5
|
||||||
|
|
||||||
var foo: Foo
|
var foo: Foo
|
||||||
check foo.bar == 2
|
check foo.bar == 0
|
||||||
|
|
||||||
# var foo2: Foo2[int]
|
|
||||||
# var foo2: Foo2Int
|
|
||||||
|
|
||||||
when false:
|
|
||||||
doAssert TEST_FLOAT == 5.12
|
|
||||||
doAssert TEST_HEX == 0x512
|
|
||||||
|
|
||||||
var
|
|
||||||
pt: PRIMTYPE
|
|
||||||
ct: CUSTTYPE
|
|
||||||
|
|
||||||
s: STRUCT1
|
|
||||||
s2: STRUCT2
|
|
||||||
s3: STRUCT3
|
|
||||||
|
|
||||||
e: ENUM
|
|
||||||
e2: ENUM2 = enum5
|
|
||||||
|
|
||||||
pt = 3
|
|
||||||
ct = 4
|
|
||||||
|
|
||||||
s.field1 = 5
|
|
||||||
s2.field1 = 6
|
|
||||||
s3.field1 = 7
|
|
||||||
|
|
||||||
e = enum1
|
|
||||||
e2 = enum4
|
|
||||||
|
|
||||||
doAssert test_call_int_param(5).field1 == 5
|
|
||||||
doAssert test_call_int_param2(5, s2).field1 == 11
|
|
||||||
doAssert test_call_int_param3(5, s).field1 == 10
|
|
||||||
doAssert test_call_int_param4(e) == e2
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue