Hello,
<snipped>
diff --git a/test/tarantool-c-tests/lj-881-fix-lua-concat.test.c b/test/tarantool-c-tests/lj-881-fix-lua-concat.test.c index 1835d273..f028c457 100644 --- a/test/tarantool-c-tests/lj-881-fix-lua-concat.test.c +++ b/test/tarantool-c-tests/lj-881-fix-lua-concat.test.c @@ -77,7 +77,7 @@ static int lua_concat_testcase(void *test_state) const char *str = lua_tostring(L, -1); assert_int_equal(lua_gettop(L), top - 2 + 1); const char expected_str[] = CONCAT("A + ", TEST_VALUE); - assert_str_equal(str, expected_str, strlen(expected_str)); + assert_str_equal(str, expected_str); /* Teardown. */ lua_settop(L, 0); diff --git a/test/tarantool-c-tests/test.h b/test/tarantool-c-tests/test.h index 2f2d9ea2..5e5c96b2 100644 --- a/test/tarantool-c-tests/test.h +++ b/test/tarantool-c-tests/test.h @@ -212,15 +212,15 @@ static inline int todo(const char *reason) ); \ } while (0) -#define assert_str_equal(got, expected, n) do { \ - assert_general(strncmp(got, expected, n) == 0, \ +#define assert_str_equal(got, expected) do { \ + assert_general(strncmp(got, expected, strlen(expected)) == 0, \On the second thought, I insist on using `strcmp()` here since the expected string is always `\0` terminated, and we use "not safe" the `strlen()` anyway.
Updated.
diff --git a/test/tarantool-c-tests/test.h
b/test/tarantool-c-tests/test.h
index 5e5c96b2..3b22fb92 100644
--- a/test/tarantool-c-tests/test.h
+++ b/test/tarantool-c-tests/test.h
@@ -213,14 +213,14 @@ static inline int todo(const char *reason)
} while (0)
#define assert_str_equal(got, expected) do
{ \
- assert_general(strncmp(got, expected, strlen(expected)) ==
0, \
+ assert_general(strcmp(got, expected) ==
0, \
ASSERT_EQUAL_FMT(str,
"%s"), \
__FILE__, __LINE__, (got),
(expected) \
); \
} while (0)
#define assert_str_not_equal(got, unexpected) do
{ \
- assert_general(strncmp(got, expected, strlen(expected)) !=
0, \
+ assert_general(strcmp(got, expected) !=
0, \
ASSERT_NOT_EQUAL_FMT(str,
"%s"), \
__FILE__, __LINE__, (got),
(unexpected) \
); \
Ditto.ASSERT_EQUAL_FMT(str, "%s"), \ __FILE__, __LINE__, (got), (expected) \ ); \ } while (0) -#define assert_str_not_equal(got, unexpected, n) do { \ - assert_general(strncmp(got, expected, n) != 0, \ +#define assert_str_not_equal(got, unexpected) do { \ + assert_general(strncmp(got, expected, strlen(expected)) != 0, \Ditto.
ASSERT_NOT_EQUAL_FMT(str, "%s"), \ __FILE__, __LINE__, (got), (unexpected) \ ); \+ ASSERT_NOT_EQUAL_FMT(str, "%s"), \ + __FILE__, __LINE__, (got), (unexpected) \ + ); \ +} while (0) + #endif /* TARANTOOL_LUAJIT_TEST_H */