commit c46b99b3fae26f5d31f582d34b77745b2c5327cc
parent adf4b010edf02bdde805c3a686054c3ca7f96eef
Author: nolash <dev@holbrook.no>
Date: Sun, 11 Apr 2021 17:48:27 +0200
Add chunked adjacent in list test (eth tx similar)
Diffstat:
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/tests/check_encoder.c b/tests/check_encoder.c
@@ -229,7 +229,38 @@ START_TEST(rlp_encode_list_long_test) {
}
END_TEST
-Suite *rlp_suite(void) {
+
+START_TEST(rlp_encode_list_long_chunked_test) {
+ char x[10];
+ char y[20];
+ char z[30];
+ int i;
+ int j;
+ int r;
+ char *zs;
+
+ char target[] = {0xf8, 63};
+
+ rlp_encoder_t encoder;
+ rlp_init(&encoder, 1024, NULL);
+
+ r = rlp_descend(&encoder);
+
+ rlp_add(&encoder, 10, x);
+ rlp_add(&encoder, 20, y);
+ rlp_add(&encoder, 30, z);
+
+ r = rlp_ascend(&encoder);
+
+ ck_assert_mem_eq(encoder.buf, target, 2);
+
+ rlp_free(&encoder);
+
+}
+END_TEST
+
+
+Suite *rlp_encode_suite(void) {
Suite *s;
TCase *tci;
TCase *tcb;
@@ -253,6 +284,7 @@ Suite *rlp_suite(void) {
tcase_add_test(tcl, rlp_encode_list_adjacent_test);
tcase_add_test(tcl, rlp_encode_list_nested_test);
tcase_add_test(tcl, rlp_encode_list_long_test);
+ tcase_add_test(tcl, rlp_encode_list_long_chunked_test);
suite_add_tcase(s, tcl);
return s;
@@ -265,7 +297,7 @@ int main(void) {
Suite *s;
SRunner *sr;
- s = rlp_suite();
+ s = rlp_encode_suite();
sr = srunner_create(s);
srunner_run_all(sr, CK_VERBOSE);