Added silc_time_epoch, converting SilcTime to Epoch time value
[runtime.git] / lib / silcutil / tests / test_silcbuffmt.c
index 44bac0ac44de196c4929678c46d849352650d9a9..8eb191153da08f04ec0f5e76d75982f7dbfa07d3 100644 (file)
@@ -1,6 +1,6 @@
 /* Buffer formatting tests */
 
-#include "silc.h"
+#include "silcruntime.h"
 
 int print(SilcStack stack, SilcBuffer buf, void *value, void *context)
 {
@@ -147,11 +147,22 @@ int main(int argc, char **argv)
                            SILC_STR_END, SILC_STR_END) < 0)
     goto err;
 
+  SILC_LOG_DEBUG(("Print all lines"));
+  silc_snprintf(string, sizeof(string),
+       "Rfoo\n\n\nbazfoobar\nRbarfoofoo\nRbar\nbaz\nRbazfoo");
+  silc_buffer_set(&buf, string, strlen(string));
+  SILC_LOG_DEBUG(("string: %s", string));
+  if (silc_buffer_unformat(&buf,
+                           SILC_STR_REGEX("", SILC_STR_REGEX_NL),
+                            SILC_STR_FUNC(print, NULL, NULL),
+                           SILC_STR_END, SILC_STR_END) < 0)
+    goto err;
+
   success = TRUE;
 
  err:
   SILC_LOG_DEBUG(("Testing was %s", success ? "SUCCESS" : "FAILURE"));
   fprintf(stderr, "Testing was %s\n", success ? "SUCCESS" : "FAILURE");
 
-  return success;
+  return !success;
 }