Skip to content

Commit

Permalink
made unit tests in icesat2 plugin conditional on debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
jpswinski committed Nov 9, 2023
1 parent 157d707 commit ea412a4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins/icesat2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$<$<CONFIG:Debug>:-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
Expand All @@ -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
)
$<$<CONFIG:Debug>:${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl03Reader.cpp>
$<$<CONFIG:Debug>:${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl06Dispatch.cpp>)

# Include Directories #
target_include_directories (icesat2
Expand Down Expand Up @@ -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
$<$<CONFIG:Debug>:${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl03Reader.h>
$<$<CONFIG:Debug>:${CMAKE_CURRENT_LIST_DIR}/plugin/UT_Atl06Dispatch.h>
DESTINATION
${INSTALLDIR}/include/sliderule/icesat2
)
8 changes: 8 additions & 0 deletions plugins/icesat2/plugin/icesat2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}
};
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions plugins/icesat2/plugin/icesat2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions plugins/icesat2/selftests/plugin_unittest.lua
Original file line number Diff line number Diff line change
@@ -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()
Expand Down

0 comments on commit ea412a4

Please sign in to comment.