forked from objectcomputing/mFAST
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenum_encoder_decoder.cpp
More file actions
29 lines (24 loc) · 971 Bytes
/
enum_encoder_decoder.cpp
File metadata and controls
29 lines (24 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "catch.hpp"
#include <mfast.h>
#include "fast_test_coding_case.hpp"
#include "byte_stream.h"
#include "simple16.h"
using namespace test::coding;
TEST_CASE("enum test encoder/decoder","[enum_encoder_decoder]")
{
fast_test_coding_case<simple16::templates_description> test_case;
simple16::Test_1 test_1;
simple16::Test_1_mref test_1_mref = test_1.mref();
test_1_mref.set_discrete().as_Three();
REQUIRE(test_case.encoding(test_1.cref(),"\xC0\x81\x83",true));
REQUIRE(test_case.decoding("\xC0\x81\x83",test_1.cref(),true));
}
TEST_CASE("enum test copy encoder/decoder","[enum_copy_encoder_decoder]")
{
fast_test_coding_case<simple16::templates_description> test_case;
simple16::Test_3 test_3;
simple16::Test_3_mref test_3_mref = test_3.mref();
test_3_mref.set_discrete().as_Three();
REQUIRE(test_case.encoding(test_3.cref(),"\xE0\x83\x83",true));
REQUIRE(test_case.decoding("\xE0\x83\x83",test_3.cref(),true));
}