Skip to content

Commit

Permalink
Add tests covering canonicalization of insignificant decimal digits
Browse files Browse the repository at this point in the history
Per Step 9 of https://httpwg.org/specs/rfc9651.html#ser-decimal only the
significant digits of the decimal's fractional component should be
included in the serialized form.
  • Loading branch information
apasel422 committed Feb 4, 2025
1 parent d2ec605 commit 741abdf
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions number.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,26 @@
"raw": ["-1234567890123.0"],
"header_type": "item",
"must_fail": true
},
{
"name": "decimal with 1 significant digit and 1 insignificant digit",
"raw": ["1.20"],
"header_type": "item",
"expected": [1.2, []],
"canonical": ["1.2"]
},
{
"name": "decimal with 1 significant digit and 2 insignificant digits",
"raw": ["1.200"],
"header_type": "item",
"expected": [1.2, []],
"canonical": ["1.2"]
},
{
"name": "decimal with 2 significant digits and 1 insignificant digit",
"raw": ["1.230"],
"header_type": "item",
"expected": [1.23, []],
"canonical": ["1.23"]
}
]

0 comments on commit 741abdf

Please sign in to comment.