Currently moving from Gitlab to Gitea at https://labs.phundrak.com. Some features may not work anymore on this Gitlab instance.

added files for running tests

parent 99c815a5
......@@ -7,6 +7,7 @@ project("GeneticImages"
LANGUAGES CXX)
file(GLOB SRC_FILES "src/*.cc")
file(GLOB TEST_FILES "tests/tests.cc")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
......@@ -21,10 +22,15 @@ enable_cxx_compiler_flag_if_supported("-flto")
# include_directories(<PUBLIC HEADER DIRECTORIES>)
set(TGT genetic-image)
set(TESTTGT genetic-image-tests)
add_executable(${TGT} ${SRC_FILES})
add_executable(${TESTTGT} ${TEST_FILES})
target_compile_features(${TGT} PRIVATE cxx_std_17)
target_compile_features(${TESTTGT} PRIVATE cxx_std_17)
target_include_directories(${TGT} PRIVATE include/genimg)
target_include_directories(${TESTTGT} PRIVATE include/genimg)
target_link_libraries(${TGT} ${CONAN_LIBS} stdc++fs)
target_link_libraries(${TESTTGT} ${CONAN_LIBS} stdc++fs)
# OS specific instructions.
if(APPLE)
......
......@@ -3,7 +3,7 @@ from conans import CMake, ConanFile
class GeneticImageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "opencv/[email protected]/stable", "boost/[email protected]/stable", "spdlog/[email protected]/stable"
requires = "opencv/[email protected]/stable", "boost/[email protected]/stable", "spdlog/[email protected]/stable", "gtest/[email protected]/stable"
generators = "cmake", "gcc", "txt"
def imports(self):
......
#include <gtest/gtest.h>
TEST(SquareRootTest, PositiveNos) {
ASSERT_EQ(6, 2 * 3);
ASSERT_EQ(6, -2 * -3);
}
TEST(SquareRootTest, NegativeNos) {
ASSERT_EQ(-6, -2 * 3);
ASSERT_EQ(-6, 2 * -3);
}
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment