src/server/test/main.c

changeset 385
a1f4cb076d2f
parent 355
4a7dd7ff92c9
child 403
0f678595d497
--- a/src/server/test/main.c	Tue Aug 13 22:14:32 2019 +0200
+++ b/src/server/test/main.c	Sat Sep 24 16:26:10 2022 +0200
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright 2013 Olaf Wintermann. All rights reserved.
+ * Copyright 2019 Olaf Wintermann. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -38,11 +38,18 @@
 #include "../public/nsapi.h"
 #include "../util/plist.h"
 #include "../util/date.h"
+#include "../daemon/vfs.h"
 
-#include "../../ucx/string.h"
+#include <ucx/test.h>
 
-static int std_pipe_fds[2];
-static WSBool is_daemon;
+#include "vfs.h"
+#include "writer.h"
+#include "xml.h"
+#include "webdav.h"
+#include "uri.h"
+
+void register_pg_tests(int argc, char **argv, UcxTestSuite *suite);
+
 
 void test() {
     
@@ -50,16 +57,78 @@
 
 // needed for linking
 WSBool main_is_daemon(void) {
-    return is_daemon;
+    return 0;
 }
 
 int main(int argc, char **argv) {
     pool_init(NULL, NULL, NULL);
+    vfs_init();
     
     //test();
     
     printf("%s", "Webserver Test Suite\n====================\n\n");
-
+    
+    UcxTestSuite* suite = ucx_test_suite_new();
+    
+    // util tests
+    ucx_test_register(suite, test_util_uri_escape_alphanum);
+    ucx_test_register(suite, test_util_uri_escape_space);
+    ucx_test_register(suite, test_util_uri_escape_latin);
+    ucx_test_register(suite, test_util_uri_escape_kanji);
+    
+    // vfs tests
+    ucx_test_register(suite, test_vfs_open);
+    ucx_test_register(suite, test_vfs_mkdir);
+    ucx_test_register(suite, test_vfs_opendir);
+    ucx_test_register(suite, test_vfs_readdir);
+    ucx_test_register(suite, test_vfs_unlink);
+    ucx_test_register(suite, test_vfs_rmdir);
+    
+    // writer tests
+    ucx_test_register(suite, test_writer_putc);
+    ucx_test_register(suite, test_writer_flush);
+    ucx_test_register(suite, test_writer_put);
+    
+    // xml tests
+    ucx_test_register(suite, test_wsxml_iterator);
+    ucx_test_register(suite, test_wsxml_get_required_namespaces);
+    ucx_test_register(suite, test_wsxml_write_nodes);
+    ucx_test_register(suite, test_wsxml_nslist2string);
+    ucx_test_register(suite, test_wsxml_string2nslist);
+    
+    // webdav tests
+    ucx_test_register(suite, test_webdav_plist_add);
+    ucx_test_register(suite, test_webdav_plist_size);
+    ucx_test_register(suite, test_propfind_parse);
+    ucx_test_register(suite, test_proppatch_parse);
+    ucx_test_register(suite, test_lock_parse);
+    ucx_test_register(suite, test_rqbody2buffer);
+    ucx_test_register(suite, test_webdav_plist_iterator);
+    ucx_test_register(suite, test_webdav_plist_iterator_remove_current);
+    ucx_test_register(suite, test_msresponse_addproperty);
+    ucx_test_register(suite, test_webdav_propfind_init);
+    ucx_test_register(suite, test_webdav_op_propfind_begin);
+    ucx_test_register(suite, test_webdav_op_propfind_children);
+    ucx_test_register(suite, test_proppatch_msresponse);
+    ucx_test_register(suite, test_msresponse_addproperty_with_errors);
+    ucx_test_register(suite, test_webdav_op_proppatch);
+    ucx_test_register(suite, test_webdav_vfs_op_do);
+    ucx_test_register(suite, test_webdav_delete);
+       
+    // webdav methods
+    ucx_test_register(suite, test_webdav_propfind);
+    ucx_test_register(suite, test_webdav_proppatch);
+    ucx_test_register(suite, test_webdav_put);
+    
+    // plugin tests
+#ifdef ENABLE_POSTGRESQL
+    register_pg_tests(argc, argv, suite);
+#endif
+       
+    // run tests
+    ucx_test_run(suite, stdout);
+    fflush(stdout);
+    
     return EXIT_SUCCESS;
 }
 

mercurial