aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2018-12-28 00:33:09 -0600
committerGanesh Viswanathan <dev@genotrance.com>2018-12-28 00:33:09 -0600
commit1e086d59595c24ee8ec3f1dcc02b55d97fe9e2ec (patch)
tree9c84e2a3ef5e4a6976897b5fb4f678570ef17b6e /tests
parente2430cf40c95d33c2987c21c76557d444bca0d27 (diff)
downloadnimterop-1e086d59595c24ee8ec3f1dcc02b55d97fe9e2ec.tar.gz
nimterop-1e086d59595c24ee8ec3f1dcc02b55d97fe9e2ec.zip
Implement PR #17
Diffstat (limited to 'tests')
-rw-r--r--tests/include/test.h12
-rw-r--r--tests/tnimterop_c.nim9
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/include/test.h b/tests/include/test.h
index 6a3d9a4..741fa97 100644
--- a/tests/include/test.h
+++ b/tests/include/test.h
@@ -8,6 +8,18 @@ extern "C" {
#define TEST_FLOAT 5.12
#define TEST_HEX 0x512
+#ifdef __APPLE__
+#define OSDEF 10
+#endif
+
+#ifdef _WIN32
+#define OSDEF 20
+#endif
+
+#ifdef __linux__
+#define OSDEF 30
+#endif
+
typedef uint8_t PRIMTYPE;
typedef PRIMTYPE CUSTTYPE;
diff --git a/tests/tnimterop_c.nim b/tests/tnimterop_c.nim
index 69f8105..74e1afa 100644
--- a/tests/tnimterop_c.nim
+++ b/tests/tnimterop_c.nim
@@ -13,6 +13,13 @@ check TEST_INT == 512
check TEST_FLOAT == 5.12
check TEST_HEX == 0x512
+when defined(osx):
+ check OSDEF == 10
+elif defined(windows):
+ check OSDEF == 20
+else:
+ check OSDEF == 30
+
var
pt: PRIMTYPE
ct: CUSTTYPE
@@ -34,7 +41,7 @@ var
u: UNION1
u2: UNION2
- i: int
+ i: cint
pt = 3
ct = 4