diff --git a/plugins/icesat2/CMakeLists.txt b/plugins/icesat2/CMakeLists.txt index f73ea785d..d85987499 100644 --- a/plugins/icesat2/CMakeLists.txt +++ b/plugins/icesat2/CMakeLists.txt @@ -25,6 +25,7 @@ target_compile_definitions (icesat2 PUBLIC BUILDINFO="${BUILDINFO}") # Compile Definitions # target_compile_definitions (icesat2 PUBLIC BINID="${TGTVER}") +target_compile_options (icesat2 PUBLIC "$<$:-DWITH_UNITTESTS>") target_compile_options (icesat2 PUBLIC -Wall) # turn on "all" warnings target_compile_options (icesat2 PUBLIC -Wextra) # turn on "extra" warnings target_compile_options (icesat2 PUBLIC -Wreorder) # turn on warning for object initializer list order enforcement @@ -51,9 +52,8 @@ target_sources(icesat2 ${CMAKE_CURRENT_LIST_DIR}/plugin/GTDArray.cpp ${CMAKE_CURRENT_LIST_DIR}/plugin/Icesat2Parms.cpp ${CMAKE_CURRENT_LIST_DIR}/plugin/MeritRaster.cpp - ${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl03Reader.cpp - ${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl06Dispatch.cpp -) + $<$:${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl03Reader.cpp> + $<$:${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl06Dispatch.cpp>) # Include Directories # target_include_directories (icesat2 @@ -96,8 +96,8 @@ install ( ${CMAKE_CURRENT_LIST_DIR}/plugin/GTDArray.h ${CMAKE_CURRENT_LIST_DIR}/plugin/Icesat2Parms.h ${CMAKE_CURRENT_LIST_DIR}/plugin/MeritRaster.h - ${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl03Reader.h - ${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl06Dispatch.h + $<$:${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl03Reader.h> + $<$:${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl06Dispatch.h> DESTINATION ${INSTALLDIR}/include/sliderule/icesat2 ) diff --git a/plugins/icesat2/plugin/icesat2.cpp b/plugins/icesat2/plugin/icesat2.cpp index f5c59de1c..c19f229d4 100644 --- a/plugins/icesat2/plugin/icesat2.cpp +++ b/plugins/icesat2/plugin/icesat2.cpp @@ -68,8 +68,10 @@ int icesat2_open (lua_State *L) {"atl06", Atl06Dispatch::luaCreate}, {"atl06s", Atl06Reader::luaCreate}, {"atl08", Atl08Dispatch::luaCreate}, +#ifdef WITH_UNITTESTS {"ut_atl06", UT_Atl06Dispatch::luaCreate}, {"ut_atl03", UT_Atl03Reader::luaCreate}, +#endif {"version", icesat2_version}, {NULL, NULL} }; @@ -105,6 +107,12 @@ int icesat2_open (lua_State *L) LuaEngine::setAttrInt(L, "ATL08_TOP_OF_CANOPY", Icesat2Parms::ATL08_TOP_OF_CANOPY); LuaEngine::setAttrInt(L, "ATL08_UNCLASSIFIED", Icesat2Parms::ATL08_UNCLASSIFIED); + #ifdef WITH_UNITTESTS + LuaEngine::setAttrBool(L, "UNITTEST", true); + #else + LuaEngine::setAttrBool(L, "UNITTEST", false); + #endif + return 1; } diff --git a/plugins/icesat2/plugin/icesat2.h b/plugins/icesat2/plugin/icesat2.h index 067ffe649..76492a681 100644 --- a/plugins/icesat2/plugin/icesat2.h +++ b/plugins/icesat2/plugin/icesat2.h @@ -47,8 +47,11 @@ #include "GTDArray.h" #include "MeritRaster.h" #include "Icesat2Parms.h" + +#ifdef WITH_UNITTESTS #include "UT_Atl03Reader.h" #include "UT_Atl06Dispatch.h" +#endif /****************************************************************************** * PROTOTYPES diff --git a/plugins/icesat2/selftests/plugin_unittest.lua b/plugins/icesat2/selftests/plugin_unittest.lua index d6be2922b..f1adf4498 100644 --- a/plugins/icesat2/selftests/plugin_unittest.lua +++ b/plugins/icesat2/selftests/plugin_unittest.lua @@ -1,6 +1,9 @@ local runner = require("test_executive") local console = require("console") +-- Check If Present -- +if not icesat2.UNITTEST then return end + -- Setup -- atl06_dispatch = icesat2.ut_atl06()