test_mdict: test overwrite and delete
authorMarko Kreen <markokr@gmail.com>
Tue, 1 Feb 2011 12:35:35 +0000 (14:35 +0200)
committerMarko Kreen <markokr@gmail.com>
Tue, 1 Feb 2011 12:38:09 +0000 (14:38 +0200)
test/test_mdict.c

index 09c3616fd3b93998ac065f5e2d3837d6c0b2563f..5f641870f7b5406899d0f5fc9d62ec2e3e6f9838 100644 (file)
@@ -19,11 +19,17 @@ static void test_mdict(void *p)
        d = mdict_new(USUAL_ALLOC);
        str_check(xget(d, "key"), "NULL");
        int_check(mdict_put(d, "key", "val"), 1);
+       int_check(mdict_put(d, "key2", "foo"), 1);
        int_check(mdict_put(d, "key2", ""), 1);
        int_check(mdict_put(d, "key3", NULL), 1);
+       int_check(mdict_put(d, "key4", "v1"), 1);
+       int_check(mdict_del(d, "key4"), 1);
        str_check(xget(d, "key"), "val");
        str_check(xget(d, "key2"), "");
        str_check(xget(d, "key3"), "NULL");
+       str_check(xget(d, "key4"), "NULL");
+       str_check(xget(d, "key5"), "NULL");
+       int_check(mdict_del(d, "key5"), 0);
 
        mbuf_init_dynamic(&buf);
        int_check(mdict_urlencode(d, &buf), 1);