taskrambler  v0.1.8
Web server and task management solution.
testers/uuid.c File Reference
#include <stdio.h>
#include <uuid/uuid.h>
#include "class.h"
#include "uuid.h"
#include "commons.h"
#include "utils/memory.h"
+ Include dependency graph for testers/uuid.c:

Go to the source code of this file.

Macros

#define UUID_NS   "4f947b70-6f9f-43b6-8dc1-1321977c8240"
 

Functions

int main (int argc, char *argv[])
 

Macro Definition Documentation

#define UUID_NS   "4f947b70-6f9f-43b6-8dc1-1321977c8240"

Definition at line 11 of file testers/uuid.c.

Referenced by main().

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 15 of file testers/uuid.c.

References memCleanup(), UUID_NS, uuidCompare(), uuidParse(), uuidUnparse(), uuidVersion1(), uuidVersion3(), uuidVersion5(), and uuidZero.

16 {
17  int i;
18  Uuid dummy1 = new(Uuid);
19  Uuid dummy2 = uuidVersion1();
20 
21  for (i=0; i<10000; i++) {
22  UuidString uuid_str;
23 
24  Uuid nsid = uuidParse(UUID_NS);
25  Uuid ver1 = uuidVersion1();
26  Uuid ver3 = uuidVersion3("foo", 3, nsid);
27  Uuid ver5 = uuidVersion5("foo", 3, nsid);
28 
29  uuidUnparse(nsid, uuid_str);
30  printf("nsid: %s\n", uuid_str);
31 
32  uuidUnparse(ver1, uuid_str);
33  printf("nsid: %s\n", uuid_str);
34 
35  uuidUnparse(ver3, uuid_str);
36  printf("nsid: %s\n", uuid_str);
37 
38  uuidUnparse(ver5, uuid_str);
39  printf("nsid: %s\n", uuid_str);
40 
41  printf("equal | expected 0 : got %d\n", uuidCompare(ver5, ver5));
42  printf("not equal | expected !0 : got %d\n", uuidCompare(ver3, ver5));
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);
55  memCleanup();
56 
57  return 0;
58 }
int uuidCompare(Uuid, Uuid)
Definition: compare.c:30
Uuid uuidParse(const UuidString)
Definition: uuid/parse.c:30
void uuidUnparse(Uuid, UuidString)
Definition: unparse.c:30
Uuid uuidVersion3(const unsigned char *, size_t, Uuid)
Definition: version3.c:39
Uuid uuidVersion1()
Definition: version1.c:30
Uuid uuidVersion5(const unsigned char *, size_t, Uuid)
Definition: version5.c:39
Uuid uuidZero
#define UUID_NS
Definition: testers/uuid.c:11
char UuidString[37]
Definition: uuid.h:40
void memCleanup()
Definition: memory.c:862

+ Here is the call graph for this function: