commit e9b9c025db271aa79173a1122b3fd578565a05ea
parent fd807a9646044cb5cdf0a56a47adee602884be35
Author: nolash <dev@holbrook.no>
Date: Sun, 11 Apr 2021 12:32:52 +0200
Add single string reciprocal test
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/tests/check_vectors.c b/tests/check_vectors.c
@@ -34,6 +34,11 @@ END_TEST
START_TEST(rlp_catdog_test) {
rlp_encoder_t encoder;
+ char buf[1024];
+ char *zbuf = (char*)&buf;
+ int l;
+
+ char state;
char *x_dog = "dog";
char *x_cat = "cat";
@@ -47,6 +52,18 @@ START_TEST(rlp_catdog_test) {
ck_assert_mem_eq(encoder.buf, r_catdog, 9);
ck_assert_int_eq(encoder.size, 9);
+ // reuse for decode
+ state = RLP_LIST;
+ rlp_init(&encoder, 1024, encoder->buf);
+ rlp_next(&encoder, &l, &zbuf);
+ ck_assert_mem_eq(&encoder.state, &state, 1);
+ ck_assert_int_eq(l, 8);
+
+ state = RLP_STRING;
+ rlp_next(&encoder, &l, &zbuf);
+
+ ck_assert_mem_eq(zbuf, x_dog, l);
+
rlp_free(&encoder);
}
END_TEST