From 6110e0eeedb48c81fad0e5175aa3639f1a703bfa Mon Sep 17 00:00:00 2001 From: Jan Breuer <jan.breuer@jaybee.cz> Date: 周一, 12 10月 2015 21:51:20 +0800 Subject: [PATCH] Format and trailing space cleanup --- libscpi/test/test_scpi_utils.c | 50 +++++++++++++++++++++++++------------------------- 1 files changed, 25 insertions(+), 25 deletions(-) diff --git a/libscpi/test/test_scpi_utils.c b/libscpi/test/test_scpi_utils.c index ea80f09..980f260 100644 --- a/libscpi/test/test_scpi_utils.c +++ b/libscpi/test/test_scpi_utils.c @@ -70,16 +70,16 @@ } static void test_Int32ToStr() { - const size_t max=32+1; + const size_t max = 32 + 1; int32_t val[] = {0, 1, -1, INT32_MIN, INT32_MAX, 0x01234567, 0x89abcdef}; - int N = sizeof(val) / sizeof(int32_t); + int N = sizeof (val) / sizeof (int32_t); int i; char str[max]; char ref[max]; size_t len; // test signed conversion to decimal numbers - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_Int32ToStr(val[i], str, max); snprintf(ref, max, "%"PRIi32, val[i]); CU_ASSERT(len == strlen(ref)); @@ -88,16 +88,16 @@ } static void test_UInt32ToStrBase() { - const size_t max=32+1; + const size_t max = 32 + 1; uint32_t val[] = {0, 1, -1, INT32_MIN, INT32_MAX, 0x01234567, 0x89abcdef}; - int N = sizeof(val) / sizeof(uint32_t); + int N = sizeof (val) / sizeof (uint32_t); int i; char str[max]; char ref[max]; size_t len; // test conversion to decimal numbers - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_UInt32ToStrBase(val[i], str, max, 10); snprintf(ref, max, "%"PRIu32, val[i]); CU_ASSERT(len == strlen(ref)); @@ -105,7 +105,7 @@ } // test conversion to hexadecimal numbers - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_UInt32ToStrBase(val[i], str, max, 16); snprintf(ref, max, "%"PRIX32, val[i]); CU_ASSERT(len == strlen(ref)); @@ -113,7 +113,7 @@ } // test conversion to octal numbers - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_UInt32ToStrBase(val[i], str, max, 8); snprintf(ref, max, "%"PRIo32, val[i]); CU_ASSERT(len == strlen(ref)); @@ -143,16 +143,16 @@ } static void test_Int64ToStr() { - const size_t max=64+1; + const size_t max = 64 + 1; int64_t val[] = {0, 1, -1, INT64_MIN, INT64_MAX, 0x0123456789abcdef, 0xfedcba9876543210}; - int N = sizeof(val) / sizeof(int64_t); + int N = sizeof (val) / sizeof (int64_t); int i; char str[max]; char ref[max]; size_t len; // test conversion to decimal numbers - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_Int64ToStr(val[i], str, max); snprintf(ref, max, "%"PRIi64, val[i]); CU_ASSERT(len == strlen(ref)); @@ -161,16 +161,16 @@ } static void test_UInt64ToStrBase() { - const size_t max=64+1; + const size_t max = 64 + 1; uint64_t val[] = {0, 1, -1, INT64_MIN, INT64_MAX, 0x0123456789abcdef, 0xfedcba9876543210}; - int N = sizeof(val) / sizeof(uint64_t); + int N = sizeof (val) / sizeof (uint64_t); int i; char str[max]; char ref[max]; size_t len; // test conversion to decimal numbers - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_UInt64ToStrBase(val[i], str, max, 10); snprintf(ref, max, "%"PRIu64, val[i]); CU_ASSERT(len == strlen(ref)); @@ -178,7 +178,7 @@ } // test conversion to hexadecimal numbers - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_UInt64ToStrBase(val[i], str, max, 16); snprintf(ref, max, "%"PRIX64, val[i]); CU_ASSERT(len == strlen(ref)); @@ -186,7 +186,7 @@ } // test conversion to octal numbers - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_UInt64ToStrBase(val[i], str, max, 8); snprintf(ref, max, "%"PRIo64, val[i]); CU_ASSERT(len == strlen(ref)); @@ -216,15 +216,15 @@ } static void test_floatToStr() { - const size_t max=49+1; + const size_t max = 49 + 1; float val[] = {1, -1, 1.1, -1.1, 1e3, 1e30, -1.3e30, -1.3e-30}; - int N = sizeof(val) / sizeof(float); + int N = sizeof (val) / sizeof (float); int i; char str[max]; char ref[max]; size_t len; - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_FloatToStr(val[i], str, max); snprintf(ref, max, "%g", val[i]); CU_ASSERT(len == strlen(ref)); @@ -233,15 +233,15 @@ } static void test_doubleToStr() { - const size_t max=49+1; + const size_t max = 49 + 1; double val[] = {1, -1, 1.1, -1.1, 1e3, 1e30, -1.3e30, -1.3e-30}; - int N = sizeof(val) / sizeof(double); + int N = sizeof (val) / sizeof (double); int i; char str[max]; char ref[max]; size_t len; - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { len = SCPI_DoubleToStr(val[i], str, max); snprintf(ref, max, "%lg", val[i]); CU_ASSERT(len == strlen(ref)); @@ -452,15 +452,15 @@ scpi_bool_t result; int32_t values[20]; - #define TEST_MATCH_COMMAND(p, s, r) \ +#define TEST_MATCH_COMMAND(p, s, r) \ do { \ result = matchCommand(p, s, strlen(s), NULL, 0, 0); \ CU_ASSERT_EQUAL(result, r); \ } while(0) \ - #define NOPAREN(...) __VA_ARGS__ +#define NOPAREN(...) __VA_ARGS__ - #define TEST_MATCH_COMMAND2(p, s, r, v) \ +#define TEST_MATCH_COMMAND2(p, s, r, v) \ do { \ int32_t evalues[] = {NOPAREN v}; \ unsigned int cnt = (sizeof(evalues)/4); \ -- Gitblit v1.9.1