test/utils.c

branch
dav-2
changeset 879
255a5ef46400
parent 792
4e4e5bbad164
child 889
42cdbf9bbd49
--- a/test/utils.c	Sun Sep 07 15:36:24 2025 +0200
+++ b/test/utils.c	Sun Sep 07 15:57:36 2025 +0200
@@ -26,33 +26,28 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "test.h"
-
+#include "utils.h"
 #include <libidav/utils.h>
 
-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;
-    
-    
+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);
+    }  
 }

mercurial