OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Classes | Enumerations | Functions | Variables
Json_ut.cpp File Reference
#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
 

Enumeration Type Documentation

◆ TotallyBrokenEnum

enum class TotallyBrokenEnum
strong
Enumerator
VALUE_0 
VALUE_1 
VALUE_2 

Function Documentation

◆ EXPECT_ANY_THROW() [1/2]

EXPECT_ANY_THROW ( from_json(Json("0"), e )

◆ EXPECT_ANY_THROW() [2/2]

EXPECT_ANY_THROW ( to_json(json, VALUE_1 )

◆ EXPECT_NO_THROW()

EXPECT_NO_THROW ( to_json(json, VALUE_0 )

◆ MM_DEFINE_ENUM_SERIALIZATION_FUNCTIONS()

MM_DEFINE_ENUM_SERIALIZATION_FUNCTIONS ( TotallyBrokenEnum  ,
CASE_INSENSITIVE  ,
{ {VALUE_0, "000000000000000000"} }   
)

◆ MM_DEFINE_JSON_STRUCT_SERIALIZATION_FUNCTIONS()

MM_DEFINE_JSON_STRUCT_SERIALIZATION_FUNCTIONS ( TestPair  ,
((a, "a"),(b, "b"))   
)

◆ push_back()

v push_back ( VALUE_1  )

◆ TestRoundTrip()

template<class T >
void TestRoundTrip ( const T &  value)

◆ UNIT_TEST() [1/3]

UNIT_TEST ( JsonSerialization  ,
Standard   
)

◆ UNIT_TEST() [2/3]

UNIT_TEST ( JsonSerialization  ,
StandardExceptions   
)

◆ UNIT_TEST() [3/3]

s UNIT_TEST ( JsonSerialization  ,
Struct   
)

Variable Documentation

◆ d

d

◆ e

◆ Enum

Enum
Initial value:
{
void TestRoundTrip(const T &value)
Definition: Json_ut.cpp:10

◆ i

i

◆ json

Json json

◆ s

s

◆ v

std::vector< TotallyBrokenEnum > v