Go to the source code of this file.
Classes | |
class | TestMath |
class | SuccessSumTester< S > |
class | OverflowSumTester< S > |
Functions | |
CPPUNIT_TEST_SUITE_REGISTRATION (TestMath) | |
template<typename S > | |
static S | RawSum () |
ends argument recursion for RawSum() with parameters More... | |
template<typename S , typename A , typename... Args> | |
static S | RawSum (A a, Args... args) |
template<typename S , template< typename > class Tester, typename A , typename B > | |
static void | TestWithZeros (const A a, const B b) |
checks that the summation outcome is unaffected by (not) adding zeros More... | |
template<typename S , template< typename > class Tester, typename A , typename B > | |
static void | TestOrder (const A a, const B b) |
checks that the summation outcome is unaffected by the order of operands More... | |
template<typename A , typename B > | |
static void | TestOverflowForEitherSummationType (const A a, const B b) |
checks that a+b and similar sums overflow for summation types A and B More... | |
template<typename A , typename B > | |
static void | TestSuccessForFirstSummationType (const A a, const B b) |
template<typename A , typename... Args, typename S = A> | |
static S | GoodSum (const A a, Args... args) |
int | main (int argc, char *argv[]) |
template<typename A > | |
static std::string | TypeToString () |
template<typename A > | |
static std::string | OperandToString (const A a) |
template<typename S , typename A , typename B > | |
static std::string | SumToString (const A a, const B b) |
template<typename S , typename A , typename B , typename C > | |
static std::string | SumToString (const A a, const B b, const C c) |
Variables | |
static const auto | min64s = std::numeric_limits<int64_t>::min() |
static const auto | min8s = std::numeric_limits<int8_t>::min() |
static const auto | zero8s = int8_t(0) |
static const auto | zero8u = uint8_t(0) |
static const auto | zero64s = int64_t(0) |
static const auto | zero64u = uint64_t(0) |
static const auto | one8s = int8_t(1) |
static const auto | one8u = uint8_t(1) |
static const auto | one64s = int64_t(1) |
static const auto | one64u = uint64_t(1) |
static const auto | max8s = std::numeric_limits<int8_t>::max() |
static const auto | max8u = std::numeric_limits<uint8_t>::max() |
static const auto | max64s = std::numeric_limits<int64_t>::max() |
static const auto | max64u = std::numeric_limits<uint64_t>::max() |
Function Documentation
◆ CPPUNIT_TEST_SUITE_REGISTRATION()
CPPUNIT_TEST_SUITE_REGISTRATION | ( | TestMath | ) |
◆ GoodSum()
|
static |
- Returns
- successful a+b value using summation type S (which defaults to A)
Definition at line 190 of file testMath.cc.
References SuccessSumTester< S >::Test().
Referenced by TestMath::testNaturalSum().
◆ main()
Definition at line 269 of file testMath.cc.
References TestProgram::run().
◆ OperandToString()
Definition at line 57 of file testMath.cc.
Referenced by SumToString(), and SuccessSumTester< S >::Test().
◆ RawSum() [1/2]
|
static |
Definition at line 81 of file testMath.cc.
◆ RawSum() [2/2]
helper function to add up an arbitrary number of arbitrary-type integers while converting every number to type S and ignoring any under/overflows
Definition at line 90 of file testMath.cc.
◆ SumToString() [1/2]
Definition at line 64 of file testMath.cc.
References OperandToString().
◆ SumToString() [2/2]
Definition at line 71 of file testMath.cc.
References OperandToString().
◆ TestOrder()
Definition at line 162 of file testMath.cc.
◆ TestOverflowForEitherSummationType()
Definition at line 171 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ TestSuccessForFirstSummationType()
checks that a+b and similar sums succeed for summation type A but overflow for summation type B
Definition at line 181 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ TestWithZeros()
◆ TypeToString()
|
static |
helper functions to convert NaturalSum<S>(a,b,...) calls to strings
Definition at line 49 of file testMath.cc.
References A.
Variable Documentation
◆ max64s
|
static |
Definition at line 40 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ max64u
|
static |
Definition at line 41 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ max8s
|
static |
Definition at line 38 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ max8u
|
static |
Definition at line 39 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ min64s
|
static |
bit-width-specific integers, for developer convenience and code readability
Definition at line 28 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ min8s
|
static |
Definition at line 29 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ one64s
|
static |
Definition at line 36 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ one64u
|
static |
Definition at line 37 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ one8s
|
static |
Definition at line 34 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ one8u
|
static |
Definition at line 35 of file testMath.cc.
Referenced by TestMath::testNaturalSum().
◆ zero64s
|
static |
Definition at line 32 of file testMath.cc.
Referenced by TestMath::testNaturalSum(), and TestWithZeros().
◆ zero64u
|
static |
Definition at line 33 of file testMath.cc.
Referenced by TestMath::testNaturalSum(), and TestWithZeros().
◆ zero8s
|
static |
Definition at line 30 of file testMath.cc.
Referenced by TestMath::testNaturalSum(), and TestWithZeros().
◆ zero8u
|
static |
Definition at line 31 of file testMath.cc.
Referenced by TestMath::testNaturalSum(), and TestWithZeros().