Spdk/test/unit/lib/util
Nick Connolly 240fdd7dd1 test/string.c: remove hardcoded limit values
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>
2021-02-11 08:40:09 +00:00
..
base64.c ut: make use of CUnit macro to reduce duplications 2020-04-02 14:50:12 +00:00
bit_array.c ut: make use of CUnit macro to reduce duplications 2020-04-02 14:50:12 +00:00
cpuset.c cpuset: fix parse_mask 2020-08-27 08:34:07 +00:00
crc16.c ut: make use of CUnit macro to reduce duplications 2020-04-02 14:50:12 +00:00
crc32_ieee.c ut: make use of CUnit macro to reduce duplications 2020-04-02 14:50:12 +00:00
crc32c.c ut: make use of CUnit macro to reduce duplications 2020-04-02 14:50:12 +00:00
dif.c ut: make use of CUnit macro to reduce duplications 2020-04-02 14:50:12 +00:00
iov.c ut: make use of CUnit macro to reduce duplications 2020-04-02 14:50:12 +00:00
math.c ut: make use of CUnit macro to reduce duplications 2020-04-02 14:50:12 +00:00
pipe.c ut: make use of CUnit macro to reduce duplications 2020-04-02 14:50:12 +00:00
string.c test/string.c: remove hardcoded limit values 2021-02-11 08:40:09 +00:00
Makefile lib/util: Add spdk_sn32_lt/gt() to compare two numbers based on serial number arithmetic 2020-03-19 08:51:31 +00:00