The finite element method using deal.II - 2021/2022
pythagoras.cc
Go to the documentation of this file.
1 #include <deal.II/base/point.h>
2 
3 #include <gtest/gtest.h>
4 
5 using namespace dealii;
6 
7 
8 TEST(Pythagoras, Norm)
9 {
10  Point<2> x(3, 4);
11  ASSERT_EQ(x.norm(), 5);
12 }
13 
14 
15 TEST(Pythagoras, Distance)
16 {
17  Point<2> x(4, 5);
18  Point<2> y(1, 1);
19  ASSERT_EQ(x.distance(y), 5);
20 }
21 
22 
23 TEST(Pythagoras, ScalarProduct)
24 {
25  Point<2> x(3, 4);
26  ASSERT_EQ(x * x, 25);
27 }
28 
29 
30 int
31 main(int argc, char *argv[])
32 {
33  testing::InitGoogleTest(&argc, argv);
34  return RUN_ALL_TESTS();
35 }
dealii
point.h
TEST
TEST(Pythagoras, Norm)
Definition: pythagoras.cc:8
Point< 2 >::norm
numbers::NumberTraits< double >::real_type norm() const
main
int main(int argc, char *argv[])
Definition: pythagoras.cc:31
Point< 2 >::distance
numbers::NumberTraits< double >::real_type distance(const Point< dim, double > &p) const
Point< 2 >