Commit b90ad73ac90a5b0ee99e7284cef76cef40c18996
1 parent
e48c2966
start implementing 2D skymap tests
Showing
1 changed file
with
54 additions
and
4 deletions
test/test_GSky.cpp
| ... | ... | @@ -10,6 +10,11 @@ |
| 10 | 10 | * (at your option) any later version. * |
| 11 | 11 | * * |
| 12 | 12 | ***************************************************************************/ |
| 13 | +/** | |
| 14 | + * @file test_GSky.cpp | |
| 15 | + * @brief Testing of sky module. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 13 | 18 | |
| 14 | 19 | /* __ Includes ___________________________________________________________ */ |
| 15 | 20 | #include <stdlib.h> |
| ... | ... | @@ -34,7 +39,7 @@ void test_GSkymap_healpix_construct(void) |
| 34 | 39 | } |
| 35 | 40 | catch (std::exception &e) { |
| 36 | 41 | std::cout << std::endl |
| 37 | - << "TEST ERROR: Unable to construct empty Healpix map." | |
| 42 | + << "TEST ERROR: Unable to construct empty map." | |
| 38 | 43 | << std::endl; |
| 39 | 44 | std::cout << e.what() << std::endl; |
| 40 | 45 | throw; |
| ... | ... | @@ -201,7 +206,7 @@ void test_GSkymap_healpix_io(void) |
| 201 | 206 | |
| 202 | 207 | // Define Healpix map for comparison |
| 203 | 208 | GSkymap refmap("HPX", "GAL", 4, "RING", 1); |
| 204 | - | |
| 209 | + | |
| 205 | 210 | // Test Healpix map saving |
| 206 | 211 | try { |
| 207 | 212 | for (int pix = 0; pix < refmap.npix(); ++pix) |
| ... | ... | @@ -259,13 +264,57 @@ void test_GSkymap_healpix_io(void) |
| 259 | 264 | } |
| 260 | 265 | catch (std::exception &e) { |
| 261 | 266 | std::cout << std::endl |
| 262 | - << "TEST ERROR: Unable to instatiate Healpix map from FITS file." | |
| 267 | + << "TEST ERROR: Unable to create Healpix instance from FITS file." | |
| 268 | + << std::endl; | |
| 269 | + std::cout << e.what() << std::endl; | |
| 270 | + throw; | |
| 271 | + } | |
| 272 | + std::cout << "."; | |
| 273 | + | |
| 274 | + // Signal final test success | |
| 275 | + std::cout << " ok." << std::endl; | |
| 276 | + | |
| 277 | + // Exit test | |
| 278 | + return; | |
| 279 | + | |
| 280 | +} | |
| 281 | + | |
| 282 | + | |
| 283 | +/*************************************************************************** | |
| 284 | + * Test: GSkymap_map_construct * | |
| 285 | + ***************************************************************************/ | |
| 286 | +void test_GSkymap_map_construct(void) | |
| 287 | +{ | |
| 288 | + // Dump header | |
| 289 | + std::cout << "Test non Healpix GSkymap constructors: "; | |
| 290 | + | |
| 291 | + // Test void constructor | |
| 292 | + try { | |
| 293 | + GSkymap map; | |
| 294 | + } | |
| 295 | + catch (std::exception &e) { | |
| 296 | + std::cout << std::endl | |
| 297 | + << "TEST ERROR: Unable to construct empty map." | |
| 263 | 298 | << std::endl; |
| 264 | 299 | std::cout << e.what() << std::endl; |
| 265 | 300 | throw; |
| 266 | 301 | } |
| 267 | 302 | std::cout << "."; |
| 268 | - | |
| 303 | + | |
| 304 | + // Test correct Healpix constructors | |
| 305 | + try { | |
| 306 | + GSkymap map1("CAR", "GAL", 0.0, 0.0, 1.0, 1.0, 100, 100); | |
| 307 | +std::cout << map1 << std::endl; | |
| 308 | + } | |
| 309 | + catch (std::exception &e) { | |
| 310 | + std::cout << std::endl | |
| 311 | + << "TEST ERROR: Unable to construct sky map(s)." | |
| 312 | + << std::endl; | |
| 313 | + std::cout << e.what() << std::endl; | |
| 314 | + throw; | |
| 315 | + } | |
| 316 | + std::cout << "."; | |
| 317 | + | |
| 269 | 318 | // Signal final test success |
| 270 | 319 | std::cout << " ok." << std::endl; |
| 271 | 320 | |
| ... | ... | @@ -289,6 +338,7 @@ int main(void) |
| 289 | 338 | // Execute Healpix tests |
| 290 | 339 | test_GSkymap_healpix_construct(); |
| 291 | 340 | test_GSkymap_healpix_io(); |
| 341 | + test_GSkymap_map_construct(); | |
| 292 | 342 | |
| 293 | 343 | // Return |
| 294 | 344 | return 0; | ... | ... |