]> git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/re-export-symbol-dylib/main.c
dyld-360.22.tar.gz
[apple/dyld.git] / unit-tests / test-cases / re-export-symbol-dylib / main.c
1
2 #include <stdio.h> // fprintf(), NULL
3 #include <stdlib.h> // exit(), EXIT_SUCCESS
4 #include <dlfcn.h>
5
6 #include "test.h" // PASS(), FAIL(), XPASS(), XFAIL()
7
8
9
10 extern int foo();
11 extern int bar();
12 extern int baz();
13 extern int frob();
14
15 int (*pfoo)() = &foo;
16 int (*pbar)() = &bar;
17 int (*pbaz)() = &baz;
18 int (*pfrob)() = &frob;
19
20
21 int main()
22 {
23 if ( foo() != 1 )
24 FAIL("re-export-symbol-dylib: foo() returned wrong value");
25 else if ( bar() != 2 )
26 FAIL("re-export-symbol-dylib: bar() returned wrong value");
27 else if ( baz() != 3 )
28 FAIL("re-export-symbol-dylib: baz() returned wrong value");
29 else if ( frob() != 4 )
30 FAIL("re-export-symbol-dylib: frob() returned wrong value");
31
32 else if ( (*pfoo)() != 1 )
33 FAIL("re-export-symbol-dylib: (*pfoo)() returned wrong value");
34 else if ( (*pbar)() != 2 )
35 FAIL("re-export-symbol-dylib: (*pbar)() returned wrong value");
36 else if ( (*pbaz)() != 3 )
37 FAIL("re-export-symbol-dylib: (*pbaz)() returned wrong value");
38 else if ( (*pfrob)() != 4 )
39 FAIL("re-export-symbol-dylib: (*pfrob)() returned wrong value");
40 else
41 PASS("re-export-symbol-dylib");
42 return 0;
43 }
44