Macros | Functions
pow_test.cc File Reference
#include "boost/test/unit_test.hpp"
#include "cetlib/pow.h"

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (pow test)
 

Functions

 BOOST_AUTO_TEST_CASE (zero)
 
 BOOST_AUTO_TEST_CASE (one)
 
 BOOST_AUTO_TEST_CASE (two)
 
 BOOST_AUTO_TEST_CASE (diffs)
 
 BOOST_AUTO_TEST_CASE (sum2s)
 
 BOOST_AUTO_TEST_CASE (sum3s)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (pow test)

Definition at line 1 of file pow_test.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( zero  )

Definition at line 15 of file pow_test.cc.

16 {
17  BOOST_TEST(pow<1>(0) == 0);
18  BOOST_TEST(pow<2>(0u) == 0u);
19  BOOST_TEST(square(0.0) == 0.0);
20  BOOST_TEST(pow<3>(0.0F) == 0.0F);
21  BOOST_TEST(cube(0.0L) == 0.0L);
22  BOOST_TEST(pow<4>(0UL) == 0UL);
23  BOOST_TEST(fourth(0UL) == 0UL);
24  BOOST_TEST(pow<5>(0L) == 0L);
25  BOOST_TEST(pow<9>(0.0) == 0.0);
26 }
constexpr T fourth(T x)
Definition: pow.h:33
constexpr T square(T x)
Definition: pow.h:21
T cube(T side)
BOOST_AUTO_TEST_CASE ( one  )

Definition at line 28 of file pow_test.cc.

29 {
30  BOOST_TEST(pow<0>(1) == 1);
31  BOOST_TEST(pow<1>(1) == 1);
32  BOOST_TEST(pow<2>(1u) == 1u);
33  BOOST_TEST(square(1.0) == 1.0);
34  BOOST_TEST(pow<3>(1.0F) == 1.0F);
35  BOOST_TEST(cube(1.0L) == 1.0L);
36  BOOST_TEST(pow<4>(1UL) == 1UL);
37  BOOST_TEST(fourth(1UL) == 1UL);
38  BOOST_TEST(pow<5>(1L) == 1L);
39  BOOST_TEST(pow<9>(1.0) == 1.0);
40 }
constexpr T fourth(T x)
Definition: pow.h:33
constexpr T square(T x)
Definition: pow.h:21
T cube(T side)
BOOST_AUTO_TEST_CASE ( two  )

Definition at line 42 of file pow_test.cc.

43 {
44  BOOST_TEST(pow<0>(2) == 1);
45  BOOST_TEST(pow<1>(2) == 2);
46  BOOST_TEST(pow<2>(2u) == 4u);
47  BOOST_TEST(square(2.0) == 4.0);
48  BOOST_TEST(pow<3>(2.0F) == 8.0F);
49  BOOST_TEST(cube(2.0L) == 8.0L);
50  BOOST_TEST(pow<4>(2UL) == 16UL);
51  BOOST_TEST(fourth(2UL) == 16UL);
52  BOOST_TEST(pow<5>(2L) == 32L);
53  BOOST_TEST(pow<9>(2.0) == 512.0);
54 }
constexpr T fourth(T x)
Definition: pow.h:33
constexpr T square(T x)
Definition: pow.h:21
T cube(T side)
BOOST_AUTO_TEST_CASE ( diffs  )

Definition at line 56 of file pow_test.cc.

57 {
58  BOOST_TEST(diff_of_squares(13, 12) == 25);
59  BOOST_TEST(diff_of_squares(13u, 12u) == 25u);
60  BOOST_TEST(diff_of_squares(13L, 12L) == 25L);
61  BOOST_TEST(diff_of_squares(13.0, 12.0) == 25.0);
62  BOOST_TEST(diff_of_squares(13.0F, 12.0F) == 25.0F);
63  BOOST_TEST(diff_of_squares(13.0L, 12.0L) == 25.0L);
64 }
constexpr T diff_of_squares(T x, T y)
Definition: pow.h:132
BOOST_AUTO_TEST_CASE ( sum2s  )

Definition at line 66 of file pow_test.cc.

67 {
68  BOOST_TEST(sum_of_squares(1, 2) == 5);
69  BOOST_TEST(sum_of_squares(1u, 2u) == 5u);
70  BOOST_TEST(sum_of_squares(1L, 2L) == 5L);
71  BOOST_TEST(sum_of_squares(1.0, 2.0) == 5.0);
72  BOOST_TEST(sum_of_squares(1.0F, 2.0F) == 5.0F);
73  BOOST_TEST(sum_of_squares(1.0L, 2.0L) == 5.0L);
74 }
constexpr T sum_of_squares(T x, T y)
Definition: pow.h:139
BOOST_AUTO_TEST_CASE ( sum3s  )

Definition at line 76 of file pow_test.cc.

77 {
78  BOOST_TEST(sum_of_squares(1, 2, 3) == 14);
79  BOOST_TEST(sum_of_squares(1u, 2u, 3u) == 14u);
80  BOOST_TEST(sum_of_squares(1L, 2L, 3L) == 14L);
81  BOOST_TEST(sum_of_squares(1.0, 2.0, 3.0) == 14.0);
82  BOOST_TEST(sum_of_squares(1.0F, 2.0F, 3.0F) == 14.0F);
83  BOOST_TEST(sum_of_squares(1.0L, 2.0L, 3.0L) == 14.0L);
84 }
constexpr T sum_of_squares(T x, T y)
Definition: pow.h:139