Seperating test files from the main test cpp file.
This commit is contained in:
parent
fe32b18d0c
commit
27517cdfa6
4 changed files with 17 additions and 8 deletions
|
@ -3,7 +3,9 @@ find_package(GTest REQUIRED)
|
|||
|
||||
include(GoogleTest)
|
||||
|
||||
add_executable(pacman_tests tests.cpp)
|
||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp")
|
||||
|
||||
add_executable(pacman_tests ${sources})
|
||||
target_link_libraries(pacman_tests GTest::GTest libpacman)
|
||||
|
||||
gtest_discover_tests(pacman_tests TEST_PREFIX pacman:)
|
||||
|
|
8
test/testPacMan.cpp
Normal file
8
test/testPacMan.cpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include "PacMan.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(PacManTest, InitialPosition) {
|
||||
pacman::PacMan pacMan;
|
||||
EXPECT_EQ(pacMan.position().x, 13.5);
|
||||
EXPECT_EQ(pacMan.position().y, 23);
|
||||
}
|
6
test/testPosition.cpp
Normal file
6
test/testPosition.cpp
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include "Position.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(PacManTest, Position) {
|
||||
EXPECT_EQ(1, 1);
|
||||
}
|
|
@ -1,12 +1,5 @@
|
|||
#include "PacMan.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(PacManTest, InitialPosition) {
|
||||
pacman::PacMan pacMan;
|
||||
EXPECT_EQ(pacMan.position().x, 13.5);
|
||||
EXPECT_EQ(pacMan.position().y, 23);
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
|
|
Loading…
Reference in a new issue