Skip to content

Commit

Permalink
add check statements
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-parmar committed Oct 25, 2024
1 parent ec25345 commit 72a8872
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/rlp/test_optional_fields.nim
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@ objWithEmptyTrailingOptionals.j = Opt.some(0'u64)
suite "test optional fields":
test "all optionals are empty":
let bytes = rlp.encode(objWithEmptyOptional)
check: bytes.len == 7 # 6 mandatory fields + prefix byte

test "all optionals are non empty":
let bytes = rlp.encode(objWithNonEmptyOptional)
check: bytes.len == 15 # 6 mandatory + 8 optional + prefix

test "Only trailing optionals are non empty":
let bytes = rlp.encode(objWithNonEmptyTrailingOptionals)

check: bytes.len == 10 # 6 mandatory + 3 trailing optional + prefix

test "Only trailing optionals are empty":
let bytes = rlp.encode(objWithEmptyTrailingOptionals)

check: bytes.len == 12 # 6 mandatory + 5 non trailing + prefix

0 comments on commit 72a8872

Please sign in to comment.