Merge branch 'topic/mm-fixes' of git://208.110.73.182/silc into silc.1.1.branch
[silc.git] / lib / silcutil / tests / test_silcstrutil.c
index 348126208b4c9619319ecc5275793d1544640f7e..0673199e3d328ae73af37d86f4c9325976872176 100644 (file)
@@ -1,6 +1,7 @@
 /* UTF-8 decoding tests */
+/* Other string util tests too */
 
-#include "silcincludes.h"
+#include "silc.h"
 
 #define utf8fail(n, data, len)                 \
 const unsigned char u##n[] = (data);           \
@@ -50,7 +51,7 @@ utf8fail(30, "\xf0\x20\xf9\x20\xfa\x20\xfb\x20", 8);
 
 int main(int argc, char **argv)
 {
-  bool success = FALSE;
+  SilcBool success = FALSE;
   unsigned char *s1, *s2, *s3, *s4;
   int l, opt;
 
@@ -149,6 +150,18 @@ int main(int argc, char **argv)
   silc_free(s3);
   silc_free(s4);
 
+  /* Regex test */
+  SILC_LOG_DEBUG(("Simple regex test"));
+  s1 = "foo,bar,silc,com";
+  SILC_LOG_DEBUG(("Find 'silc' from %s", s1));
+  if (!silc_string_match(s1, "silc"))
+    goto err;
+  SILC_LOG_DEBUG(("Regex match"));
+  SILC_LOG_DEBUG(("Find 'foobar' from %s", s1));
+  if (silc_string_match(s1, "foobar"))
+    goto err;
+  SILC_LOG_DEBUG(("Regex not found (Ok)"));
+
   success = TRUE;
 
  err: