string: extract tokeniser tests into a function
This commit is contained in:
parent
1b3147ded7
commit
98e935d4d7
@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
int
|
|
||||||
main (int, char**)
|
|
||||||
{
|
|
||||||
cruft::TAP::logger tap;
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
void
|
||||||
|
test_tokeniser (cruft::TAP::logger &tap)
|
||||||
|
{
|
||||||
// the string_literal prefix is required to (easily) construct a string
|
// the string_literal prefix is required to (easily) construct a string
|
||||||
// with an internal null character.
|
// with an internal null character.
|
||||||
using namespace std::literals::string_literals;
|
using namespace std::literals::string_literals;
|
||||||
@ -33,6 +33,16 @@ main (int, char**)
|
|||||||
for (auto [tok, expected]: cruft::zip (cruft::tokeniser (src, ','), TESTS)) {
|
for (auto [tok, expected]: cruft::zip (cruft::tokeniser (src, ','), TESTS)) {
|
||||||
tap.expect (equal (tok, expected.value), "%s", expected.message);
|
tap.expect (equal (tok, expected.value), "%s", expected.message);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
int
|
||||||
|
main (int, char**)
|
||||||
|
{
|
||||||
|
cruft::TAP::logger tap;
|
||||||
|
|
||||||
|
test_tokeniser (tap);
|
||||||
|
|
||||||
return tap.status ();
|
return tap.status ();
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user