]> pd.if.org Git - uuid/commitdiff
Added test cases for name based uuids.
authorNathan Wagner <nw@hydaspes.if.org>
Fri, 14 Sep 2012 08:38:54 +0000 (08:38 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Fri, 14 Sep 2012 08:38:54 +0000 (08:38 +0000)
Makefile
t/uuidgen.c

index 348c3aa9903b248702df0b85443f6efa61de4517..3dd183ce3c498be3683a5902e9774e37a3f3845f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ libpduuid.a:  $(OBJ)
 t/%.t: t/%.o t/ctap.o libpduuid.a
        $(CC) $(CFLAGS) -Wall -I. -o $@ $< t/ctap.o -lpduuid
 
-test:  t/uuidgen.t libpduuid.a
+test:  t/md5.t t/sha1.t t/uuidgen.t libpduuid.a
        prove t/*.t
 
 md5.o: md5.c
index 8a6e45f3a260c868a7af32e6c4b35fb84d37c238..4ab3cf4d50612a860e54cedfab1a251845727389 100644 (file)
@@ -78,7 +78,7 @@ int main(int ac, char *av[]) {
        srandom(time(0));
 #endif
 
-       plan(13);
+       plan(15);
 
        pd_uuid_init_state(0);
        pd_uuid_make_v1mc(0, &uuid);
@@ -141,6 +141,11 @@ int main(int ac, char *av[]) {
        pd_set_uuid_hash(&uuid, hash, 5);
        str_ok(&uuid, "622e4fa5-7481-57ed-9c91-19e1ba69bf88", "set from hash");
 
+       pd_uuid_make_v3(0, &uuid, &pd_uuid_ns_dns, "www.widgets.com", strlen("www.widgets.com"));
+       str_ok(&uuid, "3d813cbb-47fb-32ba-91df-831e1593ac29", "md5 dns");
+       pd_uuid_make_v5(0, &uuid, &pd_uuid_ns_dns, "www.widgets.com", strlen("www.widgets.com"));
+       str_ok(&uuid, "21f7f8de-8051-5b89-8680-0195ef798b6a", "md5 dns");
+
        pd_uuid_rng_get_bytes(hash, 5);
 
        /* try to get two in very short sequence */