summaryrefslogtreecommitdiff
path: root/components/utilities/utest/utest_assert.h
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2019-01-29 04:28:40 +0800
committerGitHub <[email protected]>2019-01-29 04:28:40 +0800
commitb2c2958964d429775e3da335a4f6ca5b4f9e1671 (patch)
tree25a2209ba4814d41b19e624a136ca1c7c894918f /components/utilities/utest/utest_assert.h
parentdfebb30c91875c52f16fd4e7bb9e5981fd0512b4 (diff)
parent8ff9b7795f0423eee36a19b2a36cec4e00c1e831 (diff)
Merge pull request #2289 from armink/lts-v3.1.xv3.1.2
Lts v3.1.x
Diffstat (limited to 'components/utilities/utest/utest_assert.h')
-rw-r--r--components/utilities/utest/utest_assert.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/components/utilities/utest/utest_assert.h b/components/utilities/utest/utest_assert.h
index 997e8ae7f3..9c620c689d 100644
--- a/components/utilities/utest/utest_assert.h
+++ b/components/utilities/utest/utest_assert.h
@@ -19,6 +19,7 @@ void utest_assert(int value, const char *file, int line, const char *func, const
/* No need for the user to use this function directly */
void utest_assert_string(const char *a, const char *b, rt_bool_t equal, const char *file, int line, const char *func, const char *msg);
+void utest_assert_buf(const char *a, const char *b, rt_size_t sz, rt_bool_t equal, const char *file, int line, const char *func, const char *msg);
/* No need for the user to use this macro directly */
#define __utest_assert(value, msg) utest_assert(value, __FILE__, __LINE__, __func__, msg)
@@ -37,6 +38,8 @@ void utest_assert_string(const char *a, const char *b, rt_bool_t equal, const ch
* @macro uassert_int_not_equal if @a not equal to @b, not assert, means passing. Integer type test.
* @macro uassert_str_equal if @a equal to @b, not assert, means passing. String type test.
* @macro uassert_str_not_equal if @a not equal to @b, not assert, means passing. String type test.
+ * @macro uassert_buf_equal if @a equal to @b, not assert, means passing. buf type test.
+ * @macro uassert_buf_not_equal if @a not equal to @b, not assert, means passing. buf type test.
* @macro uassert_in_range if @value is in range of min and max, not assert, means passing.
* @macro uassert_not_in_range if @value is not in range of min and max, not assert, means passing.
*
@@ -52,6 +55,9 @@ void utest_assert_string(const char *a, const char *b, rt_bool_t equal, const ch
#define uassert_str_equal(a, b) utest_assert_string((const char*)(a), (const char*)(b), RT_TRUE, __FILE__, __LINE__, __func__, "string not equal")
#define uassert_str_not_equal(a, b) utest_assert_string((const char*)(a), (const char*)(b), RT_FALSE, __FILE__, __LINE__, __func__, "string equal")
+#define uassert_buf_equal(a, b, sz) utest_assert_buf((const char*)(a), (const char*)(b), (sz), RT_TRUE, __FILE__, __LINE__, __func__, "buf not equal")
+#define uassert_buf_not_equal(a, b, sz) utest_assert_buf((const char*)(a), (const char*)(b), (sz), RT_FALSE, __FILE__, __LINE__, __func__, "buf equal")
+
#define uassert_in_range(value, min, max) __utest_assert(((value >= min) && (value <= max)), "(" #value ") not in range("#min","#max")")
#define uassert_not_in_range(value, min, max) __utest_assert(!((value >= min) && (value <= max)), "(" #value ") in range("#min","#max")")