]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dyld_get_sdk_version.dtest/main.c
dyld-519.2.1.tar.gz
[apple/dyld.git] / testing / test-cases / dyld_get_sdk_version.dtest / main.c
1
2 // BUILD: $CC main.c -o $BUILD_DIR/sdk-check.exe
3
4 // RUN: ./sdk-check.exe
5
6 #include <stdio.h>
7 #include <string.h>
8 #include <mach-o/dyld_priv.h>
9
10 extern struct mach_header __dso_handle;
11
12 int main()
13 {
14 printf("[BEGIN] dyld_get_sdk_version\n");
15
16 // should succeed
17 if ( dyld_get_sdk_version(&__dso_handle) == 0 ) {
18 printf("[FAIL] dyld_get_sdk_version: expected SDK\n");
19 return 0;
20 }
21
22 // should fail
23 const char* text = "bad text";
24 if ( dyld_get_sdk_version((struct mach_header*)text) != 0 ) {
25 printf("[FAIL] dyld_get_sdk_version: expected failure\n");
26 return 0;
27 }
28
29 printf("[PASS] dyld_get_sdk_version\n");
30
31 return 0;
32 }
33