mirror of
https://github.com/aantron/better-enums.git
synced 2025-12-07 01:06:42 +08:00
30 lines
578 B
C++
30 lines
578 B
C++
#include <cxxtest/TestSuite.h>
|
|
#include <iostream>
|
|
#include <enum.h>
|
|
|
|
|
|
|
|
BETTER_ENUM(Compiler, int, GCC, Clang, MSVC)
|
|
|
|
|
|
|
|
class StreamOperatorTests : public CxxTest::TestSuite {
|
|
public:
|
|
void test_output()
|
|
{
|
|
std::stringstream stream;
|
|
|
|
stream << +Compiler::GCC;
|
|
TS_ASSERT_EQUALS(strcmp(stream.str().c_str(), "GCC"), 0);
|
|
}
|
|
|
|
void test_input()
|
|
{
|
|
std::stringstream stream("Clang");
|
|
Compiler compiler = Compiler::GCC;
|
|
|
|
stream >> compiler;
|
|
TS_ASSERT_EQUALS(compiler, +Compiler::Clang);
|
|
}
|
|
};
|