• R/O
  • SSH

libctools: Commit

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


Commit MetaInfo

Revisión656218470a0abe937b9fb315f2f2f45387dc4f4c (tree)
Tiempo2017-04-08 20:33:22
Autors.gusarov
Commiters.gusarov

Log Message

Added test for ctStrLen()

Cambiar Resumen

Diferencia incremental

diff -r 3948419ca92c -r 656218470a0a include/ctools/std/string.h
--- a/include/ctools/std/string.h Sun Apr 02 04:54:50 2017 +0300
+++ b/include/ctools/std/string.h Sat Apr 08 14:33:22 2017 +0300
@@ -65,7 +65,7 @@
6565 * "Safe" strlen with checking for NULL pointer.
6666 * @return the number of characters that precede the terminating '\0', or 0 if str is 0
6767 */
68-static CT_FORCEINLINE size_t ct_strlen(const char* str) CT_NOEXCEPT
68+static CT_FORCEINLINE size_t ctStrLen(const char* str) CT_NOEXCEPT
6969 {
7070 return str ? strlen(str) : 0;
7171 }
diff -r 3948419ca92c -r 656218470a0a tests/src/std/test_string.c
--- a/tests/src/std/test_string.c Sun Apr 02 04:54:50 2017 +0300
+++ b/tests/src/std/test_string.c Sat Apr 08 14:33:22 2017 +0300
@@ -24,4 +24,9 @@
2424
2525 void testCompile(void)
2626 {
27+ const char* str1 = "";
28+ const char* str2 = "abc";
29+
30+ TEST_ASSERT_EQUAL(ctStrLen(str1), 0);
31+ TEST_ASSERT_EQUAL(ctStrLen(str2), 3);
2732 }
Show on old repository browser