1 /*
2 # This file is part of the Astrometry.net suite.
3 # Licensed under a 3-clause BSD style license - see LICENSE
4 */
5 #include <stdlib.h>
6 #include <stdio.h>
7
8 #ifdef TEST_CANONICALIZE_FILE_NAME
main()9 int main() {
10 char* path = canonicalize_file_name("/");
11 free(path);
12 //printf("#define NEED_CANONICALIZE_FILE_NAME 0\n");
13 return 0;
14 }
15 #endif
16
17 #ifdef TEST_QSORT_R
cmp(void * u,const void * a,const void * b)18 static int cmp(void* u, const void* a, const void* b) {
19 return 0;
20 }
main()21 int main() {
22 int array;
23 int baton;
24 qsort_r(&array, 1, sizeof(int), &baton, cmp);
25 //printf("#define NEED_QSORT_R 0\n");
26 return 0;
27 }
28 #endif
29
30 #ifdef TEST_DECLARE_QSORT_R
31 // Test whether just declaring qsort_r as we do causes a compile failure.
32
33 void qsort_r(void *base, size_t nmemb, size_t sz,
34 void *userdata,
35 int (*compar)(void *, const void *, const void *));
36
main()37 int main() {
38 //printf("#define NEED_DECLARE_QSORT_R 1\n");
39 return 0;
40 }
41 #endif
42
43 #ifdef TEST_SWAP_QSORT_R
44 // Use the result of TEST_DECLARE_QSORT_R and TEST_NEED_QSORT_R, or else
45 // this test will fail with a warning about undefined qsort_r
46 // Include .c rather than .h because we test with:
47 // gcc -o (exec) os-features-test.c
48 // and if NEED_QSORT_R, os-features.c includes qsort_reentrant.c
49 #include "os-features-config.h.tmp"
50 #define DONT_INCLUDE_OS_FEATURES_CONFIG_H 1
51 #include "os-features.c"
52 #undef DONT_INCLUDE_OS_FEATURES_CONFIG_H
53 // Test whether qsort_r works unswapped. (ie, qsort_r matches the definition of
54 // QSORT_R defined in the os-features.h documentation.)
sortfunc(void * thunk,const void * v1,const void * v2)55 static int sortfunc(void* thunk, const void* v1, const void* v2) {
56 const int* i1 = v1;
57 const int* i2 = v2;
58 if (*i1 < *i2)
59 return -1;
60 if (*i1 > *i2)
61 return 1;
62 return 0;
63 }
main()64 int main() {
65 int array[] = { 4, 17, 88, 34, 12, 12, 17 };
66 int N = sizeof(array)/sizeof(int);
67 int mythunk = 42;
68 qsort_r(array, N, sizeof(int), &mythunk, sortfunc);
69 //printf("#define NEED_SWAP_QSORT_R 0\n");
70 return 0;
71 }
72 #endif
73
74 #if defined(TEST_NETPBM) || defined(TEST_NETPBM_MAKE)
75 #include <pam.h>
main(int argc,char ** args)76 int main(int argc, char** args) {
77 struct pam img;
78 pm_init(args[0], 0);
79 //printf("#define HAVE_NETPBM 1\n");
80 img.size = 42;
81 printf("the answer is %i\n", img.size);
82 return 0;
83 }
84 #endif
85