Commit 4036a8035434aec5e57117060ba75d71b50e0f00

Authored by Georg Hopp
1 parent c67a6eb3

test code for zeroUuid on stack

Showing 1 changed file with 30 additions and 19 deletions
... ... @@ -14,33 +14,44 @@
14 14 int
15 15 main(int argc, char * argv[])
16 16 {
17   - UuidString uuid_str;
  17 + int i;
  18 + Uuid dummy1 = new(Uuid);
  19 + Uuid dummy2 = uuidVersion1();
18 20
19   - Uuid nsid = uuidParse(UUID_NS);
20   - Uuid ver1 = uuidVersion1();
21   - Uuid ver3 = uuidVersion3("foo", 3, nsid);
22   - Uuid ver5 = uuidVersion5("foo", 3, nsid);
  21 + for (i=0; i<10000; i++) {
  22 + UuidString uuid_str;
23 23
24   - uuidUnparse(nsid, uuid_str);
25   - printf("nsid: %s\n", uuid_str);
  24 + Uuid nsid = uuidParse(UUID_NS);
  25 + Uuid ver1 = uuidVersion1();
  26 + Uuid ver3 = uuidVersion3("foo", 3, nsid);
  27 + Uuid ver5 = uuidVersion5("foo", 3, nsid);
26 28
27   - uuidUnparse(ver1, uuid_str);
28   - printf("nsid: %s\n", uuid_str);
  29 + uuidUnparse(nsid, uuid_str);
  30 + printf("nsid: %s\n", uuid_str);
29 31
30   - uuidUnparse(ver3, uuid_str);
31   - printf("nsid: %s\n", uuid_str);
  32 + uuidUnparse(ver1, uuid_str);
  33 + printf("nsid: %s\n", uuid_str);
32 34
33   - uuidUnparse(ver5, uuid_str);
34   - printf("nsid: %s\n", uuid_str);
  35 + uuidUnparse(ver3, uuid_str);
  36 + printf("nsid: %s\n", uuid_str);
35 37
36   - printf("equal | expected 0 : got %d\n", uuidCompare(ver5, ver5));
37   - printf("not equal | expected !0 : got %d\n", uuidCompare(ver3, ver5));
  38 + uuidUnparse(ver5, uuid_str);
  39 + printf("nsid: %s\n", uuid_str);
38 40
39   - delete(ver5);
40   - delete(ver3);
41   - delete(ver1);
42   - delete(nsid);
  41 + printf("equal | expected 0 : got %d\n", uuidCompare(ver5, ver5));
  42 + printf("not equal | expected !0 : got %d\n", uuidCompare(ver3, ver5));
43 43
  44 + delete(ver5);
  45 + delete(ver3);
  46 + delete(ver1);
  47 + delete(nsid);
  48 + }
  49 +
  50 + printf("compare const with created: %d\n", uuidCompare(uuidZero, dummy1));
  51 + printf("compare const with created: %d\n", uuidCompare(uuidZero, dummy2));
  52 +
  53 + delete(dummy1);
  54 + delete(dummy2);
44 55 memCleanup();
45 56
46 57 return 0;
... ...
Please register or login to post a comment