From 992a37d514c37fcc94683889522151339450dc5a Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Sun, 13 Nov 2022 15:48:37 +0100 Subject: [PATCH] Minor release Add test cases --- CMakeLists.txt | 2 +- tests/CMakeLists.txt | 15 +++++++++++++++ tests/StartersTest.cpp | 18 ++++++++++++++++++ tests/StartersTest.hpp | 3 +++ tests/main.cpp | 7 +++++++ 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/StartersTest.cpp create mode 100644 tests/StartersTest.hpp create mode 100644 tests/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c3a6b8..16ac5fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ if ( MSVC ) endif() set (VERSION_MAJOR 1) -set (VERSION_MINOR 3) +set (VERSION_MINOR 4) include(GNUInstallDirs) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e69de29..c5592a3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -0,0 +1,15 @@ +# Third Party +include_directories(${GTEST_INCLUDE_DIR}) + +link_directories(${GTEST_LIB_DIR}) + +set(LIBS + ${LIBS} + gtest + TopTeamBedrijfssimulaties) + + +# tests +file(GLOB_RECURSE TEST_SOURCES "*.cpp") +add_executable(tests ${TEST_SOURCES}) +target_link_libraries(tests ${LIBS}) \ No newline at end of file diff --git a/tests/StartersTest.cpp b/tests/StartersTest.cpp new file mode 100644 index 0000000..44bd9b5 --- /dev/null +++ b/tests/StartersTest.cpp @@ -0,0 +1,18 @@ +#include "StartersTest.hpp" + +// TEST(TestCaseName, IndividualTestName) +TEST(StartersTest, calculateStandard) +{ + Starters_c test1(Starters_c::MachineStandard::Standard, 3, 2000, 2000, 2000, 40, 40, 6000, 45000); + + EXPECT_FLOAT_EQ(-31150.0f, test1.calculate()); +} + +TEST(StartersTest, calculateLuxe) +{ + Starters_c test1(Starters_c::MachineStandard::Luxe, 1000, 1000, 105, 25, 9000, 25000); + Starters_c test2(Starters_c::MachineStandard::Luxe, 1000, 1000, 1000, 105, 25, 9000, 25000); + + EXPECT_FLOAT_EQ(75500.0f, test1.calculate()); + EXPECT_FLOAT_EQ(76338.0f, test2.calculate()); +} \ No newline at end of file diff --git a/tests/StartersTest.hpp b/tests/StartersTest.hpp new file mode 100644 index 0000000..2407375 --- /dev/null +++ b/tests/StartersTest.hpp @@ -0,0 +1,3 @@ +#include "TopTeamBedrijfssimulaties.hpp" + +#include \ No newline at end of file diff --git a/tests/main.cpp b/tests/main.cpp new file mode 100644 index 0000000..f258572 --- /dev/null +++ b/tests/main.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file