aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2020-04-05 19:26:38 -0500
committerGanesh Viswanathan <dev@genotrance.com>2020-04-05 19:26:38 -0500
commit534acf9259a233eb5cf0e59ae754b4c036893f81 (patch)
tree525d5a6ea9a88cbf1091684f2810a925b6cd5ea9 /tests
parentbd1c283eb95178339e0078103256836439953626 (diff)
downloadnimterop-534acf9259a233eb5cf0e59ae754b4c036893f81.tar.gz
nimterop-534acf9259a233eb5cf0e59ae754b4c036893f81.zip
ast2 var of proc type, multiple proc type block
Diffstat (limited to 'tests')
-rw-r--r--tests/include/tast2.h12
-rw-r--r--tests/tast2.nim19
-rw-r--r--tests/tpcre.nim8
-rw-r--r--tests/tsoloud.nim4
4 files changed, 34 insertions, 9 deletions
diff --git a/tests/include/tast2.h b/tests/include/tast2.h
index 84a4604..3f46849 100644
--- a/tests/include/tast2.h
+++ b/tests/include/tast2.h
@@ -32,7 +32,10 @@ typedef char *A10[3][6];
typedef char *(*A11)[3];
typedef struct A0 *A111[12];
-typedef int **(*A12)(int, int b, int *c, int *, int *count[4], int (*func)(int, int));
+typedef int
+ **(*A12)(int, int b, int *c, int *, int *count[4], int (*func)(int, int)),
+ **(*A121)(float, float b, float *c, float *, float *count[4], float (*func)(float, float)),
+ **(*A122)(char, char b, char *c, char *, char *count[4], char (*func)(char, char));
typedef int A13(int, int, void (*func)(void));
struct A14 { volatile char a1; };
@@ -104,8 +107,11 @@ typedef enum VSPresetFormat {
//struct A2 test_proc1(struct A0 a);
-
-
+// Proc vars
+void
+ *(*pcre_malloc)(size_t),
+ (*pcre_free)(void *),
+ *(*pcre_stack_malloc)(size_t);
diff --git a/tests/tast2.nim b/tests/tast2.nim
index d98907f..28ea7c5 100644
--- a/tests/tast2.nim
+++ b/tests/tast2.nim
@@ -189,6 +189,14 @@ assert A12 is proc(a1: cint, b: cint, c: ptr cint, a4: ptr cint, count: array[4,
checkPragmas(A12, pHeaderImp & "cdecl")
var a12: A12
+assert A121 is proc(a1: cfloat, b: cfloat, c: ptr cfloat, a4: ptr cfloat, count: array[4, ptr cfloat], `func`: proc(a1: cfloat, a2: cfloat): cfloat {.cdecl.}): ptr ptr cint {.cdecl.}
+checkPragmas(A121, pHeaderImp & "cdecl")
+var a121: A121
+
+assert A122 is proc(a1: cchar, b: cchar, c: cstring, a4: cstring, count: array[4, cstring], `func`: proc(a1: cchar, a2: cchar): cchar {.cdecl.}): ptr ptr cint {.cdecl.}
+checkPragmas(A122, pHeaderImp & "cdecl")
+var a122: A122
+
assert A13 is proc(a1: cint, a2: cint, `func`: proc() {.cdecl.}): cint {.cdecl.}
checkPragmas(A13, pHeaderImp & "cdecl")
var a13: A13
@@ -291,4 +299,13 @@ assert cmGray == 1000000
assert pfGray16 == 1000011
assert pfYUV422P8 == pfYUV420P8 + 1
assert pfRGB27 == cmRGB.VSPresetFormat + 11
-assert pfCompatYUY2 == pfCompatBGR32 + 1 \ No newline at end of file
+assert pfCompatYUY2 == pfCompatBGR32 + 1
+
+assert pcre_malloc is proc(a1: uint): pointer {.cdecl.}
+checkPragmas(pcre_malloc, @["importc", "cdecl"] & pHeader)
+
+assert pcre_free is proc(a1: pointer) {.cdecl.}
+checkPragmas(pcre_free, @["importc", "cdecl"] & pHeader)
+
+assert pcre_stack_malloc is proc(a1: uint): pointer {.cdecl.}
+checkPragmas(pcre_stack_malloc, @["importc", "cdecl"] & pHeader) \ No newline at end of file
diff --git a/tests/tpcre.nim b/tests/tpcre.nim
index 21f3388..f896e9c 100644
--- a/tests/tpcre.nim
+++ b/tests/tpcre.nim
@@ -35,7 +35,9 @@ cImport(pcreH, dynlib="dynpcre", flags = FLAGS)
echo version()
-proc my_malloc(a1: uint) {.cdecl.} =
- discard
+when FLAGS.len != 0:
+ # Legacy algorithm is broken - does not convert void * return to pointer
+ proc my_malloc(a1: uint): pointer {.cdecl.} =
+ discard
-malloc = my_malloc
+ malloc = my_malloc
diff --git a/tests/tsoloud.nim b/tests/tsoloud.nim
index 90cf82d..9823531 100644
--- a/tests/tsoloud.nim
+++ b/tests/tsoloud.nim
@@ -1,4 +1,4 @@
-import os, nimterop/[cimport, build, paths]
+import os, nimterop/[cimport, build]
const
baseDir = getProjectCacheDir("nimterop" / "tests" / "soloud")
@@ -6,7 +6,7 @@ const
src = baseDir/"src"
static:
- gitPull("https://github.com/jarikomppa/soloud", baseDir, "include/*\nsrc/*\n")
+ gitPull("https://github.com/jarikomppa/soloud", baseDir, "include/*\nsrc/*\n", checkout = "RELEASE_20200207")
cDebug()
cDisableCaching()