Minor release

Add test cases
This commit is contained in:
2022-11-13 15:48:37 +01:00
parent 16cf2eb08f
commit 992a37d514
5 changed files with 44 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ if ( MSVC )
endif() endif()
set (VERSION_MAJOR 1) set (VERSION_MAJOR 1)
set (VERSION_MINOR 3) set (VERSION_MINOR 4)
include(GNUInstallDirs) include(GNUInstallDirs)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY

View File

@@ -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})

18
tests/StartersTest.cpp Normal file
View File

@@ -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());
}

3
tests/StartersTest.hpp Normal file
View File

@@ -0,0 +1,3 @@
#include "TopTeamBedrijfssimulaties.hpp"
#include <gtest/gtest.h>

7
tests/main.cpp Normal file
View File

@@ -0,0 +1,7 @@
#include <gtest/gtest.h>
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}