Sequoia
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
ConcreteTypeCheckers.hpp File Reference

Useful specializations for the class template value_tester. More...

#include "sequoia/TestFramework/FreeCheckers.hpp"
#include "sequoia/TestFramework/FileEditors.hpp"
#include "sequoia/TestFramework/FileSystemUtilities.hpp"
#include "sequoia/Core/Object/Factory.hpp"
#include "sequoia/FileSystem/FileSystem.hpp"
#include "sequoia/Streaming/Streaming.hpp"
#include <any>
#include <array>
#include <format>
#include <functional>
#include <memory>
#include <optional>
#include <tuple>
#include <variant>

Go to the source code of this file.

Classes

struct  sequoia::testing::value_tester< std::basic_string_view< Char, Traits > >
 Comparisons for std::basic_string_view More...
 
struct  sequoia::testing::value_tester< std::basic_string< Char, Traits, Allocator > >
 Comparisons for std::basic_string More...
 
struct  sequoia::testing::value_tester< std::pair< S, T > >
 Compares instances of std::pair More...
 
struct  sequoia::testing::value_tester< std::tuple< T... > >
 Compares instances of std::tuple More...
 
struct  sequoia::testing::string_based_file_comparer
 Function object for comparing files via reading their contents into strings. More...
 
class  sequoia::testing::general_file_checker< DefaultComparer, Comparers >
 A file checker, which accepts a variadic set of file comparison function objects. More...
 
struct  sequoia::testing::value_tester< std::filesystem::path >
 Checks equivalence of filesystem paths. More...
 
struct  sequoia::testing::value_tester< std::variant< Ts... > >
 Compares instances of std::variant More...
 
struct  sequoia::testing::value_tester< std::optional< T > >
 Compares instances of std::optional More...
 
struct  sequoia::testing::value_tester< std::any >
 Compares an instance of std::any to the value of the type it purportedly holds. More...
 
struct  sequoia::testing::value_tester< T * >
 Compares instance of pointers. More...
 
struct  sequoia::testing::smart_pointer_tester< T >
 Helper for testing smart pointers. More...
 
struct  sequoia::testing::value_tester< std::unique_ptr< T > >
 Compares instance of std::unique_ptr More...
 
struct  sequoia::testing::value_tester< std::shared_ptr< T > >
 Compares instance of std::shared_ptr More...
 
struct  sequoia::testing::value_tester< std::weak_ptr< T > >
 Compares instance of std::weak_ptr More...
 
struct  sequoia::testing::value_tester< std::function< R(Args...)> >
 Provides a weak_equivalence test for std::function More...
 
struct  sequoia::testing::value_tester< std::chrono::time_point< Clock, Duration > >
 Compares instance of std::chrono::time_point More...
 

Typedefs

template<class DefaultComparer , class... Comparers>
using sequoia::testing::equivalence_with_bespoke_file_checker_t = general_equivalence_check_t< general_file_checker< DefaultComparer, Comparers... > >
 
template<class DefaultComparer , class... Comparers>
using sequoia::testing::weak_equivalence_with_bespoke_file_checker_t = general_weak_equivalence_check_t< general_file_checker< DefaultComparer, Comparers... > >
 

Functions

std::string sequoia::testing::path_check_preamble (std::string_view prefix, const std::filesystem::path &path, const std::filesystem::path &prediction)
 

Variables

template<class T >
constexpr bool sequoia::testing::is_file_comparer_v
 

Detailed Description

Useful specializations for the class template value_tester.

The specializations in this header are for various types defined in std. Internally, check(equality,...) / check(equivalence,...) are used meaning that there will be automatic, recursive dispatch to other specializations of value_tester, if appropriate. For example, consider two instances of std::pair<T, U>, x and y. The utilities in this header means the call

check(equality, "descripion", logger, x, y);

will automatically call

check(equality, "automatically enhanced desciption", logger, x.first, y,first)

and similarly for the second element. In turn, this nested check(equality, ...) will use a specialization of the value_tester for T, should it exist. As usual, if the specialization for T does not exist, but T may be interpreted as a range holding a type V, then everything will simply work, provided either that there exists a specialization of the value_tester for V or V is serializable.

However, all of this begs the question as to what happens in the above example if one or both of U and T do not support equality checking, but rather only offer equivalence or weak_equivalence. If both types have the same characteristics, then the top level call can be made using the appropriate tag. However, if they are different then instead clients should use

check(with_best_available, "descripion", logger, x, y);

This uses static reflection to choose the strongest check available for each of the nested types.

Variable Documentation

◆ is_file_comparer_v

template<class T >
constexpr bool sequoia::testing::is_file_comparer_v
inlineconstexpr
Initial value:
{
std::invocable<T, test_logger<test_mode::standard>&, std::filesystem::path, std::filesystem::path>
}