Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Classes | Functions
Utopia::TestTools Namespace Reference

Classes

struct  BaseInfrastructure
 A base class for an infrastructure fixture. More...
 
struct  LocationInfo
 Bundles and handles file location information: file path and line number. More...
 

Functions

template<typename Callable = std::function<void(const DataIO::Config&)>>
void test_config_callable (Callable &&func, const DataIO::Config &test_cases, const std::string_view context_name="", const LocationInfo loc={})
 Repeatedly invokes a unary function that expects a Config node.
 
template<typename ExcT , typename Callable = std::function<void()>>
void check_exception (Callable &&func, const std::string_view match="", const LocationInfo loc={})
 Checks if a callable throws with the expected error type and message.
 
bool contains (const std::string_view s, const std::string_view match)
 Returns true if the match string is contained within the given string.
 
std::ostream & operator<< (std::ostream &out, const LocationInfo &loc)
 Overload for allowing LocationInfo output streams.
 

Function Documentation

◆ contains()

bool Utopia::TestTools::contains ( const std::string_view  s,
const std::string_view  match 
)

Returns true if the match string is contained within the given string.

19 {
20 return not (s.find(match) == std::string_view::npos);
21}

◆ operator<<()

std::ostream & Utopia::TestTools::operator<< ( std::ostream &  out,
const LocationInfo loc 
)

Overload for allowing LocationInfo output streams.

67 {
68 out << loc.string();
69 return out;
70}
std::string string() const
A string representation of the location, using the fstr member.
Definition utils.hh:49