Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
compile_commands.json
build/*
.directory
*.kdev4
*.kate-swp
*.x
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.10)

PROJECT(gtest)

FIND_PACKAGE(deal.II 9.2 REQUIRED
list(APPEND CMAKE_PREFIX_PATH "/home/Arrow/opt")

FIND_PACKAGE(deal.II 9.2.0 REQUIRED
HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR})

DEAL_II_INITIALIZE_CACHED_VARIABLES()

ADD_EXECUTABLE(gtest pythagoras.cc)



ADD_EXECUTABLE(gtest source/main.cc source/point_tests.cc)
FIND_PACKAGE(GTest)
TARGET_LINK_LIBRARIES(gtest ${GTEST_LIBRARY})
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
ENABLE_TESTING()



DEAL_II_SETUP_TARGET(gtest DEBUG)
GTEST_DISCOVER_TESTS(gtest)
GTEST_DISCOVER_TESTS(gtest)
8 changes: 8 additions & 0 deletions source/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <gtest/gtest.h>


int main(int argc, char *argv[])
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
22 changes: 18 additions & 4 deletions pythagoras.cc → source/point_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,24 @@ TEST(Pythagoras, ScalarProduct)
ASSERT_EQ(x * x, 25);
}

TEST(Pythagoras3, Norm)
{
Point<3> x(20, 4, 5);
ASSERT_EQ(x.norm(), 21);
}


TEST(Pythagoras3, Distance)
{
Point<3> x(21, 5, 6);
Point<3> y(1, 1, 1);
ASSERT_EQ(x.distance(y), 21);
}

int
main(int argc, char *argv[])

TEST(Pythagoras3, ScalarProduct)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
Point<3> x(20, 4, 5);
ASSERT_EQ(x * x, 441);
}