• R/O
  • SSH

libctools: Commit

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


Commit MetaInfo

Revisiónaa3ad582f8e4235f1326d1b28f74dc9d8d36e9a1 (tree)
Tiempo2022-08-31 06:35:39
AutorSergey Gusarov <laborer2008@gmai...>
CommiterSergey Gusarov

Log Message

Implemented test_console, added more comments to the console module

Cambiar Resumen

Diferencia incremental

diff -r ee373b4d5079 -r aa3ad582f8e4 include/ctools/console.h
--- a/include/ctools/console.h Wed Aug 31 00:28:04 2022 +0300
+++ b/include/ctools/console.h Wed Aug 31 00:35:39 2022 +0300
@@ -51,13 +51,22 @@
5151
5252 CT_BEGIN_NAMESPACE
5353
54-// Reads an integer
54+/**
55+ * @brief Reads an integer from stdin
56+ * @return false on error
57+ */
5558 extern CT_SHARED_API bool consoleGetInteger(uint* const pValue) CT_NOEXCEPT;
5659
57-// Reads an integer and check the value
60+/**
61+ * @brief Reads an integer from stdin and check the value
62+ * @return false on error
63+ */
5864 extern CT_SHARED_API bool consoleGetIntegerMinMax(uint* const pValue, const uint min, const uint max) CT_NOEXCEPT;
5965
60-// Reads an hexadecimal number
66+/**
67+ * @brief Reads an hexadecimal number from stdin and check the value
68+ * @return false on error
69+ */
6170 extern CT_SHARED_API bool consoleGetHexa32(uint* const pValue) CT_NOEXCEPT;
6271
6372 CT_END_NAMESPACE
diff -r ee373b4d5079 -r aa3ad582f8e4 tests/src/test_console.c
--- a/tests/src/test_console.c Wed Aug 31 00:28:04 2022 +0300
+++ b/tests/src/test_console.c Wed Aug 31 00:35:39 2022 +0300
@@ -12,6 +12,7 @@
1212 #include "tests/unity_headers.h"
1313
1414 #include <ctools/console.h>
15+#include <ctools/pointer.h>
1516
1617
1718 void setUp(void)
@@ -24,4 +25,16 @@
2425
2526 void testCompile(void)
2627 {
28+ CT_USING_CT_NAMESPACE
29+
30+ bool status;
31+
32+ status = consoleGetInteger(CT_NULL);
33+ TEST_ASSERT_FALSE(status);
34+
35+ status = consoleGetIntegerMinMax(CT_NULL, 0, 9);
36+ TEST_ASSERT_FALSE(status);
37+
38+ status = consoleGetHexa32(CT_NULL);
39+ TEST_ASSERT_FALSE(status);
2740 }
Show on old repository browser