TESTS+=$(addprefix $(o)/lib/,regex.test unicode.test hash-test.test mempool.test stkstring.test \
slists.test kmp-test.test bbuf.test getopt.test fastbuf.test ff-unicode.test eltpool.test \
- fb-socket.test)
+ fb-socket.test string.test)
$(o)/lib/regex.test: $(o)/lib/regex-t
$(o)/lib/unicode.test: $(o)/lib/unicode-t
$(o)/lib/ff-unicode.test: $(o)/lib/ff-unicode-t
$(o)/lib/eltpool.test: $(o)/lib/eltpool-t
$(o)/lib/fb-socket.test: $(o)/lib/fb-socket-t
+$(o)/lib/string.test: $(o)/lib/str-hex-t $(o)/lib/str-esc-t
ifdef CONFIG_UCW_THREADS
TESTS+=$(addprefix $(o)/lib/,asio.test)
else
DBG("octal escape sequence out of range");
}
- *d++ = *s++;
+ else
+ *d++ = *s++;
break;
}
else
*d = 0;
return d;
}
+
+#ifdef TEST
+
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char **argv)
+{
+ if (argc < 2)
+ return 1;
+
+ char tmp[strlen(argv[1]) + 1];
+ int len = str_unesc(tmp, argv[1]) - tmp;
+
+ char hex[2*len + 1];
+ mem_to_hex(hex, tmp, len, ' ');
+ puts(hex);
+
+ return 0;
+}
+
+#endif