norms.cpp
Go to the documentation of this file.
1
9 /*****************************************************************************
10 ** Includes
11 *****************************************************************************/
12
13 #include <iostream>
14 #include <gtest/gtest.h>
15 #include "../../include/ecl/math/norms.hpp"
16
17 /*****************************************************************************
18 ** Using
19 *****************************************************************************/
20
21 using ecl::EuclideanNorm;
23
24 /*****************************************************************************
25 ** Tests
26 *****************************************************************************/
27
28 TEST(NormTests,euclideanNorm) {
29  EXPECT_EQ(5,EuclideanNorm()(3,4));
30 }
31
32 TEST(NormTests,euclideanNormFloats) {
33  float x = 3.0;
34  float y = 4.0;
35  float z = 5.0;
36  EXPECT_EQ(z,EuclideanNorm()(x,y));
37 }
38
39 TEST(NormTests,euclideanNormDoubles) {
40  double x = 3.0;
41  double y = 4.0;
42  double z = 5.0;
43  EXPECT_EQ(z,EuclideanNorm()(x,y));
44 }
45
46 TEST(NormTests,euclideanNormFunctions) {
47  double x = 3.0;
48  double y = 4.0;
49  double z = 5.0;
50  EXPECT_EQ(z,euclidean_norm(x,y));
51  float xf = 3.0;
52  float yf = 4.0;
53  float zf = 5.0;
54  EXPECT_EQ(zf,euclidean_norm(xf,yf));
55 }
56
57 /*****************************************************************************
58 ** Main program
59 *****************************************************************************/
60
61 int main(int argc, char **argv) {
62  std::cout << "Numeric Limits<float>: " << std::numeric_limits<float>::min() << std::endl;
63  std::cout << "Numeric Limits<float>: " << std::numeric_limits<float>::max() << std::endl;
65  return RUN_ALL_TESTS();
66 }
67
T euclidean_norm(const T &x1, const T &x2)
Function for euclidean norms of dimension 2.
Definition: norms.hpp:82
int main(int argc, char **argv)
Definition: norms.cpp:61
TEST(NormTests, euclideanNorm)
Definition: norms.cpp:28
Functor for euclidean norms.
Definition: norms.hpp:39

ecl_math
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:18:37