From 27eac056eb3ca3d78e94aa2c468fa36471be2226 Mon Sep 17 00:00:00 2001 From: Peter Harpending Date: Sun, 23 Oct 2022 04:44:07 -0600 Subject: [PATCH] Generating tests for RLP Erlang (appears to work!) Methodology: - in Erlang, generate random DecodeData that are decentish (hard to generate because of arbitrary depth recursive nature) - in Erlang, check that DecodeData->rlp:encode->rlp:decode is an identity (it is!) - generate tons of encode/decode pairs for Python, make sure they all work (they do!) --- .../typescript/test/testgen/rlp_testgen.erl | 177 +++++++++++++++++ bindings/typescript/test/testgen/rlptests.py | 186 ++++++++++++++++++ 2 files changed, 363 insertions(+) create mode 100644 bindings/typescript/test/testgen/rlp_testgen.erl create mode 100644 bindings/typescript/test/testgen/rlptests.py diff --git a/bindings/typescript/test/testgen/rlp_testgen.erl b/bindings/typescript/test/testgen/rlp_testgen.erl new file mode 100644 index 0000000..59a5278 --- /dev/null +++ b/bindings/typescript/test/testgen/rlp_testgen.erl @@ -0,0 +1,177 @@ +%-module(rlp_testgen). +%-compile(export_all). + +-mode(compile). + +main([]) -> + % Decoded cases + DecodedCases = rand_decode_datas(100), + %io:format("~p~n", [DecodedCases]), + io:format("~s~n", [format_cases_py(DecodedCases)]), + ok. + +format_cases_py(Cases) -> + format_stringlist_py(lists:map(fun format_case_py/1, Cases)). + +% format a list of strings into a python list +format_stringlist_py(List) -> + [$[, slcommas(List, []), $]]. + +% similar to commas/2 below but for a list of the dictstrings +% adding a comma, a newline, and a space +% +% this one does no intrnal processing +% +% cases +% - list is empty -> special case +% - exactly one element -> special case +% - two or more elements -> peel off one at a time until terminal case of exactly one +% initial input empty, so return empty +slcommas([], []) -> + []; +% one item left, do not add comma +slcommas([Item], Acc) -> + [Acc, Item]; +% two or more items left, add comma +slcommas([Item | Rest], Acc) -> + slcommas(Rest, [Acc, Item, ",\n "]). + + + +% input: decoded_data +% format a case as +% {'decoded_data': , +% 'encoded_bytes': bytes([B1, B2, B3, ...])} +format_case_py(DecodedData_rlist) -> + % EncodedData_bytes = rlp:encode( + % DD_js = format_data_js(DecodedData_rlist), + EncodedData_bytes = rlp:encode(DecodedData_rlist), + EncodedBytes_py = format_bytes_py(EncodedData_bytes), + DecodedData_py = format_data_py(DecodedData_rlist), + % the extra space is intentional because of how we will do list formatting + ["{'decoded': ", DecodedData_py, ",\n", + " 'encoded': ", EncodedBytes_py, "}"]. + + + +format_data_py(List) when is_list(List) -> + format_list_py(List); +format_data_py(Bytes) when is_binary(Bytes) -> + format_bytes_py(Bytes). + +format_list_py(List) -> + [$[, lcommas(List, []), $]]. + +% similar to commas/2 below but for a list +% cases +% - list is empty -> special case +% - exactly one element -> special case +% - two or more elements -> peel off one at a time until terminal case of exactly one +% initial input empty, so return empty +lcommas([], []) -> + []; +% one item left, do not add comma +lcommas([Item], Acc) -> + [Acc, format_data_py(Item)]; +% two or more items left, add comma +lcommas([Item | Rest], Acc) -> + lcommas(Rest, [Acc, format_data_py(Item), ", "]). + + + +% format a bytestring as "bytes([Byte1, Byte2, ...])" +format_bytes_py(Bytes) -> + Commas = commas(Bytes, []), + ["bytes([", Commas, "])"]. + +% cases: +% - bytestring is empty -> special case +% - exactly one element -> special case +% - two or more elements -> peel off one at a time until terminal case of exactly two +% empty bytestring +commas(<<>>, []) -> + []; +% only one byte left, do not add comma +commas(<>, Acc) -> + [Acc, integer_to_list(B2)]; +% two or more bytes left: peel off one, add comma +commas(<>, Acc) -> + commas(Rest, [Acc, integer_to_list(B), ", "]). + + +% test that the inverse property is correct + +test_inverse() -> + % test stuff + DecodedCases = rand_decode_datas(20), + All = lists:all(% predicate + fun(X) -> X end, + % data + lists:map(fun(DecodedData) -> + CI = check_inverse(DecodedData), + ok = io:format("~p~n", [CI]), + CI + end, + DecodedCases)), + io:format("all: ~p~n", [All]), + ok. + + +check_inverse(DecodedData) -> + {DeEncodedData, <<>>} = rlp:decode(rlp:encode(DecodedData)), + DeEncodedData =:= DecodedData. + +%mkcase(DecodedData) -> +% Encoded = rlp:encode(DecodedData), +% {Deencoded, <<>>} = rlp:decode( +% %{decoded, DecodedData, +% % encoded, + +% check +% - encode is correct +% - decode is the inverse of decode + +% generate N-ish random decode datas +% no duplicates +rand_decode_datas(N) -> + % hack to remove duplicate cases + % this is good enough + sets:to_list(sets:from_list(rand_list(N))). + +% generate a list of random datas n items long +rand_list(N) -> + [rand_data() || _ <- lists:seq(1, N)]. + + +% generate a random bytestring or random list with 50% probability +rand_data() -> + MkList = rand:uniform() < 0.7, + case MkList of + true -> rand_list(); + false -> rand_bytes() + end. + + +% generate a random list of random length between 0 and 10, inclusive +rand_list() -> + % rand:uniform(N) is between 1 and N + NItems = rand:uniform(3) - 1, + rand_list(NItems). + + +% generate a random bytestring between 0 and 100 bytes long +rand_bytes() -> + %works + case rand:uniform() < 0.5 of + % either generate between 0 and 5 items or between 5 and 100 items + true -> + NItems = rand:uniform(6) - 1, + crypto:strong_rand_bytes(NItems); + false -> + % range between 1, 96, add 4 + NItems = (rand:uniform(96) + 4), + crypto:strong_rand_bytes(NItems) + end. + % syntax error: + % they look literally the same + %NItems = rand:uniform(11) - 1, crypto:strong_rand:bytes(NItems). diff --git a/bindings/typescript/test/testgen/rlptests.py b/bindings/typescript/test/testgen/rlptests.py new file mode 100644 index 0000000..32cb9b5 --- /dev/null +++ b/bindings/typescript/test/testgen/rlptests.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python3 + +''' +generate rlp tests + +really checking to see if my code matches the ethereum python rlp package which +has 85 stars on github +''' + +# need more cases +# single bytes +# empty list +# list with variable number of elements +# element has equal chance of becoming a list or a binary + +import rlp +import random as r + +cases = [ + {'decoded': [[[bytes([71]), [[[[], bytes([55, 134, 184, 44, 124, 131, 164, 150, 43, 211, 191, 7, 162, 108, 209, 205, 180, 111, 227, 40, 227, 72, 2, 160, 79, 249, 56, 165, 216, 87, 176, 166, 173, 116, 83, 152, 90, 109, 181, 36, 16, 105, 82, 210, 19, 133, 92, 246, 36, 78, 52, 215, 45, 226, 185, 130, 219, 174, 55, 18, 113, 101, 176, 123, 3, 148, 121, 173, 103, 45, 229, 206, 57, 208, 3, 76, 250, 72, 42, 228, 198, 38, 67, 66, 138, 130, 28, 155])], bytes([219, 254, 47, 211, 86, 76, 78, 133, 251, 106, 6, 68, 143, 14, 158, 148, 128, 253, 147, 207, 58, 243, 20, 204, 4, 249, 186, 72, 82, 159, 185, 160, 120, 39, 105, 115, 62, 220, 62, 158, 28, 99, 146, 166, 137, 21, 87, 190, 149, 198, 34, 99, 133, 129, 194, 48, 190, 241, 253, 163, 218, 141, 228, 42, 142, 56, 119, 46, 216, 152, 219, 31, 197, 50, 74, 73, 218, 148, 163, 26, 20, 253, 163, 160, 136, 246, 146, 124])], []]], [bytes([76, 186, 11, 224])]]], + 'encoded': bytes([248, 199, 248, 197, 248, 189, 71, 248, 186, 248, 183, 248, 91, 192, 184, 88, 55, 134, 184, 44, 124, 131, 164, 150, 43, 211, 191, 7, 162, 108, 209, 205, 180, 111, 227, 40, 227, 72, 2, 160, 79, 249, 56, 165, 216, 87, 176, 166, 173, 116, 83, 152, 90, 109, 181, 36, 16, 105, 82, 210, 19, 133, 92, 246, 36, 78, 52, 215, 45, 226, 185, 130, 219, 174, 55, 18, 113, 101, 176, 123, 3, 148, 121, 173, 103, 45, 229, 206, 57, 208, 3, 76, 250, 72, 42, 228, 198, 38, 67, 66, 138, 130, 28, 155, 184, 88, 219, 254, 47, 211, 86, 76, 78, 133, 251, 106, 6, 68, 143, 14, 158, 148, 128, 253, 147, 207, 58, 243, 20, 204, 4, 249, 186, 72, 82, 159, 185, 160, 120, 39, 105, 115, 62, 220, 62, 158, 28, 99, 146, 166, 137, 21, 87, 190, 149, 198, 34, 99, 133, 129, 194, 48, 190, 241, 253, 163, 218, 141, 228, 42, 142, 56, 119, 46, 216, 152, 219, 31, 197, 50, 74, 73, 218, 148, 163, 26, 20, 253, 163, 160, 136, 246, 146, 124, 192, 197, 132, 76, 186, 11, 224])}, + {'decoded': bytes([106, 153, 156]), + 'encoded': bytes([131, 106, 153, 156])}, + {'decoded': [[], bytes([69, 119])], + 'encoded': bytes([196, 192, 130, 69, 119])}, + {'decoded': bytes([]), + 'encoded': bytes([128])}, + {'decoded': [bytes([213, 235, 191, 39, 87, 252, 156, 10, 117, 249, 166, 248, 76, 116, 25, 216, 66, 152, 37, 153, 233, 89, 79, 50, 151, 102, 114, 205, 65, 127, 236, 236, 197, 47, 76, 138, 249, 33, 254, 200, 99, 124, 228, 251, 223, 145, 253, 53, 108, 158, 127, 108, 12, 148, 225, 47, 233, 16, 115, 167, 162, 57, 191, 166, 141])], + 'encoded': bytes([248, 67, 184, 65, 213, 235, 191, 39, 87, 252, 156, 10, 117, 249, 166, 248, 76, 116, 25, 216, 66, 152, 37, 153, 233, 89, 79, 50, 151, 102, 114, 205, 65, 127, 236, 236, 197, 47, 76, 138, 249, 33, 254, 200, 99, 124, 228, 251, 223, 145, 253, 53, 108, 158, 127, 108, 12, 148, 225, 47, 233, 16, 115, 167, 162, 57, 191, 166, 141])}, + {'decoded': bytes([74, 71, 198, 179, 162, 206, 153, 49, 222, 64, 65, 177, 207, 219, 154, 184, 250, 29, 71, 76, 87, 10, 235, 88, 35, 37, 230, 152, 65, 210, 64, 231, 90, 92, 77, 100, 139, 153, 166, 168, 70, 169, 25, 70, 137, 103, 65, 173, 150, 212, 123, 144, 199, 118, 146, 204, 186, 189, 151, 189, 252, 100, 111, 13, 96, 175, 129, 234, 97, 161, 123, 10, 235, 141, 178, 234, 107, 157, 106, 36, 57, 147, 139, 12, 230, 143, 214]), + 'encoded': bytes([184, 87, 74, 71, 198, 179, 162, 206, 153, 49, 222, 64, 65, 177, 207, 219, 154, 184, 250, 29, 71, 76, 87, 10, 235, 88, 35, 37, 230, 152, 65, 210, 64, 231, 90, 92, 77, 100, 139, 153, 166, 168, 70, 169, 25, 70, 137, 103, 65, 173, 150, 212, 123, 144, 199, 118, 146, 204, 186, 189, 151, 189, 252, 100, 111, 13, 96, 175, 129, 234, 97, 161, 123, 10, 235, 141, 178, 234, 107, 157, 106, 36, 57, 147, 139, 12, 230, 143, 214])}, + {'decoded': bytes([79, 212, 19, 50, 170, 48, 142, 83, 221, 129, 251, 19, 238, 17, 83, 92, 99, 12, 212, 80, 74, 3, 74, 214, 246, 100, 225, 41, 186, 252, 101, 236, 83, 6, 243, 107, 244, 134, 186, 33, 219, 197, 222, 167, 149, 176, 109, 127]), + 'encoded': bytes([176, 79, 212, 19, 50, 170, 48, 142, 83, 221, 129, 251, 19, 238, 17, 83, 92, 99, 12, 212, 80, 74, 3, 74, 214, 246, 100, 225, 41, 186, 252, 101, 236, 83, 6, 243, 107, 244, 134, 186, 33, 219, 197, 222, 167, 149, 176, 109, 127])}, + {'decoded': [], + 'encoded': bytes([192])}, + {'decoded': [bytes([171, 165, 226, 80, 42, 15, 169, 4, 39, 124, 223, 240, 67, 30, 49, 248, 193, 181, 17, 169, 172, 233, 104, 50, 226, 22, 206, 170, 162, 129, 106, 211, 33, 168, 1, 237, 1, 113, 208, 157, 225, 140, 205, 15, 58, 244, 158, 20, 255, 177, 27, 73, 227, 36, 82, 138, 205, 204, 98, 238, 124, 73, 30, 222, 150, 137, 104, 121, 113, 36, 234, 119, 146, 95, 145, 223, 15, 5, 252, 133, 84, 11, 100, 227, 209, 69, 15, 119, 212, 220, 93, 251, 134, 228]), []], + 'encoded': bytes([248, 97, 184, 94, 171, 165, 226, 80, 42, 15, 169, 4, 39, 124, 223, 240, 67, 30, 49, 248, 193, 181, 17, 169, 172, 233, 104, 50, 226, 22, 206, 170, 162, 129, 106, 211, 33, 168, 1, 237, 1, 113, 208, 157, 225, 140, 205, 15, 58, 244, 158, 20, 255, 177, 27, 73, 227, 36, 82, 138, 205, 204, 98, 238, 124, 73, 30, 222, 150, 137, 104, 121, 113, 36, 234, 119, 146, 95, 145, 223, 15, 5, 252, 133, 84, 11, 100, 227, 209, 69, 15, 119, 212, 220, 93, 251, 134, 228, 192])}, + {'decoded': [bytes([250, 139, 236, 26, 232, 6, 209, 174, 63, 97, 12, 86, 5, 119, 3]), [[]]], + 'encoded': bytes([210, 143, 250, 139, 236, 26, 232, 6, 209, 174, 63, 97, 12, 86, 5, 119, 3, 193, 192])}, + {'decoded': bytes([141, 254, 178, 122, 219, 59, 38, 85, 234, 241, 131, 163, 190, 109, 212, 168, 248, 230, 183, 196, 61, 51, 254, 236, 42, 51, 223, 199, 175, 196, 202, 233, 8, 176, 32, 126, 82, 253, 71, 117, 172, 70, 138, 166, 114, 211, 32, 81]), + 'encoded': bytes([176, 141, 254, 178, 122, 219, 59, 38, 85, 234, 241, 131, 163, 190, 109, 212, 168, 248, 230, 183, 196, 61, 51, 254, 236, 42, 51, 223, 199, 175, 196, 202, 233, 8, 176, 32, 126, 82, 253, 71, 117, 172, 70, 138, 166, 114, 211, 32, 81])}, + {'decoded': [[[[bytes([49]), bytes([131, 149, 232, 115, 175, 33, 47, 144, 240, 74, 119, 102, 13, 180, 44, 218, 20, 93, 101, 19, 184, 7, 131, 160, 49, 193, 45, 234, 233, 159, 226, 18, 33, 128, 43, 115, 5, 159, 224, 8, 218, 87, 181, 50, 46, 46, 236, 112, 100, 186])]]], []], + 'encoded': bytes([248, 56, 246, 245, 244, 49, 178, 131, 149, 232, 115, 175, 33, 47, 144, 240, 74, 119, 102, 13, 180, 44, 218, 20, 93, 101, 19, 184, 7, 131, 160, 49, 193, 45, 234, 233, 159, 226, 18, 33, 128, 43, 115, 5, 159, 224, 8, 218, 87, 181, 50, 46, 46, 236, 112, 100, 186, 192])}, + {'decoded': [[], bytes([253, 1])], + 'encoded': bytes([196, 192, 130, 253, 1])}, + {'decoded': bytes([254, 66, 247, 245, 144, 30, 199, 111, 194, 177, 244, 20, 161, 4, 204, 246, 129, 3, 221, 182, 30, 138, 199, 212, 232, 249, 213, 86, 162, 83, 133, 164, 253, 200, 5, 128, 248, 245, 93, 91, 254, 2, 67, 76, 18, 179, 129, 197, 197, 51, 242, 149, 229, 221, 139, 105, 163, 68, 37, 74, 115, 188, 8, 55, 46, 187, 17, 172, 15, 213, 20, 95, 199, 124, 11]), + 'encoded': bytes([184, 75, 254, 66, 247, 245, 144, 30, 199, 111, 194, 177, 244, 20, 161, 4, 204, 246, 129, 3, 221, 182, 30, 138, 199, 212, 232, 249, 213, 86, 162, 83, 133, 164, 253, 200, 5, 128, 248, 245, 93, 91, 254, 2, 67, 76, 18, 179, 129, 197, 197, 51, 242, 149, 229, 221, 139, 105, 163, 68, 37, 74, 115, 188, 8, 55, 46, 187, 17, 172, 15, 213, 20, 95, 199, 124, 11])}, + {'decoded': bytes([26, 76, 172, 49, 100, 57, 29, 92, 103, 148, 30, 120, 115, 70, 123, 218, 90, 34, 211, 225, 169, 126, 139, 15, 203, 245, 94, 159, 181, 244, 174, 222, 182, 73, 192, 77, 13, 160, 71, 139, 201, 71, 202, 214, 93, 166, 33, 128, 224, 70, 15, 86, 126, 159, 174, 51, 247, 108, 99, 240, 201, 6, 239]), + 'encoded': bytes([184, 63, 26, 76, 172, 49, 100, 57, 29, 92, 103, 148, 30, 120, 115, 70, 123, 218, 90, 34, 211, 225, 169, 126, 139, 15, 203, 245, 94, 159, 181, 244, 174, 222, 182, 73, 192, 77, 13, 160, 71, 139, 201, 71, 202, 214, 93, 166, 33, 128, 224, 70, 15, 86, 126, 159, 174, 51, 247, 108, 99, 240, 201, 6, 239])}, + {'decoded': [[], [[[bytes([250, 81, 219, 116, 26, 31, 44, 81, 74, 76, 103, 219, 17, 60, 191, 114, 227, 140, 118, 223, 163, 57, 89, 156, 106, 140, 144, 105, 249, 134, 215, 214, 92])], [[[], bytes([252, 233, 77, 191, 226, 55, 224, 109, 174, 68, 5, 246, 221, 93, 135, 188, 125, 10, 103, 133, 147, 157, 251, 14, 174, 173, 123, 138, 38, 4, 29, 68, 41, 67, 69, 94, 239, 29, 54, 2, 68, 254, 163, 91, 219, 172, 182, 202, 77, 145, 122, 210, 230, 186, 72, 132, 124, 148, 194, 169, 200, 128, 71, 181, 167, 81, 10, 192, 76, 12, 165, 120, 150, 179, 15, 53, 71, 221, 229])], [[bytes([93, 144])], bytes([133, 220, 127, 202, 99, 133, 230, 36, 183, 211, 149, 140, 4, 230, 252, 205, 43])]]], []]], + 'encoded': bytes([248, 150, 192, 248, 147, 248, 144, 226, 161, 250, 81, 219, 116, 26, 31, 44, 81, 74, 76, 103, 219, 17, 60, 191, 114, 227, 140, 118, 223, 163, 57, 89, 156, 106, 140, 144, 105, 249, 134, 215, 214, 92, 248, 107, 248, 82, 192, 184, 79, 252, 233, 77, 191, 226, 55, 224, 109, 174, 68, 5, 246, 221, 93, 135, 188, 125, 10, 103, 133, 147, 157, 251, 14, 174, 173, 123, 138, 38, 4, 29, 68, 41, 67, 69, 94, 239, 29, 54, 2, 68, 254, 163, 91, 219, 172, 182, 202, 77, 145, 122, 210, 230, 186, 72, 132, 124, 148, 194, 169, 200, 128, 71, 181, 167, 81, 10, 192, 76, 12, 165, 120, 150, 179, 15, 53, 71, 221, 229, 214, 195, 130, 93, 144, 145, 133, 220, 127, 202, 99, 133, 230, 36, 183, 211, 149, 140, 4, 230, 252, 205, 43, 192])}, + {'decoded': bytes([164, 38, 0, 4]), + 'encoded': bytes([132, 164, 38, 0, 4])}, + {'decoded': bytes([176, 216, 186, 39, 140, 214, 197, 94, 166, 148, 124, 178, 134, 169, 65, 226, 78, 92, 68, 213, 228, 22, 140, 7, 126, 17, 120, 251, 92, 16, 43, 76, 3, 36, 133, 173, 193, 153, 25, 165, 178, 206, 148, 116, 38, 171, 0, 198, 252, 40, 181, 240, 216]), + 'encoded': bytes([181, 176, 216, 186, 39, 140, 214, 197, 94, 166, 148, 124, 178, 134, 169, 65, 226, 78, 92, 68, 213, 228, 22, 140, 7, 126, 17, 120, 251, 92, 16, 43, 76, 3, 36, 133, 173, 193, 153, 25, 165, 178, 206, 148, 116, 38, 171, 0, 198, 252, 40, 181, 240, 216])}, + {'decoded': [[[[[], []], [[[bytes([62]), [[], bytes([247, 149])]]], []]]]], + 'encoded': bytes([207, 206, 205, 194, 192, 192, 201, 199, 198, 62, 196, 192, 130, 247, 149, 192])}, + {'decoded': [[bytes([240, 175, 29, 78, 34, 24, 198, 95, 83, 140, 42, 26, 174, 187, 106, 133, 247, 125, 251, 90, 135, 152, 151, 249, 132, 95, 208, 108, 132, 213, 185, 140, 15, 81, 68, 148, 70, 75, 169, 193, 76, 101, 163, 74, 91, 121, 197, 104, 149, 89, 85, 170, 8, 40, 202, 198, 16, 240, 30, 254, 155, 72, 181, 147, 68, 25, 11, 188, 229, 90, 71, 27, 159, 189, 57, 163, 103, 145, 3, 247, 202, 2, 253, 190])], [[], [[[[], []]], [[], bytes([85, 102, 15])]]]], + 'encoded': bytes([248, 101, 248, 86, 184, 84, 240, 175, 29, 78, 34, 24, 198, 95, 83, 140, 42, 26, 174, 187, 106, 133, 247, 125, 251, 90, 135, 152, 151, 249, 132, 95, 208, 108, 132, 213, 185, 140, 15, 81, 68, 148, 70, 75, 169, 193, 76, 101, 163, 74, 91, 121, 197, 104, 149, 89, 85, 170, 8, 40, 202, 198, 16, 240, 30, 254, 155, 72, 181, 147, 68, 25, 11, 188, 229, 90, 71, 27, 159, 189, 57, 163, 103, 145, 3, 247, 202, 2, 253, 190, 204, 192, 202, 195, 194, 192, 192, 197, 192, 131, 85, 102, 15])}, + {'decoded': bytes([252, 207, 186, 194]), + 'encoded': bytes([132, 252, 207, 186, 194])}, + {'decoded': [[[[[[bytes([218, 54, 83, 59]), bytes([176, 178, 151, 212])], [bytes([116, 165, 49, 0, 148, 0, 72, 228, 175, 212, 169, 156, 146, 79, 32, 138, 127, 11, 9, 39, 152, 220])]]]]]], + 'encoded': bytes([231, 230, 229, 228, 227, 202, 132, 218, 54, 83, 59, 132, 176, 178, 151, 212, 215, 150, 116, 165, 49, 0, 148, 0, 72, 228, 175, 212, 169, 156, 146, 79, 32, 138, 127, 11, 9, 39, 152, 220])}, + {'decoded': bytes([152, 131, 149, 38, 35]), + 'encoded': bytes([133, 152, 131, 149, 38, 35])}, + {'decoded': bytes([231, 47, 74, 215, 130, 175]), + 'encoded': bytes([134, 231, 47, 74, 215, 130, 175])}, + {'decoded': bytes([5, 168, 64, 49]), + 'encoded': bytes([132, 5, 168, 64, 49])}, + {'decoded': bytes([4, 47, 24, 36, 196, 1, 39, 111, 228, 82, 196, 233, 17, 219, 170, 186, 228, 222, 12, 139, 66, 222, 214, 223, 1, 8, 217, 89, 241, 52, 206, 229, 185, 134, 100, 161, 72, 84, 37, 98, 10, 221, 76, 204, 68, 22, 160, 12, 208, 77, 116, 50, 9, 229, 79, 101, 209, 189, 98, 26, 5, 1, 232, 249, 77, 58, 65, 230, 72, 94, 36, 30, 145, 60, 22, 204, 84, 203, 199, 122, 243, 99, 13, 105, 193, 35, 247, 47, 41, 203, 228, 13, 160]), + 'encoded': bytes([184, 93, 4, 47, 24, 36, 196, 1, 39, 111, 228, 82, 196, 233, 17, 219, 170, 186, 228, 222, 12, 139, 66, 222, 214, 223, 1, 8, 217, 89, 241, 52, 206, 229, 185, 134, 100, 161, 72, 84, 37, 98, 10, 221, 76, 204, 68, 22, 160, 12, 208, 77, 116, 50, 9, 229, 79, 101, 209, 189, 98, 26, 5, 1, 232, 249, 77, 58, 65, 230, 72, 94, 36, 30, 145, 60, 22, 204, 84, 203, 199, 122, 243, 99, 13, 105, 193, 35, 247, 47, 41, 203, 228, 13, 160])}, + {'decoded': [bytes([116, 126, 2, 22, 144, 94, 163, 105, 38, 74, 120, 185, 86, 74, 139, 60, 63, 99, 114, 35, 223, 205, 152, 125, 255, 6, 162, 93, 3, 112, 12, 85, 211, 243, 195, 63, 255, 202, 233, 237, 55, 207, 124, 106, 249, 120, 153, 115, 128, 163, 122, 136, 209, 141]), [[[[[[[], [[]]]]], []], []], bytes([155])]], + 'encoded': bytes([248, 68, 182, 116, 126, 2, 22, 144, 94, 163, 105, 38, 74, 120, 185, 86, 74, 139, 60, 63, 99, 114, 35, 223, 205, 152, 125, 255, 6, 162, 93, 3, 112, 12, 85, 211, 243, 195, 63, 255, 202, 233, 237, 55, 207, 124, 106, 249, 120, 153, 115, 128, 163, 122, 136, 209, 141, 204, 201, 199, 197, 196, 195, 192, 193, 192, 192, 192, 129, 155])}, + {'decoded': bytes([26, 37, 212, 186, 124, 7, 106, 226, 237, 49, 106, 231, 137, 15, 120, 232, 2, 111, 168, 253, 0, 251, 61, 107, 98, 80, 202]), + 'encoded': bytes([155, 26, 37, 212, 186, 124, 7, 106, 226, 237, 49, 106, 231, 137, 15, 120, 232, 2, 111, 168, 253, 0, 251, 61, 107, 98, 80, 202])}, + {'decoded': bytes([8, 195, 187, 249, 232, 67, 0, 105, 205, 124, 169, 79, 57, 182, 177, 25, 135, 158, 106, 47, 74, 36, 239, 227, 66, 149, 26, 205, 95, 32, 238, 108, 64, 29, 94, 72, 119, 184, 169, 96, 70, 71, 52, 105, 245, 63, 225, 233, 253, 228, 219, 151, 22, 241, 41, 182, 43, 132, 227, 35, 77, 128, 55, 185, 252, 50, 57, 215, 91, 195, 154, 19, 38, 190, 216, 203, 26, 248, 15, 10, 22, 245, 240, 47, 155, 66, 242, 154, 79, 186, 221]), + 'encoded': bytes([184, 91, 8, 195, 187, 249, 232, 67, 0, 105, 205, 124, 169, 79, 57, 182, 177, 25, 135, 158, 106, 47, 74, 36, 239, 227, 66, 149, 26, 205, 95, 32, 238, 108, 64, 29, 94, 72, 119, 184, 169, 96, 70, 71, 52, 105, 245, 63, 225, 233, 253, 228, 219, 151, 22, 241, 41, 182, 43, 132, 227, 35, 77, 128, 55, 185, 252, 50, 57, 215, 91, 195, 154, 19, 38, 190, 216, 203, 26, 248, 15, 10, 22, 245, 240, 47, 155, 66, 242, 154, 79, 186, 221])}, + {'decoded': [bytes([81, 127, 240, 7, 3, 164, 101, 173, 251, 190, 76, 14, 219, 11, 179, 251, 12, 107, 114, 27, 113, 139, 1, 90, 22, 105, 222, 8, 103, 6, 64, 99, 85, 205, 13, 60, 132, 216, 125, 35, 169, 180, 93, 137, 115, 193, 134, 168, 54, 208, 113, 209, 243, 228, 179, 167, 75, 11, 225, 127, 181, 2, 221, 177, 162, 79, 84, 239, 189, 5, 5, 183, 253, 111, 135, 7, 9, 143, 236, 81, 199, 221, 96, 198, 73, 255, 10, 88, 159, 10, 81, 129, 133, 109, 204])], + 'encoded': bytes([248, 97, 184, 95, 81, 127, 240, 7, 3, 164, 101, 173, 251, 190, 76, 14, 219, 11, 179, 251, 12, 107, 114, 27, 113, 139, 1, 90, 22, 105, 222, 8, 103, 6, 64, 99, 85, 205, 13, 60, 132, 216, 125, 35, 169, 180, 93, 137, 115, 193, 134, 168, 54, 208, 113, 209, 243, 228, 179, 167, 75, 11, 225, 127, 181, 2, 221, 177, 162, 79, 84, 239, 189, 5, 5, 183, 253, 111, 135, 7, 9, 143, 236, 81, 199, 221, 96, 198, 73, 255, 10, 88, 159, 10, 81, 129, 133, 109, 204])}, + {'decoded': [[bytes([218, 143, 185])]], + 'encoded': bytes([197, 196, 131, 218, 143, 185])}, + {'decoded': bytes([141, 227, 32, 118, 148, 44, 2, 3, 145, 53, 251, 131, 110, 1, 24, 41, 70, 124, 49, 91, 237, 217, 253, 108, 44, 65, 233, 234, 120, 72, 105, 136, 127, 121, 241, 57, 46, 136, 246, 50, 75, 44, 31, 87, 31, 195, 209, 5, 255, 191, 4, 12, 150, 202, 172]), + 'encoded': bytes([183, 141, 227, 32, 118, 148, 44, 2, 3, 145, 53, 251, 131, 110, 1, 24, 41, 70, 124, 49, 91, 237, 217, 253, 108, 44, 65, 233, 234, 120, 72, 105, 136, 127, 121, 241, 57, 46, 136, 246, 50, 75, 44, 31, 87, 31, 195, 209, 5, 255, 191, 4, 12, 150, 202, 172])}, + {'decoded': bytes([185, 46, 174, 65, 25, 104, 150, 226, 115, 149, 132, 127, 199, 185, 142, 93]), + 'encoded': bytes([144, 185, 46, 174, 65, 25, 104, 150, 226, 115, 149, 132, 127, 199, 185, 142, 93])}, + {'decoded': bytes([241, 207, 60, 53, 78, 65, 119, 14, 49, 121, 199, 135, 241, 250, 167, 65, 227, 54, 87, 109, 61, 21, 69, 68, 124, 12, 30, 212, 19, 195, 58, 25, 237, 188, 232, 119, 18, 171]), + 'encoded': bytes([166, 241, 207, 60, 53, 78, 65, 119, 14, 49, 121, 199, 135, 241, 250, 167, 65, 227, 54, 87, 109, 61, 21, 69, 68, 124, 12, 30, 212, 19, 195, 58, 25, 237, 188, 232, 119, 18, 171])}, + {'decoded': bytes([103, 232, 119, 32]), + 'encoded': bytes([132, 103, 232, 119, 32])}, + {'decoded': [bytes([])], + 'encoded': bytes([193, 128])}, + {'decoded': [[[bytes([8, 52])], bytes([194, 65, 164, 168, 199, 88, 168, 27, 217, 196, 119, 189, 205, 18, 51, 10, 211, 191, 23, 143, 65, 151, 15, 20, 93, 150, 55, 173, 27, 173, 145, 81, 112, 112, 15, 96, 201, 38, 204, 52, 158, 141, 34, 141, 247, 62, 252, 54, 46, 95, 106, 207, 110, 89, 203, 252, 208, 80, 173, 252, 242, 90, 191, 119, 158, 218, 149, 191, 209, 141, 208, 81, 22, 213, 73, 21, 126, 50, 28, 79, 166, 27, 203, 193, 28, 129, 133, 142, 176, 225, 93])], [[[[], [bytes([250]), [[bytes([]), [[bytes([56, 28, 67, 135])], [[]]]], []]]], bytes([10, 31, 108])], []]], + 'encoded': bytes([248, 124, 248, 97, 195, 130, 8, 52, 184, 91, 194, 65, 164, 168, 199, 88, 168, 27, 217, 196, 119, 189, 205, 18, 51, 10, 211, 191, 23, 143, 65, 151, 15, 20, 93, 150, 55, 173, 27, 173, 145, 81, 112, 112, 15, 96, 201, 38, 204, 52, 158, 141, 34, 141, 247, 62, 252, 54, 46, 95, 106, 207, 110, 89, 203, 252, 208, 80, 173, 252, 242, 90, 191, 119, 158, 218, 149, 191, 209, 141, 208, 81, 22, 213, 73, 21, 126, 50, 28, 79, 166, 27, 203, 193, 28, 129, 133, 142, 176, 225, 93, 216, 214, 209, 192, 207, 129, 250, 204, 202, 128, 200, 197, 132, 56, 28, 67, 135, 193, 192, 192, 131, 10, 31, 108, 192])}, + {'decoded': bytes([179, 131, 248, 203, 75, 114, 244, 207, 146, 186, 49, 193, 132, 250, 13, 106, 243, 113, 50, 153, 214, 82, 178, 96, 142, 174, 30, 245, 144, 218, 248, 28]), + 'encoded': bytes([160, 179, 131, 248, 203, 75, 114, 244, 207, 146, 186, 49, 193, 132, 250, 13, 106, 243, 113, 50, 153, 214, 82, 178, 96, 142, 174, 30, 245, 144, 218, 248, 28])}, + {'decoded': bytes([111, 3, 82, 158, 93, 105, 133, 90, 147, 133, 228, 222, 130, 123, 169, 113, 129, 55, 220, 36, 135, 118, 19, 23, 5, 95, 45, 12, 159, 254, 30, 229, 142, 48, 83, 160, 241, 245, 122, 188, 18, 24, 149, 36, 183, 8, 118, 170, 21, 64, 85, 21, 164, 184, 168, 172, 66, 82, 144, 117, 50, 180, 139, 99, 19, 79, 13, 14]), + 'encoded': bytes([184, 68, 111, 3, 82, 158, 93, 105, 133, 90, 147, 133, 228, 222, 130, 123, 169, 113, 129, 55, 220, 36, 135, 118, 19, 23, 5, 95, 45, 12, 159, 254, 30, 229, 142, 48, 83, 160, 241, 245, 122, 188, 18, 24, 149, 36, 183, 8, 118, 170, 21, 64, 85, 21, 164, 184, 168, 172, 66, 82, 144, 117, 50, 180, 139, 99, 19, 79, 13, 14])}, + {'decoded': [[[[bytes([129])], bytes([245, 18, 81, 17])], [[[bytes([242, 231])]], []]]], + 'encoded': bytes([209, 208, 200, 194, 129, 129, 132, 245, 18, 81, 17, 198, 196, 195, 130, 242, 231, 192])}, + {'decoded': [[[[], []], bytes([])], bytes([76, 34, 82, 95, 210, 104, 151, 235, 227, 204, 153, 190, 187, 231, 245, 239, 70, 7, 85, 79, 161, 152, 182, 124, 26, 15, 191, 129, 81, 203, 110, 228, 175, 44, 204, 229, 48, 203, 94, 213, 138, 210, 62, 238, 170, 1, 43, 247, 45, 12, 57, 233, 175, 31, 12, 240, 43, 127, 155, 99, 122, 208, 238, 214, 154, 90, 17, 138, 253, 38, 145, 227])], + 'encoded': bytes([248, 79, 196, 194, 192, 192, 128, 184, 72, 76, 34, 82, 95, 210, 104, 151, 235, 227, 204, 153, 190, 187, 231, 245, 239, 70, 7, 85, 79, 161, 152, 182, 124, 26, 15, 191, 129, 81, 203, 110, 228, 175, 44, 204, 229, 48, 203, 94, 213, 138, 210, 62, 238, 170, 1, 43, 247, 45, 12, 57, 233, 175, 31, 12, 240, 43, 127, 155, 99, 122, 208, 238, 214, 154, 90, 17, 138, 253, 38, 145, 227])}, + {'decoded': [[[[[[[], [bytes([184, 221, 195]), [[bytes([64, 126, 35, 239, 175]), []], [[[bytes([156, 26, 184, 159, 101, 217, 109, 77, 134, 126, 33, 124, 213, 143, 63, 93, 76, 240, 84, 35, 150, 160, 91, 166, 62, 248, 38, 39, 226, 96, 221, 80, 172, 70, 228, 12, 139, 30, 22, 111, 150, 10, 206, 125, 74, 112, 159, 186, 140, 90, 16, 240, 226, 181, 82, 205, 77, 195, 51])], [[[[bytes([])], bytes([2, 139, 207, 56, 82, 43, 115, 23, 145, 240, 251, 70, 152, 94, 97, 123, 18, 105, 170, 169, 171, 18, 213, 12, 51, 237, 227, 109, 41, 243, 194, 91, 131, 237, 123, 84, 225, 147, 46, 247, 194, 143, 127, 138, 15, 22, 87, 244, 38, 30, 46, 247, 128, 71, 176, 2, 128, 165, 4, 176, 16, 70, 150, 55, 231, 200, 213, 1, 143, 9, 105, 16, 24, 207, 164, 32, 109, 5, 41, 3, 188, 231, 227, 103, 200, 82, 145, 232, 173, 106, 167, 191, 46])], [[], bytes([105, 24, 62, 60, 253, 5, 6, 81, 94, 162, 73, 58, 137, 140, 225, 122, 12, 255, 205, 63, 219, 220, 66, 65, 16, 138, 237, 174, 149, 216, 186, 187, 16, 143, 1, 228, 225, 157, 37, 21, 47, 227, 84, 20, 154, 119, 154, 185, 190, 48, 109, 67, 201, 0, 108, 46, 134, 109, 252, 128, 24, 12, 158, 138, 159, 39, 138, 160, 226, 168, 14, 130, 198, 191])]], []]], [[[[[bytes([4, 6, 34, 213, 91, 217, 196, 203, 143, 24, 174, 29, 25, 228, 214, 222, 46, 97, 246, 238, 210, 215, 91, 150, 202, 45, 14, 19, 111, 136, 110, 165, 206, 242, 15, 210, 158, 56, 46, 9, 185, 132, 162, 237, 175, 138, 157, 132, 25, 236, 151, 244, 218, 255, 89, 161, 138, 66, 185, 202, 188, 138, 219, 56, 230, 126, 252, 42, 43, 74, 67, 152, 178, 220, 175, 238, 239, 88, 160, 83, 177, 17, 117, 67, 92])]]]], bytes([251, 123, 169, 188, 112, 255, 159, 218, 103, 71, 20, 92, 228, 70, 99, 139, 70, 119, 205, 250, 141, 200, 179, 222, 92, 116, 224, 45, 139, 213, 173, 254, 198, 39, 162, 134, 156, 42, 171, 180, 189, 88, 198, 64])]]]]], bytes([158, 227, 113, 149])]], []]], bytes([245, 80, 197, 28, 9, 87, 48, 148, 163, 154, 246, 36, 25, 154, 112, 211, 251, 100, 132, 129, 123, 190, 179, 185, 117, 220, 145, 59, 176, 90, 16, 115, 184, 116, 129, 244, 240, 234, 255, 192, 166, 182, 65, 168, 149, 12, 93, 199, 252, 101, 91, 173, 214, 251, 107, 206, 57, 58, 89, 46, 218, 82, 78, 73, 115, 145, 175, 202, 24, 98, 7, 254, 111])], + 'encoded': bytes([249, 1, 252, 249, 1, 174, 249, 1, 171, 249, 1, 167, 249, 1, 164, 249, 1, 156, 192, 249, 1, 152, 131, 184, 221, 195, 249, 1, 145, 199, 133, 64, 126, 35, 239, 175, 192, 249, 1, 134, 248, 246, 248, 61, 184, 59, 156, 26, 184, 159, 101, 217, 109, 77, 134, 126, 33, 124, 213, 143, 63, 93, 76, 240, 84, 35, 150, 160, 91, 166, 62, 248, 38, 39, 226, 96, 221, 80, 172, 70, 228, 12, 139, 30, 22, 111, 150, 10, 206, 125, 74, 112, 159, 186, 140, 90, 16, 240, 226, 181, 82, 205, 77, 195, 51, 248, 181, 248, 178, 248, 97, 193, 128, 184, 93, 2, 139, 207, 56, 82, 43, 115, 23, 145, 240, 251, 70, 152, 94, 97, 123, 18, 105, 170, 169, 171, 18, 213, 12, 51, 237, 227, 109, 41, 243, 194, 91, 131, 237, 123, 84, 225, 147, 46, 247, 194, 143, 127, 138, 15, 22, 87, 244, 38, 30, 46, 247, 128, 71, 176, 2, 128, 165, 4, 176, 16, 70, 150, 55, 231, 200, 213, 1, 143, 9, 105, 16, 24, 207, 164, 32, 109, 5, 41, 3, 188, 231, 227, 103, 200, 82, 145, 232, 173, 106, 167, 191, 46, 248, 77, 192, 184, 74, 105, 24, 62, 60, 253, 5, 6, 81, 94, 162, 73, 58, 137, 140, 225, 122, 12, 255, 205, 63, 219, 220, 66, 65, 16, 138, 237, 174, 149, 216, 186, 187, 16, 143, 1, 228, 225, 157, 37, 21, 47, 227, 84, 20, 154, 119, 154, 185, 190, 48, 109, 67, 201, 0, 108, 46, 134, 109, 252, 128, 24, 12, 158, 138, 159, 39, 138, 160, 226, 168, 14, 130, 198, 191, 192, 248, 140, 248, 93, 248, 91, 248, 89, 248, 87, 184, 85, 4, 6, 34, 213, 91, 217, 196, 203, 143, 24, 174, 29, 25, 228, 214, 222, 46, 97, 246, 238, 210, 215, 91, 150, 202, 45, 14, 19, 111, 136, 110, 165, 206, 242, 15, 210, 158, 56, 46, 9, 185, 132, 162, 237, 175, 138, 157, 132, 25, 236, 151, 244, 218, 255, 89, 161, 138, 66, 185, 202, 188, 138, 219, 56, 230, 126, 252, 42, 43, 74, 67, 152, 178, 220, 175, 238, 239, 88, 160, 83, 177, 17, 117, 67, 92, 172, 251, 123, 169, 188, 112, 255, 159, 218, 103, 71, 20, 92, 228, 70, 99, 139, 70, 119, 205, 250, 141, 200, 179, 222, 92, 116, 224, 45, 139, 213, 173, 254, 198, 39, 162, 134, 156, 42, 171, 180, 189, 88, 198, 64, 132, 158, 227, 113, 149, 192, 184, 73, 245, 80, 197, 28, 9, 87, 48, 148, 163, 154, 246, 36, 25, 154, 112, 211, 251, 100, 132, 129, 123, 190, 179, 185, 117, 220, 145, 59, 176, 90, 16, 115, 184, 116, 129, 244, 240, 234, 255, 192, 166, 182, 65, 168, 149, 12, 93, 199, 252, 101, 91, 173, 214, 251, 107, 206, 57, 58, 89, 46, 218, 82, 78, 73, 115, 145, 175, 202, 24, 98, 7, 254, 111])}, + {'decoded': [bytes([117, 97, 8, 201, 126, 198, 137, 31, 59, 112, 171, 53, 228, 11, 111, 23, 144, 194, 92, 198, 36, 201, 63, 235, 151, 230, 254, 26, 94, 163, 8, 230, 95, 171, 58, 191, 116, 145, 181, 79, 171, 224, 215, 249, 143, 135, 149, 122, 45, 222, 35, 51, 52, 217, 60, 123, 40, 193, 157])], + 'encoded': bytes([248, 61, 184, 59, 117, 97, 8, 201, 126, 198, 137, 31, 59, 112, 171, 53, 228, 11, 111, 23, 144, 194, 92, 198, 36, 201, 63, 235, 151, 230, 254, 26, 94, 163, 8, 230, 95, 171, 58, 191, 116, 145, 181, 79, 171, 224, 215, 249, 143, 135, 149, 122, 45, 222, 35, 51, 52, 217, 60, 123, 40, 193, 157])}, + {'decoded': bytes([21, 3, 219, 74, 143, 12, 144, 152, 166, 1, 128, 221, 102, 126, 106, 146, 141, 238, 83, 249, 27, 109, 107, 149, 252, 66, 217]), + 'encoded': bytes([155, 21, 3, 219, 74, 143, 12, 144, 152, 166, 1, 128, 221, 102, 126, 106, 146, 141, 238, 83, 249, 27, 109, 107, 149, 252, 66, 217])}, + {'decoded': [bytes([152, 9, 223, 120])], + 'encoded': bytes([197, 132, 152, 9, 223, 120])}, + {'decoded': [[[[], [[[[[[[], [bytes([]), [[[[[[[[[[[[]], bytes([221, 197, 79, 196, 140, 144, 164, 143, 146, 176, 218, 69, 87, 167, 65, 237, 149, 151, 99, 141, 238, 27, 109, 35, 30, 98, 4, 12, 217, 249, 191, 223, 216, 213, 122, 58, 123, 165, 237, 197, 251, 61, 140, 155, 226, 44, 202, 130, 74, 194, 193, 80, 15, 12, 37, 245, 255, 204, 121, 18, 7, 13, 83, 14, 62, 176, 249, 47, 200, 219, 171, 108, 165])], [bytes([182, 115, 145, 45, 109, 173, 135, 19, 135, 233, 171, 92, 120, 47, 125, 58, 178, 63, 162, 93, 29, 44, 123, 64, 244, 189, 129, 160, 212, 80, 138, 86, 160, 44, 53, 2, 20, 221, 140, 253, 251, 148, 225, 144, 64, 112, 14, 67, 177, 31, 104, 7, 107, 149, 52, 208, 209, 206, 149, 246, 126, 196, 136, 109, 59, 231, 166, 51, 98, 94, 3, 64, 251, 247, 134, 141, 184, 105, 239, 207, 115, 65, 139, 251]), bytes([182, 237, 255, 65, 117, 136, 201, 102, 52, 75, 230, 33, 122, 226, 238, 235, 209, 220, 244, 243, 123, 19, 245, 246, 60, 240, 92, 243, 235, 41, 252, 41, 153, 35, 68, 202, 39, 208, 44, 134, 205, 159, 86, 140, 90])]]], [[[]], []]], []]]]]], [[[bytes([148, 196, 192, 130, 206]), []], []], bytes([99, 243, 215, 234, 130, 91, 235, 160, 119, 17, 176, 208, 219, 133, 208, 164, 31, 3, 237, 209, 104, 104, 202, 98, 30, 191, 16, 144, 186, 49, 202, 70, 26, 122, 255, 107, 0, 159, 52, 174, 215, 193, 123, 184, 55, 40, 253, 54, 133, 1, 87, 71, 13, 119, 243, 180, 17, 240])]]]], [bytes([165, 148, 20, 191, 166, 144, 69, 88, 21, 228, 232, 74, 0, 75]), bytes([239])]]], bytes([179, 163, 113])]]]], bytes([235, 224, 195, 69, 174, 3, 233, 87, 98, 106, 68, 5, 64, 230, 164, 30, 58, 220, 55, 20, 114, 126, 233, 170, 118, 149, 45, 79, 226, 162, 90, 229, 24, 197, 31, 142, 212, 144, 13, 72, 145, 196, 159, 102, 103, 55, 196, 68, 0, 34, 53, 66, 186, 113])]], + 'encoded': bytes([249, 1, 160, 249, 1, 157, 249, 1, 99, 192, 249, 1, 95, 249, 1, 92, 249, 1, 89, 249, 1, 82, 249, 1, 79, 249, 1, 58, 192, 249, 1, 54, 128, 249, 1, 50, 248, 232, 248, 230, 248, 228, 248, 226, 248, 224, 248, 221, 248, 215, 248, 213, 248, 77, 193, 192, 184, 73, 221, 197, 79, 196, 140, 144, 164, 143, 146, 176, 218, 69, 87, 167, 65, 237, 149, 151, 99, 141, 238, 27, 109, 35, 30, 98, 4, 12, 217, 249, 191, 223, 216, 213, 122, 58, 123, 165, 237, 197, 251, 61, 140, 155, 226, 44, 202, 130, 74, 194, 193, 80, 15, 12, 37, 245, 255, 204, 121, 18, 7, 13, 83, 14, 62, 176, 249, 47, 200, 219, 171, 108, 165, 248, 132, 184, 84, 182, 115, 145, 45, 109, 173, 135, 19, 135, 233, 171, 92, 120, 47, 125, 58, 178, 63, 162, 93, 29, 44, 123, 64, 244, 189, 129, 160, 212, 80, 138, 86, 160, 44, 53, 2, 20, 221, 140, 253, 251, 148, 225, 144, 64, 112, 14, 67, 177, 31, 104, 7, 107, 149, 52, 208, 209, 206, 149, 246, 126, 196, 136, 109, 59, 231, 166, 51, 98, 94, 3, 64, 251, 247, 134, 141, 184, 105, 239, 207, 115, 65, 139, 251, 173, 182, 237, 255, 65, 117, 136, 201, 102, 52, 75, 230, 33, 122, 226, 238, 235, 209, 220, 244, 243, 123, 19, 245, 246, 60, 240, 92, 243, 235, 41, 252, 41, 153, 35, 68, 202, 39, 208, 44, 134, 205, 159, 86, 140, 90, 195, 193, 192, 192, 192, 248, 70, 201, 199, 133, 148, 196, 192, 130, 206, 192, 192, 184, 58, 99, 243, 215, 234, 130, 91, 235, 160, 119, 17, 176, 208, 219, 133, 208, 164, 31, 3, 237, 209, 104, 104, 202, 98, 30, 191, 16, 144, 186, 49, 202, 70, 26, 122, 255, 107, 0, 159, 52, 174, 215, 193, 123, 184, 55, 40, 253, 54, 133, 1, 87, 71, 13, 119, 243, 180, 17, 240, 209, 142, 165, 148, 20, 191, 166, 144, 69, 88, 21, 228, 232, 74, 0, 75, 129, 239, 131, 179, 163, 113, 182, 235, 224, 195, 69, 174, 3, 233, 87, 98, 106, 68, 5, 64, 230, 164, 30, 58, 220, 55, 20, 114, 126, 233, 170, 118, 149, 45, 79, 226, 162, 90, 229, 24, 197, 31, 142, 212, 144, 13, 72, 145, 196, 159, 102, 103, 55, 196, 68, 0, 34, 53, 66, 186, 113])}, + {'decoded': [[[], [[bytes([104, 20, 174, 96, 225, 69, 29, 121, 3, 159, 78, 50, 125, 112, 133, 56, 243, 104, 113, 142, 60, 80, 23, 228, 177, 129, 134, 21, 202, 241, 217, 176, 62, 42, 137, 226, 197, 72, 10, 186, 78, 240, 18, 34, 194, 5, 255, 131, 73, 2, 115, 205, 78, 43, 30, 97, 231, 111, 14, 114, 182, 83, 106, 53, 55, 183, 166, 48, 248, 24, 204, 59, 46, 44, 79, 7, 30, 161, 122, 82, 54, 56, 252, 230, 201]), []]]]], + 'encoded': bytes([248, 95, 248, 93, 192, 248, 90, 248, 88, 184, 85, 104, 20, 174, 96, 225, 69, 29, 121, 3, 159, 78, 50, 125, 112, 133, 56, 243, 104, 113, 142, 60, 80, 23, 228, 177, 129, 134, 21, 202, 241, 217, 176, 62, 42, 137, 226, 197, 72, 10, 186, 78, 240, 18, 34, 194, 5, 255, 131, 73, 2, 115, 205, 78, 43, 30, 97, 231, 111, 14, 114, 182, 83, 106, 53, 55, 183, 166, 48, 248, 24, 204, 59, 46, 44, 79, 7, 30, 161, 122, 82, 54, 56, 252, 230, 201, 192])}, + {'decoded': [[[]], [[[[[]], [[]]], [[], []]], [bytes([202, 71, 200, 200, 233, 30, 54, 122, 247, 251, 243, 194, 93, 212, 3, 55, 244, 223, 73, 128, 242, 15, 128, 245, 254, 2, 16, 19, 43, 126, 174, 227, 140, 122, 190, 242, 102, 191, 147, 100, 140, 221, 166, 6])]]], + 'encoded': bytes([248, 58, 193, 192, 247, 200, 196, 193, 192, 193, 192, 194, 192, 192, 237, 172, 202, 71, 200, 200, 233, 30, 54, 122, 247, 251, 243, 194, 93, 212, 3, 55, 244, 223, 73, 128, 242, 15, 128, 245, 254, 2, 16, 19, 43, 126, 174, 227, 140, 122, 190, 242, 102, 191, 147, 100, 140, 221, 166, 6])}, + {'decoded': bytes([41, 192, 198, 115, 69, 126, 224, 67, 174, 209, 56, 163, 109, 138, 62, 110, 185, 205, 225, 138, 149, 102, 184, 247, 229]), + 'encoded': bytes([153, 41, 192, 198, 115, 69, 126, 224, 67, 174, 209, 56, 163, 109, 138, 62, 110, 185, 205, 225, 138, 149, 102, 184, 247, 229])}, + {'decoded': [[[], [[bytes([119, 109, 199, 236, 84, 99, 113, 105, 11, 145, 15, 196, 97, 205, 10, 150, 37, 85, 196, 64, 225, 189, 75, 204, 239, 128, 9, 93, 209, 47, 254, 114, 129, 206, 48, 19, 185, 166, 221, 27, 213, 250, 77, 1, 92, 107, 27, 123, 225, 20, 209, 1, 56, 230, 92, 185, 12, 68, 133, 243, 47, 197, 215, 92, 77])]]]], + 'encoded': bytes([248, 74, 248, 72, 192, 248, 69, 248, 67, 184, 65, 119, 109, 199, 236, 84, 99, 113, 105, 11, 145, 15, 196, 97, 205, 10, 150, 37, 85, 196, 64, 225, 189, 75, 204, 239, 128, 9, 93, 209, 47, 254, 114, 129, 206, 48, 19, 185, 166, 221, 27, 213, 250, 77, 1, 92, 107, 27, 123, 225, 20, 209, 1, 56, 230, 92, 185, 12, 68, 133, 243, 47, 197, 215, 92, 77])}, + {'decoded': [bytes([44, 86, 146, 43, 198, 62, 77, 30, 134, 2, 60, 113, 218, 170, 24, 102, 187, 126, 35, 178, 134, 46, 238, 188, 232, 131, 132, 96, 127, 0, 248, 68, 60, 241, 207, 11, 18, 202, 157, 209, 123, 248, 229, 60, 50, 166, 74, 21, 240, 124, 155, 124, 93, 144, 165]), []], + 'encoded': bytes([248, 57, 183, 44, 86, 146, 43, 198, 62, 77, 30, 134, 2, 60, 113, 218, 170, 24, 102, 187, 126, 35, 178, 134, 46, 238, 188, 232, 131, 132, 96, 127, 0, 248, 68, 60, 241, 207, 11, 18, 202, 157, 209, 123, 248, 229, 60, 50, 166, 74, 21, 240, 124, 155, 124, 93, 144, 165, 192])}, + {'decoded': [[[[[]], [bytes([]), [[], []]]]], bytes([131, 180, 98])], + 'encoded': bytes([205, 200, 199, 193, 192, 196, 128, 194, 192, 192, 131, 131, 180, 98])}, + {'decoded': [[bytes([220, 23, 224, 135, 157, 214, 39, 246, 117, 76, 49, 19, 141, 75, 170, 173, 53, 11])], [[[[bytes([74, 83, 17, 231, 187]), [[[[], [[[[[[]], bytes([53, 152, 89, 140, 155, 37, 229, 31, 36, 78, 178, 203, 25, 160, 112, 41, 68, 98, 4, 158, 251, 20, 89, 180, 239, 15, 164, 214, 91, 139, 184, 106, 57, 79, 89, 246, 184, 121, 201, 249, 148, 86, 24, 3, 166, 93, 250, 40, 79, 15, 12, 48])]], [[bytes([55, 47, 221, 44, 191, 112, 252, 236, 95, 216, 28, 61, 240, 39, 201, 196, 147, 174, 90, 40, 140, 170, 162, 91, 250, 211, 39, 237, 146, 50, 135, 147, 250, 24, 20, 229, 52, 18, 129, 101, 174, 250, 162, 13, 195, 53, 219, 209, 85, 190, 127, 101, 57, 65, 175, 165, 223, 212, 255, 47, 231, 226, 225, 165, 102, 84, 115, 227, 7, 11, 201, 151, 252, 169, 32, 144, 58, 47, 148, 67, 6, 207, 22, 73, 4, 140, 110, 172, 35, 38, 18, 68, 41, 236, 188, 195, 190, 52])]]]]]], []]], []], []]]], + 'encoded': bytes([248, 210, 211, 146, 220, 23, 224, 135, 157, 214, 39, 246, 117, 76, 49, 19, 141, 75, 170, 173, 53, 11, 248, 188, 248, 186, 248, 183, 248, 180, 133, 74, 83, 17, 231, 187, 248, 172, 248, 169, 248, 167, 192, 248, 164, 248, 162, 248, 56, 247, 193, 192, 180, 53, 152, 89, 140, 155, 37, 229, 31, 36, 78, 178, 203, 25, 160, 112, 41, 68, 98, 4, 158, 251, 20, 89, 180, 239, 15, 164, 214, 91, 139, 184, 106, 57, 79, 89, 246, 184, 121, 201, 249, 148, 86, 24, 3, 166, 93, 250, 40, 79, 15, 12, 48, 248, 102, 248, 100, 184, 98, 55, 47, 221, 44, 191, 112, 252, 236, 95, 216, 28, 61, 240, 39, 201, 196, 147, 174, 90, 40, 140, 170, 162, 91, 250, 211, 39, 237, 146, 50, 135, 147, 250, 24, 20, 229, 52, 18, 129, 101, 174, 250, 162, 13, 195, 53, 219, 209, 85, 190, 127, 101, 57, 65, 175, 165, 223, 212, 255, 47, 231, 226, 225, 165, 102, 84, 115, 227, 7, 11, 201, 151, 252, 169, 32, 144, 58, 47, 148, 67, 6, 207, 22, 73, 4, 140, 110, 172, 35, 38, 18, 68, 41, 236, 188, 195, 190, 52, 192, 192, 192])}, + {'decoded': [bytes([32, 119, 3, 14]), [bytes([117, 137, 70, 205])]], + 'encoded': bytes([203, 132, 32, 119, 3, 14, 197, 132, 117, 137, 70, 205])}, + {'decoded': bytes([82, 180, 218]), + 'encoded': bytes([131, 82, 180, 218])}, + {'decoded': [[[]], bytes([137, 137, 99, 189, 230, 163, 219, 103, 115, 53, 141, 146, 111, 73, 23, 73, 250, 216, 141, 90, 204, 162, 107, 211, 230, 16, 71, 251, 152, 46, 97, 80, 163, 13, 133, 24, 8, 214, 173, 169, 158, 144, 14, 185, 133, 231, 76, 101, 9, 228, 59, 64, 94, 121, 163, 205, 5, 171, 62, 135, 241, 228, 118, 188, 234, 186, 57, 161, 62, 21, 102, 124, 81, 230, 18, 187, 1, 89, 195, 23, 121, 127, 53, 82, 236, 144, 2, 77, 232, 88, 12, 245, 38, 121, 141, 150, 59])], + 'encoded': bytes([248, 101, 193, 192, 184, 97, 137, 137, 99, 189, 230, 163, 219, 103, 115, 53, 141, 146, 111, 73, 23, 73, 250, 216, 141, 90, 204, 162, 107, 211, 230, 16, 71, 251, 152, 46, 97, 80, 163, 13, 133, 24, 8, 214, 173, 169, 158, 144, 14, 185, 133, 231, 76, 101, 9, 228, 59, 64, 94, 121, 163, 205, 5, 171, 62, 135, 241, 228, 118, 188, 234, 186, 57, 161, 62, 21, 102, 124, 81, 230, 18, 187, 1, 89, 195, 23, 121, 127, 53, 82, 236, 144, 2, 77, 232, 88, 12, 245, 38, 121, 141, 150, 59])}, + {'decoded': [[[[[[[bytes([128, 174])]]], [[], [bytes([115, 151, 90, 152, 98, 0, 144, 66, 117, 205, 85, 45, 185, 43, 200, 209, 40, 122, 178, 34, 157, 30, 250, 212, 90, 30, 249, 254, 161, 59, 232, 229, 199, 136, 27, 215, 250, 116, 189, 12, 206, 210, 65, 90, 237, 38, 235, 173, 159, 81, 18, 48, 176, 91, 33, 195, 27, 192, 126, 100, 223, 246, 28, 225, 24, 182, 156, 70, 205, 188, 24, 155, 135, 1, 72, 255, 244, 86, 114, 250, 151, 5]), []]]], [[[[]], bytes([])]]], [[]]], [bytes([210, 67, 37, 70, 1, 58, 111, 234, 144, 250, 178, 53, 40, 97, 222, 41, 142, 80, 108, 0, 253, 60, 5, 45, 116, 188, 20, 171, 165, 27, 177, 30, 126, 101, 69, 142, 119, 74, 95, 204, 144, 200, 248, 222, 230, 114, 72, 89, 214, 192, 237, 100, 245, 29, 128, 142, 214, 12, 32])]], + 'encoded': bytes([248, 172, 248, 107, 248, 103, 248, 96, 197, 196, 195, 130, 128, 174, 248, 88, 192, 248, 85, 184, 82, 115, 151, 90, 152, 98, 0, 144, 66, 117, 205, 85, 45, 185, 43, 200, 209, 40, 122, 178, 34, 157, 30, 250, 212, 90, 30, 249, 254, 161, 59, 232, 229, 199, 136, 27, 215, 250, 116, 189, 12, 206, 210, 65, 90, 237, 38, 235, 173, 159, 81, 18, 48, 176, 91, 33, 195, 27, 192, 126, 100, 223, 246, 28, 225, 24, 182, 156, 70, 205, 188, 24, 155, 135, 1, 72, 255, 244, 86, 114, 250, 151, 5, 192, 196, 195, 193, 192, 128, 193, 192, 248, 61, 184, 59, 210, 67, 37, 70, 1, 58, 111, 234, 144, 250, 178, 53, 40, 97, 222, 41, 142, 80, 108, 0, 253, 60, 5, 45, 116, 188, 20, 171, 165, 27, 177, 30, 126, 101, 69, 142, 119, 74, 95, 204, 144, 200, 248, 222, 230, 114, 72, 89, 214, 192, 237, 100, 245, 29, 128, 142, 214, 12, 32])}, + {'decoded': [[]], + 'encoded': bytes([193, 192])}, + {'decoded': bytes([208, 13, 142, 152, 152, 11, 147, 132, 156, 210, 211, 255, 20]), + 'encoded': bytes([141, 208, 13, 142, 152, 152, 11, 147, 132, 156, 210, 211, 255, 20])}, + {'decoded': bytes([203, 246, 120]), + 'encoded': bytes([131, 203, 246, 120])}, + {'decoded': [bytes([119, 183, 72, 205])], + 'encoded': bytes([197, 132, 119, 183, 72, 205])}, + {'decoded': [[bytes([202, 212, 94, 43, 105])], bytes([229, 146, 85, 124, 137, 52, 56, 79, 49, 22, 208, 84, 206, 111, 228, 140, 87, 2, 134, 152, 186, 251, 232, 162, 221, 233, 31, 59, 66, 29, 90, 46, 117, 5, 141, 118, 32, 46, 168, 253, 208, 170, 167, 212, 56, 145, 176, 147, 185, 49, 111, 178, 135, 133, 156, 229, 32, 45, 130, 64, 185, 249, 90, 219, 129, 192, 114, 193, 0, 95, 101, 229, 23, 127, 110, 152, 131, 122, 160, 242, 137, 44, 208, 246, 197, 3, 112, 4])], + 'encoded': bytes([248, 97, 198, 133, 202, 212, 94, 43, 105, 184, 88, 229, 146, 85, 124, 137, 52, 56, 79, 49, 22, 208, 84, 206, 111, 228, 140, 87, 2, 134, 152, 186, 251, 232, 162, 221, 233, 31, 59, 66, 29, 90, 46, 117, 5, 141, 118, 32, 46, 168, 253, 208, 170, 167, 212, 56, 145, 176, 147, 185, 49, 111, 178, 135, 133, 156, 229, 32, 45, 130, 64, 185, 249, 90, 219, 129, 192, 114, 193, 0, 95, 101, 229, 23, 127, 110, 152, 131, 122, 160, 242, 137, 44, 208, 246, 197, 3, 112, 4])}, + {'decoded': [bytes([106, 48, 151, 108, 40, 159, 34, 185, 57, 87, 148, 229, 153, 47, 56, 88, 179, 253, 237, 139])], + 'encoded': bytes([213, 148, 106, 48, 151, 108, 40, 159, 34, 185, 57, 87, 148, 229, 153, 47, 56, 88, 179, 253, 237, 139])}, + {'decoded': [[bytes([175, 80, 96, 188, 30, 152, 212, 34, 24, 109, 203, 44, 234, 46, 160, 148, 64, 214, 15, 175, 114, 21, 233, 96, 5, 187, 226, 206, 138, 2, 166, 25, 39, 137, 227, 223, 169, 184, 211, 182, 250, 110, 11, 206, 117, 176, 239, 124, 225, 46, 11, 0, 124, 155, 220, 76, 239, 114, 172, 127, 124, 69, 61, 114, 184, 211, 120, 38, 57, 168, 233, 127, 100, 7, 205, 255, 124, 165, 16, 151, 243, 190, 3, 178, 55, 244, 81, 70, 5, 115, 6, 195, 43, 203, 236]), [[bytes([254, 105, 30, 38, 0, 122, 162, 0, 127, 77, 249, 99, 107, 196, 30, 139, 235, 52, 131, 147, 129, 81, 121, 49, 144, 108, 13])]]]], + 'encoded': bytes([248, 129, 248, 127, 184, 95, 175, 80, 96, 188, 30, 152, 212, 34, 24, 109, 203, 44, 234, 46, 160, 148, 64, 214, 15, 175, 114, 21, 233, 96, 5, 187, 226, 206, 138, 2, 166, 25, 39, 137, 227, 223, 169, 184, 211, 182, 250, 110, 11, 206, 117, 176, 239, 124, 225, 46, 11, 0, 124, 155, 220, 76, 239, 114, 172, 127, 124, 69, 61, 114, 184, 211, 120, 38, 57, 168, 233, 127, 100, 7, 205, 255, 124, 165, 16, 151, 243, 190, 3, 178, 55, 244, 81, 70, 5, 115, 6, 195, 43, 203, 236, 221, 220, 155, 254, 105, 30, 38, 0, 122, 162, 0, 127, 77, 249, 99, 107, 196, 30, 139, 235, 52, 131, 147, 129, 81, 121, 49, 144, 108, 13])}, + {'decoded': bytes([21, 42, 205, 148, 155, 47, 1, 240, 107, 5, 160, 242, 141, 77, 240, 233, 144]), + 'encoded': bytes([145, 21, 42, 205, 148, 155, 47, 1, 240, 107, 5, 160, 242, 141, 77, 240, 233, 144])}, + {'decoded': [[[[], [[[bytes([251, 115, 43, 69, 106, 1, 24, 232, 0, 52, 40, 73, 30, 112, 227, 95, 233, 35, 177, 239, 85, 250, 105, 9, 119])]], bytes([110, 56, 78, 126, 65, 233, 240, 105, 64, 118, 112, 222, 71, 36, 96, 233, 11, 213, 243, 200, 30, 8, 84, 238, 1, 66, 221, 37, 37, 188, 63, 235, 219, 244, 141, 15, 153, 200, 148, 26, 62, 49, 93, 93, 219, 204, 134, 90, 61, 102, 82, 18, 92, 156, 129, 162, 204, 247, 88, 136, 84, 54, 160, 73, 60, 175, 121, 176, 225, 194, 177, 83, 161, 86, 63, 170, 226, 120])]]]], + 'encoded': bytes([248, 115, 248, 113, 248, 111, 192, 248, 108, 219, 218, 153, 251, 115, 43, 69, 106, 1, 24, 232, 0, 52, 40, 73, 30, 112, 227, 95, 233, 35, 177, 239, 85, 250, 105, 9, 119, 184, 78, 110, 56, 78, 126, 65, 233, 240, 105, 64, 118, 112, 222, 71, 36, 96, 233, 11, 213, 243, 200, 30, 8, 84, 238, 1, 66, 221, 37, 37, 188, 63, 235, 219, 244, 141, 15, 153, 200, 148, 26, 62, 49, 93, 93, 219, 204, 134, 90, 61, 102, 82, 18, 92, 156, 129, 162, 204, 247, 88, 136, 84, 54, 160, 73, 60, 175, 121, 176, 225, 194, 177, 83, 161, 86, 63, 170, 226, 120])}, + {'decoded': bytes([237, 28, 91, 16, 183, 153, 220, 30, 213, 22, 159, 124, 158, 23, 85, 118, 199, 244, 79, 11, 247, 215, 178, 140, 95, 92, 57, 108, 185, 17, 94, 236, 151, 160, 12, 179, 133, 138, 2, 143, 79, 227, 20, 129, 50, 17, 27, 73, 145, 166, 86, 11, 133, 123, 241, 102, 164, 221, 190, 114, 195, 188, 47, 79, 126, 104, 85, 222, 101, 205, 209, 223, 85, 14, 228, 131, 24, 209, 149, 108, 230, 86, 88, 125, 66]), + 'encoded': bytes([184, 85, 237, 28, 91, 16, 183, 153, 220, 30, 213, 22, 159, 124, 158, 23, 85, 118, 199, 244, 79, 11, 247, 215, 178, 140, 95, 92, 57, 108, 185, 17, 94, 236, 151, 160, 12, 179, 133, 138, 2, 143, 79, 227, 20, 129, 50, 17, 27, 73, 145, 166, 86, 11, 133, 123, 241, 102, 164, 221, 190, 114, 195, 188, 47, 79, 126, 104, 85, 222, 101, 205, 209, 223, 85, 14, 228, 131, 24, 209, 149, 108, 230, 86, 88, 125, 66])}, + {'decoded': bytes([252]), + 'encoded': bytes([129, 252])}, + {'decoded': [bytes([166, 66, 188])], + 'encoded': bytes([196, 131, 166, 66, 188])}, + {'decoded': [[], bytes([188, 160])], + 'encoded': bytes([196, 192, 130, 188, 160])}, + {'decoded': [bytes([220, 147]), []], + 'encoded': bytes([196, 130, 220, 147, 192])}] + + +def main(): + all_encode_work = True + all_decode_work = True + for case in cases: + decoded_data = case['decoded'] + encoded_bytes = case['encoded'] + real_encoded_bytes = rlp.encode(decoded_data) + real_decoded_data = rlp.decode(encoded_bytes) + # check if encode/decode works + encode_works = (real_encoded_bytes == encoded_bytes) + decode_works = (real_decoded_data == decoded_data) + print('encode works: %s' % (encode_works)) + print('decode works: %s' % (decode_works)) + # update globals + all_encode_work = all_encode_work and encode_works + all_decode_work = all_decode_work and decode_works + # print globals + print('all encode work: %s' % (all_encode_work)) + print('all decode work: %s' % (all_decode_work)) + #print(format_cases_erl(c)) + +if __name__ == '__main__': + main()