6 #include "resolve_table.h"
15 main(int argc, char **argv)
18 /* ====================================================================== *
22 * | | `-- table_1.1.1 *
24 * | |-- table_1.2 ------------------------------ *
25 * | `-- table_1.3 --> | include dir_1.1/table_1.1.1 | *
26 * |-- dir_2 `----------------------------- *
27 * | |-- table_2.1 ------------------ *
28 * | `-- table_2.2 --> | include table_1 | *
29 * |-- table_1 `----------------- *
30 * |-- table_2 ------------------ *
31 * |-- table_3 --> | include table_2 | *
32 * | `----------------- *
33 * | -------------------------- *
34 * |-- table_4 --> | include dir_1/table_1.3 | *
35 * | `------------------------- *
36 * | -------------------------- *
37 * |-- table_5 --> | include dir_2/table_2.2 | *
38 * | `------------------------- *
39 * | ---------------------- *
40 * `-- table_6 --> | dir_1.1/table_1.1.1 | *
41 * `--------------------- *
42 * ====================================================================== */
46 // this test relies on being in the test dir, so that it can test
47 // finding tables by relative path
48 if (chdir(TEST_SRC_DIR)) return 1;
51 setenv ("LOUIS_TABLEPATH", "", 1);
52 ASSERT (lou_getTable ("tables/resolve_table/table_1"));
54 // File name not on LOUIS_TABLEPATH
55 ASSERT (!lou_getTable ("table_1"));
57 // File name on LOUIS_TABLEPATH
58 setenv ("LOUIS_TABLEPATH", "tables/resolve_table", 1);
59 ASSERT (lou_getTable ("table_1"));
61 // First is full path, second is in same directory
62 setenv ("LOUIS_TABLEPATH", "", 1);
63 ASSERT (lou_getTable ("tables/resolve_table/table_1,"
66 // First is full path, second is not in same directory
67 ASSERT (!lou_getTable ("tables/resolve_table/table_1,"
71 ASSERT (lou_getTable ("tables/resolve_table/dir_1/table_1.1,"
72 "tables/resolve_table/dir_2/table_2.1"));
74 // First is full path, second is on LOUIS_TABLEPATH, third is in same
76 setenv ("LOUIS_TABLEPATH", "tables/resolve_table/dir_2", 1);
77 ASSERT (lou_getTable ("tables/resolve_table/dir_1/table_1.1,"
81 // First is full path, second is in subdirectory
82 setenv ("LOUIS_TABLEPATH", "", 1);
83 ASSERT (lou_getTable ("tables/resolve_table/table_1,"
86 // Two file names in different directories, but both on LOUIS_TABLEPATH
87 setenv ("LOUIS_TABLEPATH", "tables/resolve_table/dir_1,"
88 "tables/resolve_table/dir_2", 1);
89 ASSERT (lou_getTable ("table_1.2,"
92 // First is file name on LOUIS_TABLEPATH, second is full path, third is in
93 // same directory as second
94 setenv ("LOUIS_TABLEPATH", "tables/resolve_table", 1);
95 ASSERT (!lou_getTable ("table_1,"
96 "tables/resolve_table/dir_1/table_1.1,"
99 // Full path, include table in same directory
100 setenv ("LOUIS_TABLEPATH", "", 1);
101 ASSERT (lou_getTable ("tables/resolve_table/table_3"));
103 // Full path, include table in subdirectory
104 ASSERT (lou_getTable ("tables/resolve_table/dir_1/table_1.3"));
106 // Full path, include table in subdirectory, from there include table in
108 ASSERT (lou_getTable ("tables/resolve_table/table_4"));
110 // Full path, include table in subdirectory, from there include table in
112 ASSERT (!lou_getTable ("tables/resolve_table/table_5"));
114 // Full path, include table in subdirectory, from there include table on
116 setenv ("LOUIS_TABLEPATH", "tables/resolve_table", 1);
117 ASSERT (lou_getTable ("tables/resolve_table/table_5"));
119 // Full path, include table in subdirectory of LOUIS_TABLEPATH
120 setenv ("LOUIS_TABLEPATH", "tables/resolve_table/dir_1", 1);
121 ASSERT (lou_getTable ("tables/resolve_table/table_6"));