Loading tests/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -4,4 +4,4 @@ cmake_minimum_required(VERSION 3.10) add_executable(runTests TestyMcTestFace.cpp) target_link_libraries(runTests usgscsm ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) gtest_discover_tests(runTests WORKING_DIRECTORY tests) gtest_discover_tests(runTests WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) tests/TestyMcTestFace.cpp +37 −2 Original line number Diff line number Diff line #include "UsgsAstroFramePlugin.h" #include <json/json.hpp> #include <fstream> #include <gtest/gtest.h> using json = nlohmann::json; class FrameIsdTest : public ::testing::Test { protected: csm::Isd isd; virtual void SetUp() { std::ifstream isdFile("data/simpleFramerISD.json"); json jsonIsd = json::parse(isdFile); isd.clearAllParams(); for (json::iterator it = jsonIsd.begin(); it != jsonIsd.end(); ++it) { isd.addParam(it.key(), it.value().dump()); } } }; TEST(FramePluginTests, PluginName) { UsgsAstroFramePlugin testPlugin; EXPECT_EQ("UsgsAstroFramePluginCSM", testPlugin.getPluginName());; Loading @@ -22,10 +43,17 @@ TEST(FramePluginTests, NumModels) { EXPECT_EQ(1, testPlugin.getNumModels());; } TEST(FramePluginTests, NoStateName) { UsgsAstroFramePlugin testPlugin; std::string badState = "{\"not_a_name\":\"bad_name\"}"; EXPECT_FALSE(testPlugin.canModelBeConstructedFromState( "USGS_ASTRO_FRAME_SENSOR_MODEL", badState));; } TEST(FramePluginTests, BadStateName) { UsgsAstroFramePlugin testPlugin; std::string badState = "{" "\"model_name\":\"bad_name\"}"; std::string badState = "{\"model_name\":\"bad_name\"}"; EXPECT_FALSE(testPlugin.canModelBeConstructedFromState( "USGS_ASTRO_FRAME_SENSOR_MODEL", badState));; Loading @@ -50,6 +78,13 @@ TEST(FramePluginTests, MissingStateValue) { badState));; } TEST_F(FrameIsdTest, ConstructFromISD) { UsgsAstroFramePlugin testPlugin; EXPECT_TRUE(testPlugin.canModelBeConstructedFromISD( isd, "USGS_ASTRO_FRAME_SENSOR_MODEL")); } int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); Loading tests/data/simpleFramerISD.json 0 → 100644 +96 −0 Original line number Diff line number Diff line { "boresight": [ 0.0, 0.0, 1.0 ], "ccd_center": [ 7.5, 7.5 ], "ephemeris_time": 100.0, "focal_length": 500, "focal_length_epsilon": 1.0, "ifov": 6.0, "model_name": "UsgsAstroFramePluginCSM", "spacecraft_name": "TEST_CRAFT", "instrument_id": "TEST_SENSOR", "target_name": "TEST_BALL", "pixel_pitch": 0.1, "itrans_line": [ 0.0, 0.0, 10 ], "itrans_sample": [ 0.0, 10, 0.0 ], "transx": [ 0.0, 0.1, 0.0 ], "transy": [ 0.0, 0.0, 0.1 ], "min_elevation": -1, "max_elevation": 1, "nlines": 16, "nsamples": 16, "original_half_lines": 8.0, "original_half_samples": 8.0, "omega": 0, "phi": 0, "kappa": 0, "semi_major_axis": 10, "semi_minor_axis": 10, "transx": [ 0.0, 0.1, 0.0 ], "transy": [ 0.0, 0.0, 0.1 ], "x_sensor_origin": 1000, "y_sensor_origin": 0, "z_sensor_origin": 0, "x_sensor_velocity": 1, "y_sensor_velocity": 0, "z_sensor_velocity": 0, "x_sun_position": 100, "y_sun_position": 100, "z_sun_position": 0, "odt_x": [ 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "odt_y": [ 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "starting_detector_line": 0.0, "starting_detector_sample": 0.0 } tests/simpleFramerISD.jsondeleted 100644 → 0 +0 −37 Original line number Diff line number Diff line { "ephemeris_time": 418855170.49264956, "focal_length": 500, "instrument_id": "MDIS-NAC", "itrans_line": [ 0.0, 0.0, 10 ], "itrans_sample": [ 0.0, 10, 0.0 ], "kappa": 0, "min_elevation": -1, "max_elevation": 1, "nlines": 5, "nsamples": 5, "omega": 0, "phi": 0, "semi_major_axis": 100, "transx": [ 0.0, 0.1, 0.0 ], "transy": [ 0.0, 0.0, 0.1 ], "x_sensor_origin": 100, "y_sensor_origin": 0, "z_sensor_origin": 0 } Loading
tests/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -4,4 +4,4 @@ cmake_minimum_required(VERSION 3.10) add_executable(runTests TestyMcTestFace.cpp) target_link_libraries(runTests usgscsm ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) gtest_discover_tests(runTests WORKING_DIRECTORY tests) gtest_discover_tests(runTests WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
tests/TestyMcTestFace.cpp +37 −2 Original line number Diff line number Diff line #include "UsgsAstroFramePlugin.h" #include <json/json.hpp> #include <fstream> #include <gtest/gtest.h> using json = nlohmann::json; class FrameIsdTest : public ::testing::Test { protected: csm::Isd isd; virtual void SetUp() { std::ifstream isdFile("data/simpleFramerISD.json"); json jsonIsd = json::parse(isdFile); isd.clearAllParams(); for (json::iterator it = jsonIsd.begin(); it != jsonIsd.end(); ++it) { isd.addParam(it.key(), it.value().dump()); } } }; TEST(FramePluginTests, PluginName) { UsgsAstroFramePlugin testPlugin; EXPECT_EQ("UsgsAstroFramePluginCSM", testPlugin.getPluginName());; Loading @@ -22,10 +43,17 @@ TEST(FramePluginTests, NumModels) { EXPECT_EQ(1, testPlugin.getNumModels());; } TEST(FramePluginTests, NoStateName) { UsgsAstroFramePlugin testPlugin; std::string badState = "{\"not_a_name\":\"bad_name\"}"; EXPECT_FALSE(testPlugin.canModelBeConstructedFromState( "USGS_ASTRO_FRAME_SENSOR_MODEL", badState));; } TEST(FramePluginTests, BadStateName) { UsgsAstroFramePlugin testPlugin; std::string badState = "{" "\"model_name\":\"bad_name\"}"; std::string badState = "{\"model_name\":\"bad_name\"}"; EXPECT_FALSE(testPlugin.canModelBeConstructedFromState( "USGS_ASTRO_FRAME_SENSOR_MODEL", badState));; Loading @@ -50,6 +78,13 @@ TEST(FramePluginTests, MissingStateValue) { badState));; } TEST_F(FrameIsdTest, ConstructFromISD) { UsgsAstroFramePlugin testPlugin; EXPECT_TRUE(testPlugin.canModelBeConstructedFromISD( isd, "USGS_ASTRO_FRAME_SENSOR_MODEL")); } int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); Loading
tests/data/simpleFramerISD.json 0 → 100644 +96 −0 Original line number Diff line number Diff line { "boresight": [ 0.0, 0.0, 1.0 ], "ccd_center": [ 7.5, 7.5 ], "ephemeris_time": 100.0, "focal_length": 500, "focal_length_epsilon": 1.0, "ifov": 6.0, "model_name": "UsgsAstroFramePluginCSM", "spacecraft_name": "TEST_CRAFT", "instrument_id": "TEST_SENSOR", "target_name": "TEST_BALL", "pixel_pitch": 0.1, "itrans_line": [ 0.0, 0.0, 10 ], "itrans_sample": [ 0.0, 10, 0.0 ], "transx": [ 0.0, 0.1, 0.0 ], "transy": [ 0.0, 0.0, 0.1 ], "min_elevation": -1, "max_elevation": 1, "nlines": 16, "nsamples": 16, "original_half_lines": 8.0, "original_half_samples": 8.0, "omega": 0, "phi": 0, "kappa": 0, "semi_major_axis": 10, "semi_minor_axis": 10, "transx": [ 0.0, 0.1, 0.0 ], "transy": [ 0.0, 0.0, 0.1 ], "x_sensor_origin": 1000, "y_sensor_origin": 0, "z_sensor_origin": 0, "x_sensor_velocity": 1, "y_sensor_velocity": 0, "z_sensor_velocity": 0, "x_sun_position": 100, "y_sun_position": 100, "z_sun_position": 0, "odt_x": [ 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "odt_y": [ 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], "starting_detector_line": 0.0, "starting_detector_sample": 0.0 }
tests/simpleFramerISD.jsondeleted 100644 → 0 +0 −37 Original line number Diff line number Diff line { "ephemeris_time": 418855170.49264956, "focal_length": 500, "instrument_id": "MDIS-NAC", "itrans_line": [ 0.0, 0.0, 10 ], "itrans_sample": [ 0.0, 10, 0.0 ], "kappa": 0, "min_elevation": -1, "max_elevation": 1, "nlines": 5, "nsamples": 5, "omega": 0, "phi": 0, "semi_major_axis": 100, "transx": [ 0.0, 0.1, 0.0 ], "transy": [ 0.0, 0.0, 0.1 ], "x_sensor_origin": 100, "y_sensor_origin": 0, "z_sensor_origin": 0 }