Skip to content
Snippets Groups Projects
Commit df05a5e7 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

improve unit tests management

parent d7c3b8cb
Branches
No related tags found
No related merge requests found
...@@ -2,12 +2,15 @@ include_directories("${CATCH_INCLUDE_PATH}") ...@@ -2,12 +2,15 @@ include_directories("${CATCH_INCLUDE_PATH}")
set(EXECUTABLE_OUTPUT_PATH ${PASTIS_BINARY_DIR}) set(EXECUTABLE_OUTPUT_PATH ${PASTIS_BINARY_DIR})
add_executable (unit_tests add_executable (unit_tests
main.cpp test_main.cpp
example.cpp test_RevisionInfo.cpp
example2.cpp) test_TinyVector.cpp)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
target_link_libraries (unit_tests Catch) target_link_libraries (
unit_tests
PastisUtils
Catch)
enable_testing() enable_testing()
......
#include <catch.hpp>
TEST_CASE("Test1", "[unit]") {
int a = 1;
int b = 2;
REQUIRE(a == b);
}
TEST_CASE("Test2") {
int a = 2;
int b = 2;
REQUIRE(a == b);
}
TEST_CASE("Test3", "[a][b][c]") {
int a = 1;
int b = 2;
REQUIRE(a != b);
}
#include <catch.hpp>
TEST_CASE("Test5", "[unit]") {
int a = 1;
int b = 2;
REQUIRE(a+1 == b);
}
TEST_CASE("Test6", "[a]") {
int a = 2;
int b = 2;
REQUIRE(a == b);
}
TEST_CASE("Test7", "[a][b][c]") {
int a = 1;
int b = 2;
REQUIRE(a != b);
}
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
// #define CATCH_CONFIG_RUNNER
// #include <catch.hpp>
// int main(int argc, char* argv[]) {
// auto result = Catch::Session().run(argc, argv);
// return (result < 0xff ? result : 0xff);
// }
#include <catch.hpp>
#include <RevisionInfo.hpp>
TEST_CASE("RevisionInfo", "[utils]") {
REQUIRE(RevisionInfo::hasGitInfo() == true);
}
#include <catch.hpp>
#include <TinyVector.hpp>
TEST_CASE("TinyVector", "[algebra]") {
TinyVector<3,int> v(1,2,3);
REQUIRE(((v[0] == 1) and (v[1] == 2) and (v[2] == 3)));
}
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment