7#include <boost/test/unit_test.hpp>
16 return os <<
"bilingual_str('" <<
s.original <<
"' , '" <<
s.translated <<
"')";
19BOOST_AUTO_TEST_SUITE(result_tests)
23 std::unique_ptr<int>
m_n;
33 return os <<
"NoCopy(" << *o.
m_n <<
")";
38 if (success)
return i;
44 if (success)
return s;
50 if (success)
return {i};
61template <
typename T,
typename... Args>
66 T expected{std::forward<Args>(
args)...};
71template <
typename T,
typename... Args>
bool has_value() const noexcept
std::optional methods, so functions returning optional<T> can change to return Result<T> with minimal...
const T & value() const LIFETIMEBOUND
BOOST_AUTO_TEST_SUITE_END()
#define T(expected, seed, data)
bilingual_str ErrorString(const Result< T > &result)
#define BOOST_CHECK_EQUAL(v1, v2)
util::Result< int > IntFn(int i, bool success)
void ExpectFail(const util::Result< T > &result, const bilingual_str &str)
void ExpectResult(const util::Result< T > &result, bool success, const bilingual_str &str)
bool operator==(const bilingual_str &a, const bilingual_str &b)
std::ostream & operator<<(std::ostream &os, const bilingual_str &s)
void ExpectSuccess(const util::Result< T > &result, const bilingual_str &str, Args &&... args)
util::Result< bilingual_str > StrFn(bilingual_str s, bool success)
BOOST_AUTO_TEST_CASE(check_returned)
util::Result< NoCopy > NoCopyFn(int i, bool success)
std::unique_ptr< int > m_n
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.