Commit 4455976
committed
Fix numeric types with less than 32 bits are wrong
This adds additional unit tests for numeric types when using the
Generic Object Serializer.
Numeric types with less than 32 bits currently fail. This includes:
- Enum U8
- Enum U16
- U8
- U16
- I8
- I16
These tests fail because the serializer assumes that type information
is maintained by JSONtext when parsing from JSON. This, however, is
not the case with certain numeric types, for which the parser always
returns 32-bit values, no matter which input type is specified.
When the 32-bit value is later combined with the type information of
a type with less bits, the lower bits are truncated, which results in
incorrect values.
Note that 64-bit values are not affected because they are handled in
native bitness by JSONtext.
Fixed by changing the minimum required version for JSONtext to 1.6.7,
which returns the correct bitness for all numeric types.
References #221 parent 4980f86 commit 4455976
37 files changed
Lines changed: 297 additions & 8 deletions
File tree
- Generic Object Serializer Tests
- Numeric Types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
Binary file not shown.
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
54 | 66 | | |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 commit comments