simple.cpp
Go to the documentation of this file.
1 
7 /*****************************************************************************
8 ** Includes
9 *****************************************************************************/
10 
11 #include <gtest/gtest.h>
12 #include "../../include/ecl/math/simple.hpp"
13 
14 /*****************************************************************************
15 ** Tests
16 *****************************************************************************/
17 
18 TEST(SimpleFunctionTests,sign) {
19  EXPECT_EQ(ecl::sign(3),1);
20  EXPECT_EQ(ecl::sign(0),0);
21  EXPECT_EQ(ecl::sign(-2),-1);
22  EXPECT_EQ(ecl::sign(3.3),1);
23  EXPECT_EQ(ecl::sign(0.0),0);
24  EXPECT_EQ(ecl::sign(-2.0),-1);
25  EXPECT_EQ(ecl::psign(3),1);
26  EXPECT_EQ(ecl::psign(0),1);
27  EXPECT_EQ(ecl::psign(-2),-1);
28  EXPECT_EQ(ecl::psign(3.3),1);
29  EXPECT_EQ(ecl::psign(0.0),1);
30  EXPECT_EQ(ecl::psign(-2.0),-1);
31 }
32 
33 TEST(SimpleFunctionTests,cube_root) {
34  EXPECT_FLOAT_EQ(2.0,ecl::cube_root(8.0));
35  EXPECT_FLOAT_EQ(-2.0,ecl::cube_root(-8.0));
36 }
37 
38 /*****************************************************************************
39 ** Main program
40 *****************************************************************************/
41 
42 int main(int argc, char **argv) {
43  testing::InitGoogleTest(&argc,argv);
44  return RUN_ALL_TESTS();
45 }
46 
int main(int argc, char **argv)
Definition: simple.cpp:42
TEST(SimpleFunctionTests, sign)
Definition: simple.cpp:18
int sign(const Scalar &x)
A sign function for numerical values.
Definition: simple.hpp:38
int psign(const Scalar &x)
A sign function for numerical values (positive return if arg is zero).
Definition: simple.hpp:61
Scalar cube_root(const Scalar &x)
The real solution to a cube root.
Definition: simple.hpp:97


ecl_math
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:25