Commit 06869a15c24a6d134e31c8284a883c4950888fd7

Authored by Maria Krause
1 parent d9655f9d

test check test_GSky

Showing 1 changed file with 35 additions and 35 deletions
test/test_GSky.cpp
... ... @@ -964,18 +964,18 @@ void TestGSky::test_GSkyRegions_io(void)
964 964 const std::string filename_ring = "data/test_ring_region.reg";
965 965 // Allocate regions
966 966 GSkyRegions regions;
967   -// GSkyRegions regions_ring;
  967 + GSkyRegions regions_ring;
968 968  
969 969 // Test regions loading
970   -// test_try("Test regions loading");
971   -// try {
972   -// regions.load(filename);
973   -// regions_ring.load(filename_ring);
974   -// test_try_success();
975   -// }
976   -// catch (std::exception &e) {
977   -// test_try_failure(e);
978   -// }
  970 + test_try("Test regions loading");
  971 + try {
  972 + regions.load(filename);
  973 + regions_ring.load(filename_ring);
  974 + test_try_success();
  975 + }
  976 + catch (std::exception &e) {
  977 + test_try_failure(e);
  978 + }
979 979  
980 980 // Check if region was loaded correctly
981 981 GSkyRegionCircle* circle = dynamic_cast<GSkyRegionCircle*>(regions[0]);
... ... @@ -984,12 +984,12 @@ void TestGSky::test_GSkyRegions_io(void)
984 984 test_value(circle->ra(), 0.1, 1.0e-10);
985 985 test_value(circle->dec(), -35.6, 1.0e-10);
986 986  
987   -// GSkyRegionRing* Ring = dynamic_cast<GSkyRegionRing*>(regions_ring[0]);
988   -// test_assert(Ring->type() == "Ring", "Region is not a Ring");
989   -// test_value(Ring->radius1(), 10.0, 1.0e-10);
990   -// test_value(Ring->radius2(), 20.0, 1.0e-10);
991   -// test_value(Ring->ra(), 0.1, 1.0e-10);
992   -// test_value(Ring->dec(), -35.6, 1.0e-10);
  987 + GSkyRegionRing* Ring = dynamic_cast<GSkyRegionRing*>(regions_ring[0]);
  988 + test_assert(Ring->type() == "Ring", "Region is not a Ring");
  989 + test_value(Ring->radius1(), 10.0, 1.0e-10);
  990 + test_value(Ring->radius2(), 20.0, 1.0e-10);
  991 + test_value(Ring->ra(), 0.1, 1.0e-10);
  992 + test_value(Ring->dec(), -35.6, 1.0e-10);
993 993  
994 994 // Test regions saving
995 995 test_try("Test regions saving");
... ... @@ -1002,16 +1002,16 @@ void TestGSky::test_GSkyRegions_io(void)
1002 1002 test_try_failure(e);
1003 1003 }
1004 1004  
1005   -// // Test regions reloading
1006   -// test_try("Test regions reloading");
1007   -// try {
1008   -// regions.load("region.reg");
1009   -// regions_ring.load("region_ring.reg");
1010   -// test_try_success();
1011   -// }
1012   -// catch (std::exception &e) {
1013   -// test_try_failure(e);
1014   -// }
  1005 + // Test regions reloading
  1006 + test_try("Test regions reloading");
  1007 + try {
  1008 + regions.load("region.reg");
  1009 + regions_ring.load("region_ring.reg");
  1010 + test_try_success();
  1011 + }
  1012 + catch (std::exception &e) {
  1013 + test_try_failure(e);
  1014 + }
1015 1015  
1016 1016 // Check if region was loaded correctly
1017 1017 circle = dynamic_cast<GSkyRegionCircle*>(regions[0]);
... ... @@ -1020,12 +1020,12 @@ void TestGSky::test_GSkyRegions_io(void)
1020 1020 test_value(circle->ra(), 0.1, 1.0e-10);
1021 1021 test_value(circle->dec(), -35.6, 1.0e-10);
1022 1022  
1023   -// Ring = dynamic_cast<GSkyRegionRing*>(regions_ring[0]);
1024   -// test_assert(Ring->type() == "Ring", "Region is not a Ring");
1025   -// test_value(Ring->radius1(), 10.0, 1.0e-10);
1026   -// test_value(Ring->radius2(), 20.0, 1.0e-10);
1027   -// test_value(Ring->ra(), 0.1, 1.0e-10);
1028   -// test_value(Ring->dec(), -35.6, 1.0e-10);
  1023 + Ring = dynamic_cast<GSkyRegionRing*>(regions_ring[0]);
  1024 + test_assert(Ring->type() == "Ring", "Region is not a Ring");
  1025 + test_value(Ring->radius1(), 10.0, 1.0e-10);
  1026 + test_value(Ring->radius2(), 20.0, 1.0e-10);
  1027 + test_value(Ring->ra(), 0.1, 1.0e-10);
  1028 + test_value(Ring->dec(), -35.6, 1.0e-10);
1029 1029  
1030 1030 // Exit test
1031 1031 return;
... ... @@ -1116,7 +1116,7 @@ void TestGSky::test_GSkyRegionRing_construct(void)
1116 1116  
1117 1117 // Check solid angle assignment
1118 1118 double solidangle_check = refregion.solidangle();
1119   - double solidangle = 2*gammalib::pi*(1- std::cos(refradius1 /180 * gammalib::pi)) - 2*gammalib::pi*(1- std::cos(refradius2 /180 * gammalib::pi));
  1119 + double solidangle = 2*gammalib::pi*(1- std::cos(refradius2 /180 * gammalib::pi)) - 2*gammalib::pi*(1- std::cos(refradius1 /180 * gammalib::pi));
1120 1120 test_value(solidangle_check,solidangle,1.0e-10, "Test solid angle assignment");
1121 1121  
1122 1122 //exit test
... ... @@ -1175,9 +1175,9 @@ void TestGSky::test_GSkyRegionRing_logic(void)
1175 1175 test_assert(!refregion.contains(refdir_outside_refregion), "test2 for containment");
1176 1176  
1177 1177 // Test contain regions
1178   - test_assert(refregion.contains(refregion_smaller),"test for containment region");
  1178 + test_assert(!refregion.contains(refregion_smaller),"test for containment region");
1179 1179 test_assert(!refregion.contains(refregion_larger), "test for containment region2 ");
1180   - test_assert(refregion.contains(refregion), "test3 for containment region");
  1180 + test_assert(!refregion.contains(refregion), "test3 for containment region");
1181 1181  
1182 1182 test_assert(!refregion.contains(refdir_rapole), "rapole for containment region");
1183 1183 test_assert(!refregion_decpole.contains(refdir_ndecpole), "rapole for containment region");
... ...