C++ Utilities: tests/conversiontests.cpp File Reference

C++ Utilities 5.34.2 Useful C++ classes and routines such as argument parser, IO and conversion utilities

Loading...
Searching...
No Matches
Classes | Macros | Functions
conversiontests.cpp File Reference
`#include "../conversion/binaryconversion.h"`
`#include "../conversion/stringbuilder.h"`
`#include "../conversion/stringconversion.h"`
`#include "../tests/testutils.h"`
`#include <cppunit/TestFixture.h>`
`#include <cppunit/extensions/HelperMacros.h>`
`#include <functional>`
`#include <initializer_list>`
`#include <random>`
`#include <sstream>`
Include dependency graph for conversiontests.cpp:

Go to the source code of this file.

## Classes
class | ConversionTests
| The ConversionTests class tests classes and functions provided by the files inside the conversion directory. More...

## Macros
#define | TEST_TYPE(endianness, function)
#define | TEST_CONVERSION(function, endianness)
#define | TEST_BE_CONVERSION(function)
#define | TEST_LE_CONVERSION(function)
#define | TEST_CUSTOM_CONVERSION(vice, versa, endianness, min, max)

## Functions
| CPPUNIT_TEST_SUITE_REGISTRATION (ConversionTests)
void | assertEqual (const char *message, const std::uint8_t *expectedValues, size_t expectedSize, const StringData &actualValues)
| Internally used for string encoding tests to check results.

## Macro Definition Documentation

## ◆ TEST_BE_CONVERSION

#define TEST_BE_CONVERSION | ( |  | function | ) |

Value:
TEST_CONVERSION(function, BE)
TEST_CONVERSION
#define TEST_CONVERSION(function, endianness)
Definition conversiontests.cpp:127
CppUtilities::BE
Encapsulates binary conversion functions using the big endian byte order.
Definition binaryconversion.h:208

Definition at line 132 of file conversiontests.cpp.

## ◆ TEST_CONVERSION

#define TEST_CONVERSION | ( |  | function,
|  |  | endianness )

Value:
testConversion<TEST_TYPE(endianness, function)>("testing " #endianness "::" #function, \
static_cast<void (*)(TEST_TYPE(endianness, function), char *)>(&endianness::getBytes), endianness::function, \
numeric_limits<TEST_TYPE(endianness, function)>::min(), numeric_limits<TEST_TYPE(endianness, function)>::max())
TEST_TYPE
#define TEST_TYPE(endianness, function)
Definition conversiontests.cpp:125
CppUtilities::max
constexpr T max(T first, T second)
Returns the greatest of the given items.
Definition math.h:96
CppUtilities::min
constexpr T min(T first, T second)
Returns the smallest of the given items.
Definition math.h:84

Definition at line 127 of file conversiontests.cpp.

## ◆ TEST_CUSTOM_CONVERSION

#define TEST_CUSTOM_CONVERSION | ( |  | vice,
|  |  | versa,
|  |  | endianness,
|  |  | min,
|  |  | max )

Value:
testConversion<TEST_TYPE(endianness, versa)>("testing " #versa " (" #endianness ")", \
static_cast<void (*)(TEST_TYPE(endianness, versa), char *)>(&endianness::vice), endianness::versa, min, max)

Definition at line 136 of file conversiontests.cpp.

## ◆ TEST_LE_CONVERSION

#define TEST_LE_CONVERSION | ( |  | function | ) |

Value:
TEST_CONVERSION(function, LE)
CppUtilities::LE
Encapsulates binary conversion functions using the little endian byte order.
Definition binaryconversion.h:219

Definition at line 134 of file conversiontests.cpp.

## ◆ TEST_TYPE

#define TEST_TYPE | ( |  | endianness,
|  |  | function )

Value:
decltype(endianness::function(m_buff))

Definition at line 125 of file conversiontests.cpp.

## Function Documentation

## ◆ assertEqual()

void assertEqual | ( | const char * | message,
|  | const std::uint8_t * | expectedValues,
|  | size_t | expectedSize,
|  | const StringData & | actualValues )

Internally used for string encoding tests to check results.

Definition at line 180 of file conversiontests.cpp.

## ◆ CPPUNIT_TEST_SUITE_REGISTRATION()

CPPUNIT_TEST_SUITE_REGISTRATION | ( | ConversionTests |  | ) |