2 printf("failed: " .. msg);
10 int ffi_test_int1(unsigned char a, char b, unsigned short c, short d);
11 long long ffi_test_int2(unsigned int a, int b, unsigned long c, long d,
12 unsigned long long e, long long f, long long g);
13 void *ffi_test_pointer1(char *a);
14 long long ffi_test_var_arg(int n, ...);
15 unsigned long long ffi_test_sched_clock(void);
19 ret = C.ffi_test_void()
21 failed("ffi_test_void should return nil")
24 ret = C.ffi_test_int1(1111, 1111, 1111, 1111)
26 failed("ffi_test_int1(1111, 1111, 1111, 1111) should return 2396")
29 ret = C.ffi_test_int2(90, 7800, 560000, 34000000, 1200000000, 900000000000, 78000000000000)
30 if (ret != 78901234567890) {
31 failed("ffi_test_int2 should return 78901234567890")
34 ret = C.ffi_test_pointer1("")
36 failed("ffi_test_pointer1 shoudl return address around 0xffff8800--------")
39 ret = C.ffi_test_var_arg(7, 90, 7800, 560000, 34000000, 1200000000, 900000000000, 78000000000000)
40 if (ret != 78901234567890) {
41 failed("ffi_test_var_arg should return 78901234567890")
44 ret = C.ffi_test_sched_clock()
46 failed("ffi_test_clock should not return nil")