This week I worked on the xstruct module. I wrote unit tests for pack and unpack that:
- Ensured all types in the documentation could be packed and unpacked to get the original value.
- Ensured pack generated the expected string from a tuple, and unpack generated the expected tuple from a string.
- Ensured an exception was thrown for type mismatches.
- Ensured an exception was thrown when an integer did not fit within its type.
In doing this, I corrected bugs that disallowed the 'c', 'f', and 'd' (single ASCII character, float, and double) types from being used. I also added bounds checking for all the integer types, as previously the module only checked that unsigned types did not have negative values.
No comments:
Post a Comment