OpenMS
Loading...
Searching...
No Matches
ClassTestUtils.h File Reference
#include <charconv>
#include <cmath>
#include <cstring>
#include <filesystem>
#include <limits>
#include <ostream>
#include <ranges>
#include <string>
#include <string_view>
#include <type_traits>
#include <vector>

Go to the source code of this file.

Classes

struct  PrecisionWrapped< FloatingPointType >
 Stream wrapper printing a floating point value with full precision. More...
 

Namespaces

namespace  OpenMS
 Main OpenMS namespace.
 
namespace  OpenMS::Internal
 Namespace used to hide implementation details from users.
 
namespace  OpenMS::Internal::ClassTest
 Namespace for class tests.
 
namespace  OpenMS::Internal::ClassTest::detail
 

Concepts

concept  OpenMS::Internal::ClassTest::detail::Streamable
 

Functions

template<typename T >
constexpr int writtenDigits (const T &=T())
 Decimal digits to print for a value in TEST_REAL_SIMILAR reports.
 
template<typename T >
constexpr bool isRealType (const T &)
 Whether TEST_REAL_SIMILAR may convert a value of this type to double.
 
void trim (std::string &s)
 Remove leading and trailing whitespace (' ', '\t', '\n', '\r'), like StringUtils::trim.
 
std::vector< std::string > split (const std::string &s, char splitter)
 
std::string join (const std::vector< std::string > &v, const char *sep)
 Join with a separator (display purposes only).
 
template<typename T >
void appendNumeric (T value, std::string &target, int precision, bool fixed_format)
 
template<typename FloatingPointType >
PrecisionWrapped< FloatingPointType > precisionWrapper (const FloatingPointType value)
 
template<typename FloatingPointType >
std::ostream & operator<< (std::ostream &os, const PrecisionWrapped< FloatingPointType > &p)
 
Stringification for TEST_EQUAL(std::string, x). Mirrors the

StringUtils::toStr overloads, so TEST_EQUAL(some_string, 114) compares against "114" and doubles keep full precision.

std::string toString (const std::string &s)
 
std::string toString (std::string_view sv)
 
std::string toString (const char *s)
 
std::string toString (char c)
 
template<typename T >
std::string toString (const T &v)
 
template<typename T >
void printValue (std::ostream &os, const T &v)
 
std::filesystem::path to_path (const std::string &s)
 

Class Documentation

◆ OpenMS::Internal::ClassTest::PrecisionWrapped

struct OpenMS::Internal::ClassTest::PrecisionWrapped
template<typename FloatingPointType>
struct OpenMS::Internal::ClassTest::PrecisionWrapped< FloatingPointType >

Stream wrapper printing a floating point value with full precision.

The framework's own version of OpenMS::precisionWrapper (OpenMS/CONCEPT/PrecisionWrapper.h): printing goes through detail::toString, i.e. the same format as StringUtils::toStr(x, true). Used by TEST_FILE_SIMILAR's report.

Class Members
FloatingPointType value