-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_bytes.cpp
44 lines (38 loc) · 922 Bytes
/
test_bytes.cpp
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
This file is part of cpp_ssz.
@author SigmoiD <alphabet@hotmail.co.kr>
*/
#include "include/Common.h"
#include "include/cpp_ssz_bytes.h"
using namespace std;
using namespace ssz;
#include "include/test.h"
int main()
{
/*
(b"", b'\x00\x00\x00\x00'),
(b"I", b'\x01\x00\x00\x00I'),
(b"foo", b'\x03\x00\x00\x00foo'),
(b"hello", b'\x05\x00\x00\x00hello'),
*/
// bytes
{
bytes testval("");
bytes enc = testval.to_bytes(testval.size(),little);
print_hex(enc);
bytes dec;
dec.from_bytes(enc, little);
print_hex(dec);
CHECK_SUCESS("bytes",testval, dec);
}
// bytes
{
bytes testval("hello");
bytes enc = testval.to_bytes(testval.size(),little);
print_hex(enc);
bytes dec;
dec.from_bytes(enc, little);
print_hex(dec);
CHECK_SUCESS("bytes",testval, dec);
}
}