osuplusplus/test/input_stream_ops.cpp

35 lines
865 B
C++

#include <test.hpp>
#include <config.hpp>
#include <sstream>
TEST_START()
TEST("enum input stream operators work",
Countdown c = Countdown::NORMAL;
std::stringstream ss("NONE");
ss >> c;
assert(c == Countdown::NONE, "failed to parse enum");
)
TEST("enum input stream operators ignore case",
Countdown c = Countdown::NORMAL;
std::stringstream ss("none");
ss >> c;
assert(c == Countdown::NONE, "failed to parse enum all lowercase");
c = Countdown::NORMAL;
ss = std::stringstream("nOnE");
ss >> c;
assert(c == Countdown::NONE, "failed to parse enum mixed case #1");
c = Countdown::NORMAL;
ss = std::stringstream("NoNe");
ss >> c;
assert(c == Countdown::NONE, "failed to parse enum mixed case #2");
)
TEST_FINISH()