-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestUtil.h
41 lines (30 loc) · 989 Bytes
/
TestUtil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#if !defined(TESTUTIL_H_INCLUDED)
#define TESTUTIL_H_INCLUDED
#include "Exceptions.h"
#include <iosfwd>
#include <span>
// ===========================================================================
//
// Test case structs
//
// ===========================================================================
using ArgSpan = ::std::span<const char*const>;
struct CmdLineParseTestCase
{
template<::std::size_t N>
CmdLineParseTestCase(const char*const(&args)[N]) noexcept
: m_args(::std::span{args + 1, N - 1}) {}
ArgSpan m_args;
};
struct CmdLineParseFailTestCase : public CmdLineParseTestCase
{
template<::std::size_t N>
CmdLineParseFailTestCase(const char*const(&args)[N], char const* pExMsgPattern) noexcept :
CmdLineParseTestCase(args),
m_pExMsgPattern(pExMsgPattern)
{}
bool doesExMatch(CmdLineError const& ex) const;
char const* m_pExMsgPattern;
};
::std::ostream& operator<<(::std::ostream& ostrm, CmdLineParseTestCase const& tc);
#endif // TESTUTIL_H_INCLUDED