diff --git a/testsuites/sample/posix/pthread_func_test.c b/testsuites/sample/posix/pthread_func_test.c index df0ba169..63affaa1 100644 --- a/testsuites/sample/posix/pthread_func_test.c +++ b/testsuites/sample/posix/pthread_func_test.c @@ -679,7 +679,8 @@ LITE_TEST_CASE(PthreadFuncTestSuite, TestPthread009, Function | MediumTest | Lev static VOID PthreadOnceFunc01(void) { g_testCount++; - ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount); + ICUNIT_TRACK_EQUAL(g_testCount, 1, g_testCount); + return; } /** diff --git a/testsuites/unittest/posix/src/fs/posix_fs_func_test.c b/testsuites/unittest/posix/src/fs/posix_fs_func_test.c index 69827c27..d980df5b 100644 --- a/testsuites/unittest/posix/src/fs/posix_fs_func_test.c +++ b/testsuites/unittest/posix/src/fs/posix_fs_func_test.c @@ -523,7 +523,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFtellFseek006, Function | MediumTest TEST_ASSERT_NOT_NULL(fp); ret = fseek(fp, -1L, SEEK_SET); - TEST_ASSERT_EQUAL_INT(ret, -1); + TEST_ASSERT_EQUAL_INT(-1, ret); off = ftell(fp); ICUNIT_GOTO_EQUAL((int)off, 0, (int)off, EXIT); @@ -549,7 +549,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFtellFseek007, Function | MediumTest TEST_ASSERT_NOT_NULL(fp); ret = fseek(fp, -1L, SEEK_CUR); - TEST_ASSERT_EQUAL_INT(ret, -1); + TEST_ASSERT_EQUAL_INT(-1, ret); off = ftell(fp); ICUNIT_GOTO_EQUAL((int)off, 0, (int)off, EXIT); @@ -575,7 +575,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFtellFseek008, Function | MediumTest TEST_ASSERT_NOT_NULL(fp); ret = fseek(fp, -1L, SEEK_END); - TEST_ASSERT_EQUAL_INT(ret, -1); + TEST_ASSERT_EQUAL_INT(-1, ret); off = ftell(fp); ICUNIT_GOTO_EQUAL((int)off, 0, (int)off, EXIT); @@ -630,7 +630,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFtellFseek010, Function | MediumTest fp->fd = 500; /* 500 is a wrong fd */ ret = fseek(fp, TEST_SEEK_SIZE, SEEK_SET); - TEST_ASSERT_EQUAL_INT(ret, -1); + TEST_ASSERT_EQUAL_INT(-1, ret); fp->fd = fd; @@ -924,7 +924,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFputs005, Function | MediumTest | Lev } ret = ftell(fp); - TEST_ASSERT_EQUAL_INT(ret, TEST_LOOPUP_TIME * strlen(chr1)); + TEST_ASSERT_EQUAL_INT(TEST_LOOPUP_TIME * strlen(chr1), ret); ret = fclose(fp); TEST_ASSERT_EQUAL_INT(0, ret); diff --git a/testsuites/unittest/posix/src/math/math_func_test.c b/testsuites/unittest/posix/src/math/math_func_test.c index 17729eaf..425ccc14 100644 --- a/testsuites/unittest/posix/src/math/math_func_test.c +++ b/testsuites/unittest/posix/src/math/math_func_test.c @@ -142,11 +142,11 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathLog001, Function | MediumTest | L double testValues[] = { 0.5, 5.5, 1}; double expected[] = { -0.69314718055994528623, 1.70474809223842527217, 0.00000000000000000000}; double ret; - PRINT_EMG("GZHTESTLOG PRINT_EMG: %f, %f, %f", testValues[0], testValues[1], testValues[2]); - LOG("GZHTESTLOG LOG: %f, %f, %f", testValues[0], testValues[1], testValues[2]); + PRINT_EMG("GZHTESTLOG PRINT_EMG: %lf, %lf, %lf", testValues[0], testValues[1], testValues[2]); + LOG("GZHTESTLOG LOG: %lf, %lf, %lf", testValues[0], testValues[1], testValues[2]); for (int i = 0; i < testCount; ++i) { ret = log(testValues[i]); - LOG("\n [POSIXTEST][log]log(%f) = %f, expected is %f", testValues[i], ret, expected[i]); + LOG("\n [POSIXTEST][log]log(%lf) = %lf, expected is %lf", testValues[i], ret, expected[i]); TEST_ASSERT_EQUAL_FLOAT(expected[i], ret); TEST_ASSERT_TRUE(DoubleEquals(expected[i], ret)); } @@ -170,7 +170,7 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathLog002, Function | MediumTest | L for (int i = 0; i < testCount; ++i) { ret = log(testValues[i]); - LOG("\n [POSIXTEST][log]log(%f) = %f, expected is %f", testValues[i], ret, expected[i]); + LOG("\n [POSIXTEST][log]log(%lf) = %lf, expected is %lf", testValues[i], ret, expected[i]); TEST_ASSERT_EQUAL_FLOAT(expected[i], ret); } return 0; @@ -189,7 +189,7 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathSqrt001, Function | MediumTest | double ret; for (int i = 0; i < testCount; ++i) { ret = sqrt(testValues[i]); - LOG("\n [POSIXTEST][sqrt]sqrt(%f) = %f, expected is %f", testValues[i], ret, expected[i]); + LOG("\n [POSIXTEST][sqrt]sqrt(%lf) = %lf, expected is %lf", testValues[i], ret, expected[i]); TEST_ASSERT_EQUAL_FLOAT(expected[i], ret); TEST_ASSERT_TRUE(DoubleEquals(expected[i], ret)); } @@ -209,7 +209,7 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathSqrt002, Function | MediumTest | double ret; for (int i = 0; i < testCount; ++i) { ret = sqrt(testValues[i]); - LOG("\n [POSIXTEST][sqrt]sqrt(%f) = %f, expected is %f", testValues[i], ret, expected[i]); + LOG("\n [POSIXTEST][sqrt]sqrt(%lf) = %lf, expected is %lf", testValues[i], ret, expected[i]); TEST_ASSERT_EQUAL_FLOAT(expected[i], ret); } return 0; @@ -233,7 +233,7 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathPow001, Function | MediumTest | L double ret; for (int i = 0; i < testCount; ++i) { ret = pow(testValues[i][TEST_VALUE_X], testValues[i][TEST_VALUE_Y]); - LOG("\n [POSIXTEST][pow]pow1(%f,%f) = %f, expected is %f", testValues[i][TEST_VALUE_X], + LOG("\n [POSIXTEST][pow]pow1(%lf,%lf) = %lf, expected is %lf", testValues[i][TEST_VALUE_X], testValues[i][TEST_VALUE_Y], ret, testValues[i][TEST_EXPECTED]); TEST_ASSERT_EQUAL_FLOAT(testValues[i][TEST_EXPECTED], ret); TEST_ASSERT_TRUE(DoubleEquals(testValues[i][TEST_EXPECTED], ret)); @@ -270,7 +270,7 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathPow002, Function | MediumTest | L ret = pow(testValues[i][TEST_VALUE_X], testValues[i][TEST_VALUE_Y]); TEST_ASSERT_EQUAL_FLOAT(testValues[i][TEST_EXPECTED], ret); TEST_ASSERT_TRUE(DoubleEquals(testValues[i][TEST_EXPECTED], ret)); - LOG("\n [POSIXTEST][pow]pow1(%f,%f) = %f, expected is %f", testValues[i][TEST_VALUE_X], + LOG("\n [POSIXTEST][pow]pow1(%lf,%lf) = %lf, expected is %lf", testValues[i][TEST_VALUE_X], testValues[i][TEST_VALUE_Y], ret, testValues[i][TEST_EXPECTED]); } return 0; @@ -295,7 +295,7 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathPow003, Function | MediumTest | L for (int i = 0; i < testCount; ++i) { ret = pow(testValues[i][TEST_VALUE_X], testValues[i][TEST_VALUE_Y]); TEST_ASSERT_EQUAL_FLOAT(testValues[i][TEST_EXPECTED], ret); - LOG("\n [POSIXTEST][pow]pow1(%f,%f) = %f, expected is %f", testValues[i][TEST_VALUE_X], + LOG("\n [POSIXTEST][pow]pow1(%lf,%lf) = %lf, expected is %lf", testValues[i][TEST_VALUE_X], testValues[i][TEST_VALUE_Y], ret, testValues[i][TEST_EXPECTED]); TEST_ASSERT_TRUE(DoubleEquals(testValues[i][TEST_EXPECTED], ret)); } @@ -316,7 +316,7 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathRound001, Function | MediumTest | double ret; for (int i = 0; i < testCount; ++i) { ret = round(testValues[i]); - LOG("\n [POSIXTEST][round]round1(%f) = %f, expected is %f", testValues[i], ret, expected[i]); + LOG("\n [POSIXTEST][round]round1(%lf) = %lf, expected is %lf", testValues[i], ret, expected[i]); TEST_ASSERT_EQUAL_FLOAT(expected[i], ret); TEST_ASSERT_TRUE(DoubleEquals(expected[i], ret)); } @@ -336,7 +336,7 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathRound002, Function | MediumTest | double ret; for (int i = 0; i < testCount; ++i) { ret = round(testValues[i]); - LOG("\n [POSIXTEST][round]round1(%f) = %f, expected is %f", testValues[i], ret, expected[i]); + LOG("\n [POSIXTEST][round]round1(%lf) = %lf, expected is %lf", testValues[i], ret, expected[i]); TEST_ASSERT_EQUAL_FLOAT(expected[i], ret); TEST_ASSERT_TRUE(DoubleEquals(expected[i], ret)); } diff --git a/testsuites/unittest/posix/src/regex/regex_func_test.c b/testsuites/unittest/posix/src/regex/regex_func_test.c index b57828d6..a3384a8c 100644 --- a/testsuites/unittest/posix/src/regex/regex_func_test.c +++ b/testsuites/unittest/posix/src/regex/regex_func_test.c @@ -82,7 +82,7 @@ int TestRegex(int flag, const char *pattern, const char *buf, const int expected int j = 0; regcomp(®, pattern, flag); int status = regexec(®, buf, nmatch, pmatch, 0); - TEST_ASSERT_EQUAL_INT(status, expectedStatus); + TEST_ASSERT_EQUAL_INT(expectedStatus, status); if (status == REG_NOMATCH) { LOG("no match"); } else if (status == 0) { @@ -105,7 +105,7 @@ int TestRegcomp(int flag, const char *pattern, const int expectedStatus) regex_t reg; int status = regcomp(®, pattern, flag); LOG("pattern : %s ,real status : %d \n", pattern, status); - TEST_ASSERT_EQUAL_INT(status, expectedStatus); + TEST_ASSERT_EQUAL_INT(expectedStatus, status); regfree(®); return 0; } @@ -166,7 +166,7 @@ LITE_TEST_CASE(PosixRegexFuncTestSuite, testRegexNosub001, Function | MediumTest const char *pattern2 = "HARMONY[1-9]"; regcomp(®, pattern2, cflags); int status = regexec(®, buf, (size_t)0, NULL, 0); - TEST_ASSERT_EQUAL_INT(status, 0); + TEST_ASSERT_EQUAL_INT(0, status); regfree(®); return 0; } diff --git a/testsuites/unittest/posix/src/semaphore/semaphore_func_test.c b/testsuites/unittest/posix/src/semaphore/semaphore_func_test.c index 6024c792..b44533fe 100644 --- a/testsuites/unittest/posix/src/semaphore/semaphore_func_test.c +++ b/testsuites/unittest/posix/src/semaphore/semaphore_func_test.c @@ -183,7 +183,7 @@ LITE_TEST_CASE(PosixSemaphoreFuncTestSuite, testIpcSem_Timedwait003, Function | ts.tv_nsec = 200000; ret = sem_timedwait((sem_t *)&sem, &ts); TEST_ASSERT_EQUAL_INT(-1, ret); - TEST_ASSERT_EQUAL_INT(errno, EINVAL); + TEST_ASSERT_EQUAL_INT(EINVAL, errno); ret = sem_init((sem_t *)&sem, 0, 0); TEST_ASSERT_EQUAL_INT(0, ret); @@ -192,17 +192,17 @@ LITE_TEST_CASE(PosixSemaphoreFuncTestSuite, testIpcSem_Timedwait003, Function | ts.tv_nsec = -2; ret = sem_timedwait((sem_t *)&sem, &ts); TEST_ASSERT_EQUAL_INT(-1, ret); - TEST_ASSERT_EQUAL_INT(errno, EINVAL); + TEST_ASSERT_EQUAL_INT(EINVAL, errno); ts.tv_sec = time(NULL); ts.tv_nsec = NANO_S; ret = sem_timedwait((sem_t *)&sem, &ts); TEST_ASSERT_EQUAL_INT(-1, ret); - TEST_ASSERT_EQUAL_INT(errno, EINVAL); + TEST_ASSERT_EQUAL_INT(EINVAL, errno); ret = sem_timedwait((sem_t *)&sem, NULL); TEST_ASSERT_EQUAL_INT(-1, ret); - TEST_ASSERT_EQUAL_INT(errno, EINVAL); + TEST_ASSERT_EQUAL_INT(EINVAL, errno); ret = sem_destroy((sem_t *)&sem); TEST_ASSERT_EQUAL_INT(0, ret); @@ -211,7 +211,7 @@ LITE_TEST_CASE(PosixSemaphoreFuncTestSuite, testIpcSem_Timedwait003, Function | ts.tv_nsec = 2000000; ret = sem_timedwait(NULL, &ts); TEST_ASSERT_EQUAL_INT(-1, ret); - TEST_ASSERT_EQUAL_INT(errno, EINVAL); + TEST_ASSERT_EQUAL_INT(EINVAL, errno); return 0; } diff --git a/testsuites/unittest/posix/src/stdlib/strtoull_test.c b/testsuites/unittest/posix/src/stdlib/strtoull_test.c index edc03e20..7c545b61 100644 --- a/testsuites/unittest/posix/src/stdlib/strtoull_test.c +++ b/testsuites/unittest/posix/src/stdlib/strtoull_test.c @@ -226,7 +226,7 @@ LITE_TEST_CASE(PosixStdlibStrtoullTest, testStdlibStrtoull008, Function | Medium } TEST_ASSERT_EQUAL_UINT64(ULLONG_MAX, ret); - TEST_ASSERT_EQUAL_INT(errno, ERANGE); + TEST_ASSERT_EQUAL_INT(ERANGE, errno); TEST_ASSERT_EQUAL_STRING(endPtr, ""); return 0; } diff --git a/testsuites/unittest/posix/src/string/memory_func_test.c b/testsuites/unittest/posix/src/string/memory_func_test.c index 8b91873b..81f1bb62 100644 --- a/testsuites/unittest/posix/src/string/memory_func_test.c +++ b/testsuites/unittest/posix/src/string/memory_func_test.c @@ -160,10 +160,10 @@ LITE_TEST_CASE(PosixMemFuncTestSuite, testOsMemMemset001, Function | MediumTest char ch = rand() % 26 + 'A'; retValue = memset(source, ch, sizeof(source) / sizeof(source[0])); TEST_ASSERT_NOT_NULL(retValue); - TEST_ASSERT_EQUAL_PTR(retValue, source); + TEST_ASSERT_EQUAL_PTR(source, retValue); for (int i = 0; i < (sizeof(source) / sizeof(source[0])); i++) { - TEST_ASSERT_EQUAL_INT((int)source[i], (int)ch); + TEST_ASSERT_EQUAL_INT((int)ch, (int)source[i]); } return 0; }; @@ -292,7 +292,7 @@ LITE_TEST_CASE(PosixMemFuncTestSuite, testOsMemRealloc001, Function | MediumTest } free(mem1); - TEST_ASSERT_EQUAL_INT(failure, 0); + TEST_ASSERT_EQUAL_INT(0, failure); } return 0; }; diff --git a/testsuites/unittest/posix/src/string/string_func_test_01.c b/testsuites/unittest/posix/src/string/string_func_test_01.c index dd9d8b00..e9f61cce 100644 --- a/testsuites/unittest/posix/src/string/string_func_test_01.c +++ b/testsuites/unittest/posix/src/string/string_func_test_01.c @@ -72,7 +72,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrlen001, Function | MediumT { char src[] = "helloworld"; int ret = strlen(src); - TEST_ASSERT_EQUAL_INT(ret, 10); + TEST_ASSERT_EQUAL_INT(10, ret); return 0; } @@ -85,7 +85,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrlen002, Function | MediumT { char src[] = "hello world"; int ret = strlen(src); - TEST_ASSERT_EQUAL_INT(ret, 11); + TEST_ASSERT_EQUAL_INT(11, ret); return 0; } @@ -97,7 +97,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrlen002, Function | MediumT LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrlen003, Function | MediumTest | Level1) { int ret = strlen(""); - TEST_ASSERT_EQUAL_INT(ret, 0); + TEST_ASSERT_EQUAL_INT(0, ret); return 0; } @@ -110,7 +110,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrlen004, Function | MediumT { char src[] = "hello\0world"; int ret = strlen(src); - TEST_ASSERT_EQUAL_INT(ret, 5); + TEST_ASSERT_EQUAL_INT(5, ret); return 0; } @@ -123,7 +123,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrlen005, Function | MediumT { char src[] = "\0helloworld"; int ret = strlen(src); - TEST_ASSERT_EQUAL_INT(ret, 0); + TEST_ASSERT_EQUAL_INT(0, ret); return 0; } @@ -268,7 +268,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrrchr001, Function | Medium { char src[] = "hello world"; char *ret = strrchr(src, '!'); - TEST_ASSERT_EQUAL_PTR(ret, NULL); + TEST_ASSERT_EQUAL_PTR(NULL, ret); TEST_ASSERT_NULL(ret); return 0; } @@ -282,7 +282,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrrchr002, Function | Medium { char src[] = "hello world"; char *ret = strrchr(src, '\0'); - TEST_ASSERT_EQUAL_PTR(ret, src + 11); + TEST_ASSERT_EQUAL_PTR(src + 11, ret); TEST_ASSERT_NOT_NULL(ret); return 0; } @@ -296,7 +296,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrrchr003, Function | Medium { char src[] = "hello\0world"; char *ret = strrchr(src, '\0'); - TEST_ASSERT_EQUAL_PTR(ret, src + 5); + TEST_ASSERT_EQUAL_PTR(src + 5, ret); TEST_ASSERT_NOT_NULL(ret); return 0; } @@ -310,7 +310,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrrchr004, Function | Medium { char src[] = "hello world"; char *ret = strrchr(src, ' '); - TEST_ASSERT_EQUAL_PTR(ret, src + 5); + TEST_ASSERT_EQUAL_PTR(src + 5, ret); TEST_ASSERT_NOT_NULL(ret); return 0; } @@ -324,7 +324,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStringStrrchr005, Function | Medium { char src[] = "hello\0world"; char *ret = strrchr(src, ' '); - TEST_ASSERT_EQUAL_PTR(ret, NULL); + TEST_ASSERT_EQUAL_PTR(NULL, ret); TEST_ASSERT_NULL(ret); return 0; } diff --git a/testsuites/unittest/posix/src/string/string_func_test_02.c b/testsuites/unittest/posix/src/string/string_func_test_02.c index 915a1af3..ba3daee1 100644 --- a/testsuites/unittest/posix/src/string/string_func_test_02.c +++ b/testsuites/unittest/posix/src/string/string_func_test_02.c @@ -78,19 +78,19 @@ static BOOL PosixStringsFuncTestSuiteTearDown(void) LITE_TEST_CASE(PosixStringsFuncTestSuite, testStrCaseCmp001, Function | MediumTest | Level1) { int ret = strcasecmp("", ""); - TEST_ASSERT_EQUAL_INT(ret, EQUAL); + TEST_ASSERT_EQUAL_INT(EQUAL, ret); ret = strcasecmp("abcdefg", "abcdefg"); - TEST_ASSERT_EQUAL_INT(ret, EQUAL); + TEST_ASSERT_EQUAL_INT(EQUAL, ret); ret = strcasecmp("abcdefg", "abcdEFg"); - TEST_ASSERT_EQUAL_INT(ret, EQUAL); + TEST_ASSERT_EQUAL_INT(EQUAL, ret); ret = strcasecmp("abcdefg", "abcdEF"); - TEST_ASSERT_NOT_EQUAL(ret, EQUAL); + TEST_ASSERT_NOT_EQUAL(EQUAL, ret); ret = strcasecmp("abcdef", "abcdEFg"); - TEST_ASSERT_NOT_EQUAL(ret, EQUAL); + TEST_ASSERT_NOT_EQUAL(EQUAL, ret); return 0; }; diff --git a/testsuites/unittest/posix/src/string/string_func_test_03.c b/testsuites/unittest/posix/src/string/string_func_test_03.c index 7d135459..b57737b6 100644 --- a/testsuites/unittest/posix/src/string/string_func_test_03.c +++ b/testsuites/unittest/posix/src/string/string_func_test_03.c @@ -78,14 +78,14 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrstrcmp001, Function | MediumTest char dest[] = {"Compiler exited with error"}; retValue = strcmp(source, dest); - TEST_ASSERT_EQUAL_INT(retValue, 0); + TEST_ASSERT_EQUAL_INT(0, retValue); int ret = strcmp("abcdef", "ABCDEF"); - TEST_ASSERT_LESS_THAN(ret, 0); + TEST_ASSERT_GREATER_THAN(0, ret); ret = strcmp("123456", "654321"); - TEST_ASSERT_GREATER_THAN(ret, 0); - TEST_ASSERT_EQUAL_INT(strcmp("~!@#$%^&*()_+", "~!@#$%^&*()_+"), 0); + TEST_ASSERT_LESS_THAN(0, ret); + TEST_ASSERT_EQUAL_INT(0, strcmp("~!@#$%^&*()_+", "~!@#$%^&*()_+")); return 0; }; @@ -102,7 +102,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrstrcmp002, Function | MediumTest char dest[] = {"00000000000"}; retValue = strcmp(source, dest); - TEST_ASSERT_LESS_THAN(retValue, 0); + TEST_ASSERT_GREATER_THAN(0, retValue); return 0; }; @@ -119,7 +119,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrstrcmp003, Function | MediumTest char dest[] = {"Compiler exited with error"}; retValue = strcmp(source, dest); - TEST_ASSERT_GREATER_THAN(retValue, 0); + TEST_ASSERT_LESS_THAN(0, retValue); return 0; }; @@ -137,16 +137,16 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrStrdup001, Function | MediumTest dest = strdup(source); TEST_ASSERT_NOT_NULL(dest); printf("The Result Display :%s\r\n", dest); - TEST_ASSERT_EQUAL_CHAR_ARRAY(dest, source, sizeof(source) / sizeof(source[0])); + TEST_ASSERT_EQUAL_CHAR_ARRAY(source, dest, sizeof(source) / sizeof(source[0])); char src[] = "hello world !"; char *ret = strdup(src); - TEST_ASSERT_EQUAL_CHAR_ARRAY(ret, src, sizeof(src) / sizeof(src[0])); + TEST_ASSERT_EQUAL_CHAR_ARRAY(src, ret, sizeof(src) / sizeof(src[0])); free(ret); char srcS[] = "This is String1"; ret = strdup(srcS); - TEST_ASSERT_EQUAL_CHAR_ARRAY(ret, "This is String1", sizeof(srcS) / sizeof(srcS[0])); + TEST_ASSERT_EQUAL_CHAR_ARRAY("This is String1", ret, sizeof(srcS) / sizeof(srcS[0])); free(ret); return 0; }; @@ -165,7 +165,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrStrdup002, Function | MediumTest dest = strdup(source); TEST_ASSERT_NOT_NULL(dest); printf("The Result Display :%s\r\n", dest); - TEST_ASSERT_EQUAL_CHAR_ARRAY(dest, source, sizeof(source) / sizeof(source[0])); + TEST_ASSERT_EQUAL_CHAR_ARRAY(source, dest, sizeof(source) / sizeof(source[0])); return 0; }; @@ -222,12 +222,12 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrStrptime001, Function | MediumTe struct tm tmData; (void)memset_s(&tmData, sizeof(struct tm), 0, sizeof(struct tm)); char *ret = strptime("2020-10-29 21:24:00abc", "%Y-%m-%d %H:%M:%S", &tmData); - TEST_ASSERT_EQUAL_CHAR_ARRAY(ret, "abc", 3); - TEST_ASSERT_EQUAL_INT(tmData.tm_year, 120); - TEST_ASSERT_EQUAL_INT(tmData.tm_mon, 9); - TEST_ASSERT_EQUAL_INT(tmData.tm_mday, 29); - TEST_ASSERT_EQUAL_INT(tmData.tm_hour, 21); - TEST_ASSERT_EQUAL_INT(tmData.tm_min, 24); + TEST_ASSERT_EQUAL_CHAR_ARRAY("abc", ret, 3); + TEST_ASSERT_EQUAL_INT(120, tmData.tm_year); + TEST_ASSERT_EQUAL_INT(9, tmData.tm_mon); + TEST_ASSERT_EQUAL_INT(29, tmData.tm_mday); + TEST_ASSERT_EQUAL_INT(21, tmData.tm_hour); + TEST_ASSERT_EQUAL_INT(24, tmData.tm_min); return 0; } #endif