src/server/test/webdav.c

branch
webdav
changeset 228
c0afce708b1d
parent 227
3c23855f7b46
child 229
73cb1c98ef7d
equal deleted inserted replaced
227:3c23855f7b46 228:c0afce708b1d
214 &backend1, 214 &backend1,
215 requests, 215 requests,
216 response); 216 response);
217 } 217 }
218 218
219
220 UCX_TEST(test_webdav_plist_add) {
221 Session *sn = testutil_session();
222
223 UCX_TEST_BEGIN;
224
225 WebdavPList *begin = NULL;
226 WebdavPList *end = NULL;
227
228 WebdavProperty p1, p2, p3;
229 ZERO(&p1, sizeof(WebdavProperty));
230 ZERO(&p2, sizeof(WebdavProperty));
231 ZERO(&p3, sizeof(WebdavProperty));
232 int r;
233
234 r = webdav_plist_add(sn->pool, &begin, &end, &p1);
235
236 UCX_TEST_ASSERT(r == 0, "add 1 failed");
237 UCX_TEST_ASSERT(begin && end, "ptrs are NULL");
238 UCX_TEST_ASSERT(begin == end, "begin != end");
239 UCX_TEST_ASSERT(begin->prev == NULL, "begin->prev not NULL");
240 UCX_TEST_ASSERT(begin->next == NULL, "begin->next not NULL");
241
242 r = webdav_plist_add(sn->pool, &begin, &end, &p2);
243
244 UCX_TEST_ASSERT(r == 0, "add 2 failed");
245 UCX_TEST_ASSERT(begin && end, "add2: ptrs are NULL");
246 UCX_TEST_ASSERT(begin->next, "begin->next is NULL");
247 UCX_TEST_ASSERT(begin->next == end, "begin->next != end");
248 UCX_TEST_ASSERT(end->prev = begin, "end->prev != begin");
249 UCX_TEST_ASSERT(begin->prev == NULL, "add2: begin->prev not NULL");
250 UCX_TEST_ASSERT(end->next == NULL, "add2: end->next not NULL");
251
252 r = webdav_plist_add(sn->pool, &begin, &end, &p3);
253
254 UCX_TEST_ASSERT(r == 0, "add 3 failed");
255 UCX_TEST_ASSERT(begin && end, "add3: ptrs are NULL");
256 UCX_TEST_ASSERT(begin->next == end->prev, "begin->next != end->prev");
257
258 UCX_TEST_END;
259
260 testutil_destroy_session(sn);
261 }
262
263 UCX_TEST(test_webdav_plist_size) {
264 Session *sn = testutil_session();
265
266 UCX_TEST_BEGIN;
267
268 WebdavPList *begin = NULL;
269 WebdavPList *end = NULL;
270
271 WebdavProperty p1, p2, p3;
272 ZERO(&p1, sizeof(WebdavProperty));
273 ZERO(&p2, sizeof(WebdavProperty));
274 ZERO(&p3, sizeof(WebdavProperty));
275 int r;
276
277 UCX_TEST_ASSERT(webdav_plist_size(begin) == 0, "size != 0");
278 r = webdav_plist_add(sn->pool, &begin, &end, &p1);
279 UCX_TEST_ASSERT(webdav_plist_size(begin) == 1, "size != 1");
280 r = webdav_plist_add(sn->pool, &begin, &end, &p2);
281 UCX_TEST_ASSERT(webdav_plist_size(begin) == 2, "size != 2");
282 r = webdav_plist_add(sn->pool, &begin, &end, &p3);
283 UCX_TEST_ASSERT(webdav_plist_size(begin) == 3, "size != 3");
284
285 UCX_TEST_END;
286
287 testutil_destroy_session(sn);
288 }
289
219 UCX_TEST(test_propfind_parse) { 290 UCX_TEST(test_propfind_parse) {
220 Session *sn = testutil_session(); 291 Session *sn = testutil_session();
221 Request *rq = testutil_request(sn->pool, "PROPFIND", "/"); 292 Request *rq = testutil_request(sn->pool, "PROPFIND", "/");
222 293
223 UCX_TEST_BEGIN 294 UCX_TEST_BEGIN

mercurial