• R/O
  • SSH

libctools: Commit

This library contains code that extends and simplifies different operations
for C language based programs.


Commit MetaInfo

Revisión1c38dd7e6d10673805f4b250ba20f373347bbc2c (tree)
Tiempo2022-08-28 23:29:36
AutorSergey Gusarov <laborer2008@gmai...>
CommiterSergey Gusarov

Log Message

More tests in test_pointer

Cambiar Resumen

Diferencia incremental

diff -r 647d0963d8e4 -r 1c38dd7e6d10 tests/src/test_pointer.c
--- a/tests/src/test_pointer.c Sun Aug 28 17:21:03 2022 +0300
+++ b/tests/src/test_pointer.c Sun Aug 28 17:29:36 2022 +0300
@@ -12,6 +12,7 @@
1212 #include "tests/unity_headers.h"
1313
1414 #include <ctools/pointer.h>
15+#include <ctools/unused.h>
1516
1617
1718 void setUp(void)
@@ -41,3 +42,38 @@
4142
4243 TEST_ASSERT_EQUAL_INT(sum, 0);
4344 }
45+
46+void testCheckPtrAndReturn(void)
47+{
48+ int* a = CT_NULL;
49+
50+ CT_CHECK_PTR_AND_RETURN(a);
51+}
52+
53+int checkPtrAndReturnRes(void)
54+{
55+ int* a = CT_NULL;
56+
57+ CT_CHECK_PTR_AND_RETURN_RES(a, 10);
58+}
59+
60+void testCompile(void)
61+{
62+ int functionResult;
63+ int* a = CT_NULL;
64+
65+ CT_CHECK_PTR(a);
66+
67+ do
68+ {
69+ CT_CHECK_PTR_AND_BREAK(a);
70+ }
71+ while (CT_FALSE);
72+
73+#if !defined (CT_NO_DYNAMIC_MEMORY)
74+ CT_FREE_CLEAR_PTR(a);
75+#endif
76+
77+ functionResult = checkPtrAndReturnRes();
78+ CT_UNUSED(functionResult);
79+}
Show on old repository browser