Utilities shared by the unit tests.
More...
#include <catch_amalgamated.h>
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <string>
#include <string_view>
#include <vector>
Go to the source code of this file.
|
| class | test_helpers::temp_file |
| | A scratch file in the system temporary directory which is removed once the test finishes, whether it passed or not. More...
|
| |
|
| std::vector< std::uint8_t > | test_helpers::idx_header (std::uint8_t data_type, const std::vector< std::int64_t > &dimensions) |
| | Builds the header of an IDX file, which is a null magic number, a one byte data type, a one byte dimension count, and then the big endian size of each dimension.
|
| |
| Catch::Matchers::WithinAbsMatcher | test_helpers::within_abs (float target, double epsilon=1e-5) |
| | Matches a float against a target within an absolute tolerance.
|
| |
Utilities shared by the unit tests.
◆ idx_header()
| std::vector< std::uint8_t > test_helpers::idx_header |
( |
std::uint8_t |
data_type, |
|
|
const std::vector< std::int64_t > & |
dimensions |
|
) |
| |
|
inline |
Builds the header of an IDX file, which is a null magic number, a one byte data type, a one byte dimension count, and then the big endian size of each dimension.
- Parameters
-
| data_type | The type of the stored data, such as 0x08 for a byte. |
| dimensions | The size of each dimension of the data. |
- Returns
- The bytes which precede the data in an IDX file.
◆ within_abs()
| Catch::Matchers::WithinAbsMatcher test_helpers::within_abs |
( |
float |
target, |
|
|
double |
epsilon = 1e-5 |
|
) |
| |
|
inline |
Matches a float against a target within an absolute tolerance.
- Parameters
-
| target | The expected value. |
| epsilon | The largest accepted absolute difference. |
- Returns
- A matcher for use with CHECK_THAT and REQUIRE_THAT.