From: Vincent Fu Date: Wed, 16 Oct 2019 16:32:42 +0000 (-0400) Subject: t/iee754: add return value X-Git-Tag: fio-3.17~22^2~11 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=1c75cb5febdfdea9f9b6999e222859fcf2c2e801;p=fio.git t/iee754: add return value To facilitate automated testing, return 0 when all tests succeed and a non-zero value otherwise. Also add one more test value. --- diff --git a/t/ieee754.c b/t/ieee754.c index 3898ab74..b6526394 100644 --- a/t/ieee754.c +++ b/t/ieee754.c @@ -1,21 +1,26 @@ #include #include "../lib/ieee754.h" -static double values[] = { -17.23, 17.23, 123.4567, 98765.4321, 0.0 }; +static double values[] = { -17.23, 17.23, 123.4567, 98765.4321, + 3.14159265358979323, 0.0 }; int main(int argc, char *argv[]) { uint64_t i; - double f; - int j; + double f, delta; + int j, differences = 0; j = 0; do { i = fio_double_to_uint64(values[j]); f = fio_uint64_to_double(i); - printf("%f -> %f\n", values[j], f); + delta = values[j] - f; + printf("%26.20lf -> %26.20lf, delta = %26.20lf\n", values[j], + f, delta); + if (f != values[j]) + differences++; j++; } while (values[j] != 0.0); - return 0; + return differences; }