src/server/test/main.c

changeset 385
a1f4cb076d2f
parent 355
4a7dd7ff92c9
child 403
0f678595d497
equal deleted inserted replaced
210:21274e5950af 385:a1f4cb076d2f
1 /* 1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 * 3 *
4 * Copyright 2013 Olaf Wintermann. All rights reserved. 4 * Copyright 2019 Olaf Wintermann. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
36 36
37 #include "../util/pool.h" 37 #include "../util/pool.h"
38 #include "../public/nsapi.h" 38 #include "../public/nsapi.h"
39 #include "../util/plist.h" 39 #include "../util/plist.h"
40 #include "../util/date.h" 40 #include "../util/date.h"
41 #include "../daemon/vfs.h"
41 42
42 #include "../../ucx/string.h" 43 #include <ucx/test.h>
43 44
44 static int std_pipe_fds[2]; 45 #include "vfs.h"
45 static WSBool is_daemon; 46 #include "writer.h"
47 #include "xml.h"
48 #include "webdav.h"
49 #include "uri.h"
50
51 void register_pg_tests(int argc, char **argv, UcxTestSuite *suite);
52
46 53
47 void test() { 54 void test() {
48 55
49 } 56 }
50 57
51 // needed for linking 58 // needed for linking
52 WSBool main_is_daemon(void) { 59 WSBool main_is_daemon(void) {
53 return is_daemon; 60 return 0;
54 } 61 }
55 62
56 int main(int argc, char **argv) { 63 int main(int argc, char **argv) {
57 pool_init(NULL, NULL, NULL); 64 pool_init(NULL, NULL, NULL);
65 vfs_init();
58 66
59 //test(); 67 //test();
60 68
61 printf("%s", "Webserver Test Suite\n====================\n\n"); 69 printf("%s", "Webserver Test Suite\n====================\n\n");
62 70
71 UcxTestSuite* suite = ucx_test_suite_new();
72
73 // util tests
74 ucx_test_register(suite, test_util_uri_escape_alphanum);
75 ucx_test_register(suite, test_util_uri_escape_space);
76 ucx_test_register(suite, test_util_uri_escape_latin);
77 ucx_test_register(suite, test_util_uri_escape_kanji);
78
79 // vfs tests
80 ucx_test_register(suite, test_vfs_open);
81 ucx_test_register(suite, test_vfs_mkdir);
82 ucx_test_register(suite, test_vfs_opendir);
83 ucx_test_register(suite, test_vfs_readdir);
84 ucx_test_register(suite, test_vfs_unlink);
85 ucx_test_register(suite, test_vfs_rmdir);
86
87 // writer tests
88 ucx_test_register(suite, test_writer_putc);
89 ucx_test_register(suite, test_writer_flush);
90 ucx_test_register(suite, test_writer_put);
91
92 // xml tests
93 ucx_test_register(suite, test_wsxml_iterator);
94 ucx_test_register(suite, test_wsxml_get_required_namespaces);
95 ucx_test_register(suite, test_wsxml_write_nodes);
96 ucx_test_register(suite, test_wsxml_nslist2string);
97 ucx_test_register(suite, test_wsxml_string2nslist);
98
99 // webdav tests
100 ucx_test_register(suite, test_webdav_plist_add);
101 ucx_test_register(suite, test_webdav_plist_size);
102 ucx_test_register(suite, test_propfind_parse);
103 ucx_test_register(suite, test_proppatch_parse);
104 ucx_test_register(suite, test_lock_parse);
105 ucx_test_register(suite, test_rqbody2buffer);
106 ucx_test_register(suite, test_webdav_plist_iterator);
107 ucx_test_register(suite, test_webdav_plist_iterator_remove_current);
108 ucx_test_register(suite, test_msresponse_addproperty);
109 ucx_test_register(suite, test_webdav_propfind_init);
110 ucx_test_register(suite, test_webdav_op_propfind_begin);
111 ucx_test_register(suite, test_webdav_op_propfind_children);
112 ucx_test_register(suite, test_proppatch_msresponse);
113 ucx_test_register(suite, test_msresponse_addproperty_with_errors);
114 ucx_test_register(suite, test_webdav_op_proppatch);
115 ucx_test_register(suite, test_webdav_vfs_op_do);
116 ucx_test_register(suite, test_webdav_delete);
117
118 // webdav methods
119 ucx_test_register(suite, test_webdav_propfind);
120 ucx_test_register(suite, test_webdav_proppatch);
121 ucx_test_register(suite, test_webdav_put);
122
123 // plugin tests
124 #ifdef ENABLE_POSTGRESQL
125 register_pg_tests(argc, argv, suite);
126 #endif
127
128 // run tests
129 ucx_test_run(suite, stdout);
130 fflush(stdout);
131
63 return EXIT_SUCCESS; 132 return EXIT_SUCCESS;
64 } 133 }
65 134

mercurial