blob: d82db14fd99fadd86ca904edc7e6df5f7e9864ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <forstio/test/suite.h>
#include <forstio/codec/json/json.h>
namespace {
SAW_TEST("Int32 write"){
using namespace saw;
data<schema::Int32, encode::Native> native_int;
data<schema::Int32, encode::Json> json_int;
native_int.set(44123);
codec<schema::Int32, encode::Json> json_codec;
error_or<void> eov = json_codec.encode(native_int, json_int);
SAW_EXPECT(eov.is_value(), "Encoding error");
std::string_view str_view = "44123";
for(std::size_t i = 0; i < str_view.size(); ++i){
SAW_EXPECT( json_int.at(i) == str_view[i], "Value is not being encoded correctly" );
}
}
}
|