| 120 | /************************************************************************/ |
| 121 | |
| 122 | static void TestThread() |
| 123 | |
| 124 | { |
| 125 | int i, test_count = sizeof(test_list) / sizeof(TestItem); |
| 126 | int repeat_count = num_iterations; |
| 127 | int i_iter; |
| 128 | |
| 129 | /* -------------------------------------------------------------------- */ |
| 130 | /* Initialize coordinate system definitions. */ |
| 131 | /* -------------------------------------------------------------------- */ |
| 132 | PJ **pj_list; |
| 133 | PJ_CONTEXT *ctx = proj_context_create(); |
| 134 | |
| 135 | pj_list = (PJ **)calloc(test_count, sizeof(PJ *)); |
| 136 | |
| 137 | if (!reinit_every_iteration) { |
| 138 | for (i = 0; i < test_count; i++) { |
| 139 | TestItem *test = test_list + i; |
| 140 | |
| 141 | pj_list[i] = proj_create_crs_to_crs(ctx, test->src_def, |
| 142 | test->dst_def, nullptr); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | /* -------------------------------------------------------------------- */ |
| 147 | /* Perform tests - over and over. */ |
| 148 | /* -------------------------------------------------------------------- */ |
| 149 | |
| 150 | for (i_iter = 0; i_iter < repeat_count; i_iter++) { |
| 151 | for (i = 0; i < test_count; i++) { |
| 152 | TestItem *test = test_list + i; |
| 153 | |
| 154 | if (reinit_every_iteration) { |
| 155 | proj_context_use_proj4_init_rules(nullptr, true); |
| 156 | pj_list[i] = proj_create_crs_to_crs(ctx, test->src_def, |
| 157 | test->dst_def, nullptr); |
| 158 | |
| 159 | { |
| 160 | int skipTest = (pj_list[i] == nullptr); |
| 161 | |
| 162 | if (skipTest != test->skip) |
| 163 | fprintf( |
| 164 | stderr, |
| 165 | "Threaded projection initialization does not match " |
| 166 | "unthreaded initialization\n"); |
| 167 | |
| 168 | if (skipTest) { |
| 169 | proj_destroy(pj_list[i]); |
| 170 | continue; |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | if (test->skip) |
| 176 | continue; |
| 177 | |
| 178 | PJ_COORD out = proj_trans(pj_list[i], PJ_FWD, test->src); |
| 179 |
no test coverage detected