OpenEnroth 73e68f7
|
#include <string>
#include <vector>
#include "Testing/Unit/UnitTest.h"
#include "Library/Serialization/EnumSerialization.h"
#include "Library/Json/Json.h"
Classes | |
struct | TestPair |
struct | TestStruct |
Enumerations | |
enum class | TotallyBrokenEnum { VALUE_0 = 0 , VALUE_1 = 1 , VALUE_2 = 2 } |
Functions | |
template<class T > | |
void | TestRoundTrip (const T &value) |
UNIT_TEST (JsonSerialization, Standard) | |
UNIT_TEST (JsonSerialization, StandardExceptions) | |
MM_DEFINE_JSON_STRUCT_SERIALIZATION_FUNCTIONS (TestPair,((a, "a"),(b, "b"))) MM_DEFINE_JSON_STRUCT_SERIALIZATION_FUNCTIONS(TestStruct | |
s | UNIT_TEST (JsonSerialization, Struct) |
MM_DEFINE_ENUM_SERIALIZATION_FUNCTIONS (TotallyBrokenEnum, CASE_INSENSITIVE, { {VALUE_0, "000000000000000000"} }) UNIT_TEST(JsonSerialization | |
EXPECT_NO_THROW (to_json(json, VALUE_0)) | |
EXPECT_ANY_THROW (to_json(json, VALUE_1)) | |
EXPECT_ANY_THROW (from_json(Json("0"), e)) | |
v | push_back (VALUE_1) |
Variables | |
i | |
v | |
d | |
s | |
Enum | |
Json | json |
TotallyBrokenEnum | e = VALUE_0 |
|
strong |
EXPECT_ANY_THROW | ( | to_json(json, VALUE_1) | ) |
EXPECT_NO_THROW | ( | to_json(json, VALUE_0) | ) |
MM_DEFINE_ENUM_SERIALIZATION_FUNCTIONS | ( | TotallyBrokenEnum | , |
CASE_INSENSITIVE | , | ||
{ {VALUE_0, "000000000000000000"} } | |||
) |
MM_DEFINE_JSON_STRUCT_SERIALIZATION_FUNCTIONS | ( | TestPair | , |
((a, "a"),(b, "b")) | |||
) |
void TestRoundTrip | ( | const T & | value | ) |
UNIT_TEST | ( | JsonSerialization | , |
Standard | |||
) |
UNIT_TEST | ( | JsonSerialization | , |
StandardExceptions | |||
) |
s UNIT_TEST | ( | JsonSerialization | , |
Struct | |||
) |
d |
Enum |
i |
Json json |
s |
std::vector< TotallyBrokenEnum > v |