ProteoWizard
Functions
almost_equal_test.cpp File Reference
#include "Std.hpp"
#include "almost_equal.hpp"
#include "pwiz/utility/misc/unit.hpp"

Go to the source code of this file.

Functions

void test_default_float ()
 
void test_default_double ()
 
void test_multiplier ()
 
void test ()
 
int main (int argc, char *argv[])
 

Function Documentation

§ test_default_float()

void test_default_float ( )

Definition at line 32 of file almost_equal_test.cpp.

References pwiz::util::almost_equal(), epsilon, and unit_assert.

Referenced by test().

33 {
34  float a = 2.0f;
36  a *= 10.0f;
37  unit_assert(almost_equal(a, 20.0f));
38 }
const double epsilon
Definition: DiffTest.cpp:41
bool almost_equal(float_type a, float_type b, int multiplier=1)
#define unit_assert(x)
Definition: unit.hpp:85

§ test_default_double()

void test_default_double ( )

Definition at line 41 of file almost_equal_test.cpp.

References pwiz::util::almost_equal(), epsilon, and unit_assert.

Referenced by test().

42 {
43  double a = 2.0;
45  a *= 10.0;
46  unit_assert(almost_equal(a, 20.0));
47 }
const double epsilon
Definition: DiffTest.cpp:41
bool almost_equal(float_type a, float_type b, int multiplier=1)
#define unit_assert(x)
Definition: unit.hpp:85

§ test_multiplier()

void test_multiplier ( )

Definition at line 50 of file almost_equal_test.cpp.

References pwiz::util::almost_equal(), epsilon, and unit_assert.

Referenced by test().

51 {
52  float a = 1.0f;
54  a *= 10.0f;
55  unit_assert(!almost_equal(a, 10.0f));
56  unit_assert(almost_equal(a, 10.0f, 2));
57 }
const double epsilon
Definition: DiffTest.cpp:41
bool almost_equal(float_type a, float_type b, int multiplier=1)
#define unit_assert(x)
Definition: unit.hpp:85

§ test()

void test ( )

Definition at line 60 of file almost_equal_test.cpp.

References test_default_double(), test_default_float(), and test_multiplier().

Referenced by main().

61 {
65 }
void test_multiplier()
void test_default_float()
void test_default_double()

§ main()

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

Definition at line 68 of file almost_equal_test.cpp.

References test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG.

69 {
70  TEST_PROLOG(argc, argv)
71 
72  try
73  {
74  test();
75  }
76  catch (exception& e)
77  {
78  TEST_FAILED(e.what())
79  }
80  catch (...)
81  {
82  TEST_FAILED("Caught unknown exception.")
83  }
84 
86 }
#define TEST_EPILOG
Definition: unit.hpp:182
void test()
#define TEST_FAILED(x)
Definition: unit.hpp:176
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:174