Unit tests for spdk_strtol/spdk_strtoll use hard coded strings for arithmetic constants (LONG_MIN/MAX etc). These are only valid on platforms where both long and long long are 64-bit values. Replace the hardcoded values with strings generated from limits.h. The tests use values that are outside of the MIN/MAX range, which cannot be represented as int64_t. These are calculated in two parts to avoid overflow and recombined as a string. Verified using the unit tests on two different architectures and with test code to check that the generated string is the same as the hardcoded value on x86 Linux. Used a small test program to calculate +/-30 around each limit value to check carry handling and boundary conditions. Signed-off-by: Nick Connolly <nick.connolly@mayadata.io> Change-Id: I990ff354f568a0b35853ecc849dd2a452bb1048b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6048 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> |
||
---|---|---|
.. | ||
.gitignore | ||
Makefile | ||
string_ut.c |