test/utils.c

branch
dav-2
changeset 889
42cdbf9bbd49
parent 879
255a5ef46400
--- a/test/utils.c	Tue Oct 14 21:02:26 2025 +0200
+++ b/test/utils.c	Sat Nov 08 23:06:11 2025 +0100
@@ -26,28 +26,33 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "utils.h"
+#include "test.h"
+
 #include <libidav/utils.h>
 
-CX_TEST(test_util_parse_creationdate) {
-    CX_TEST_DO {
-        time_t t1 = util_parse_creationdate("2012-11-29T21:35:36Z");
-        time_t t2 = util_parse_creationdate("2023-09-17T13:03:00+02:00");
-
-        struct tm *tm = gmtime(&t1);
-        CX_TEST_ASSERT(tm->tm_year == 112);
-        CX_TEST_ASSERT(tm->tm_mon == 10);
-        CX_TEST_ASSERT(tm->tm_mday == 29);
-        CX_TEST_ASSERT(tm->tm_hour == 21);
-        CX_TEST_ASSERT(tm->tm_min == 35);
-        CX_TEST_ASSERT(tm->tm_sec == 36);
-
-        tm = gmtime(&t2);
-        CX_TEST_ASSERT(tm->tm_year == 123);
-        CX_TEST_ASSERT(tm->tm_mon == 8);
-        CX_TEST_ASSERT(tm->tm_mday == 17);
-        CX_TEST_ASSERT(tm->tm_hour == 11);
-        CX_TEST_ASSERT(tm->tm_min == 03);
-        CX_TEST_ASSERT(tm->tm_sec == 0);
-    }  
+UCX_TEST(test_util_parse_creationdate) {
+    UCX_TEST_BEGIN;
+    
+    time_t t1 = util_parse_creationdate("2012-11-29T21:35:36Z");
+    time_t t2 = util_parse_creationdate("2023-09-17T13:03:00+02:00");
+    
+    struct tm *tm = gmtime(&t1);
+    UCX_TEST_ASSERT(tm->tm_year == 112, "t1: wrong year");
+    UCX_TEST_ASSERT(tm->tm_mon == 10, "t1: wrong month");
+    UCX_TEST_ASSERT(tm->tm_mday == 29, "t1: wrong day");
+    UCX_TEST_ASSERT(tm->tm_hour == 21, "t1: wrong hour");
+    UCX_TEST_ASSERT(tm->tm_min == 35, "t1: wrong minute");
+    UCX_TEST_ASSERT(tm->tm_sec == 36, "t1: wrong second");
+    
+    tm = gmtime(&t2);
+    UCX_TEST_ASSERT(tm->tm_year == 123, "t2: wrong year");
+    UCX_TEST_ASSERT(tm->tm_mon == 8, "t2: wrong month");
+    UCX_TEST_ASSERT(tm->tm_mday == 17, "t2: wrong day");
+    UCX_TEST_ASSERT(tm->tm_hour == 11, "t2: wrong hour");
+    UCX_TEST_ASSERT(tm->tm_min == 03, "t2: wrong minute");
+    UCX_TEST_ASSERT(tm->tm_sec == 0, "t2: wrong second");
+    
+    UCX_TEST_END;
+    
+    
 }

mercurial