diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-03-28 19:51:15 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-03-28 19:51:15 +0100 |
commit | 32e790110e766c0f6fbd5c439d15f2649df2c542 (patch) | |
tree | 699d9ee1cab7e50b086b7367924cd462189cf02a /src/systemcmds/tests/test_float.c | |
parent | b24af0f402ed5512d078c7afc0aa92e7ce1c166b (diff) | |
download | px4-firmware-32e790110e766c0f6fbd5c439d15f2649df2c542.tar.gz px4-firmware-32e790110e766c0f6fbd5c439d15f2649df2c542.tar.bz2 px4-firmware-32e790110e766c0f6fbd5c439d15f2649df2c542.zip |
Tests: Fix code style on system tests
Diffstat (limited to 'src/systemcmds/tests/test_float.c')
-rw-r--r-- | src/systemcmds/tests/test_float.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/systemcmds/tests/test_float.c b/src/systemcmds/tests/test_float.c index 0a81fad11..1b170f1bb 100644 --- a/src/systemcmds/tests/test_float.c +++ b/src/systemcmds/tests/test_float.c @@ -158,20 +158,22 @@ int test_float(int argc, char *argv[]) sprintf(sbuf, "%8.4f", (double)0.553415f); if (sbuf[0] == ' ' && sbuf[1] == ' ' && sbuf[2] == '0' && - sbuf[3] == '.' && sbuf[4] == '5' && sbuf[5] == '5' - && sbuf[6] == '3' && sbuf[7] == '4' && sbuf[8] == '\0') { + sbuf[3] == '.' && sbuf[4] == '5' && sbuf[5] == '5' + && sbuf[6] == '3' && sbuf[7] == '4' && sbuf[8] == '\0') { printf("\t success: printf(\"%%8.4f\", 0.553415f) == %8.4f\n", (double)0.553415f); + } else { printf("\t FAIL: printf(\"%%8.4f\", 0.553415f) != \" 0.5534\", result: %s\n", sbuf); ret = -5; } - sprintf(sbuf, "%8.4f", (double)-0.553415f); + sprintf(sbuf, "%8.4f", (double) - 0.553415f); if (sbuf[0] == ' ' && sbuf[1] == '-' && sbuf[2] == '0' && - sbuf[3] == '.' && sbuf[4] == '5' && sbuf[5] == '5' - && sbuf[6] == '3' && sbuf[7] == '4' && sbuf[8] == '\0') { - printf("\t success: printf(\"%%8.4f\", -0.553415f) == %8.4f\n", (double)-0.553415f); + sbuf[3] == '.' && sbuf[4] == '5' && sbuf[5] == '5' + && sbuf[6] == '3' && sbuf[7] == '4' && sbuf[8] == '\0') { + printf("\t success: printf(\"%%8.4f\", -0.553415f) == %8.4f\n", (double) - 0.553415f); + } else { printf("\t FAIL: printf(\"%%8.4f\", -0.553415f) != \" -0.5534\", result: %s\n", sbuf); ret = -6; @@ -250,9 +252,10 @@ int test_float(int argc, char *argv[]) sprintf(sbuf, "%8.4f", 0.553415); if (sbuf[0] == ' ' && sbuf[1] == ' ' && sbuf[2] == '0' && - sbuf[3] == '.' && sbuf[4] == '5' && sbuf[5] == '5' - && sbuf[6] == '3' && sbuf[7] == '4' && sbuf[8] == '\0') { + sbuf[3] == '.' && sbuf[4] == '5' && sbuf[5] == '5' + && sbuf[6] == '3' && sbuf[7] == '4' && sbuf[8] == '\0') { printf("\t success: printf(\"%%8.4f\", 0.553415) == %8.4f\n", 0.553415); + } else { printf("\t FAIL: printf(\"%%8.4f\", 0.553415) != \" 0.5534\", result: %s\n", sbuf); ret = -12; @@ -261,9 +264,10 @@ int test_float(int argc, char *argv[]) sprintf(sbuf, "%8.4f", -0.553415); if (sbuf[0] == ' ' && sbuf[1] == '-' && sbuf[2] == '0' && - sbuf[3] == '.' && sbuf[4] == '5' && sbuf[5] == '5' - && sbuf[6] == '3' && sbuf[7] == '4' && sbuf[8] == '\0') { + sbuf[3] == '.' && sbuf[4] == '5' && sbuf[5] == '5' + && sbuf[6] == '3' && sbuf[7] == '4' && sbuf[8] == '\0') { printf("\t success: printf(\"%%8.4f\", -0.553415) == %8.4f\n", -0.553415); + } else { printf("\t FAIL: printf(\"%%8.4f\", -0.553415) != \" -0.5534\", result: %s\n", sbuf); ret = -13; |