blob: 068eea8df11f82e6d2bd3230544139e596a8b56f [file] [log] [blame]
Theodore Ts'o1e3472c1997-04-29 14:53:37 +00001#include <stdio.h>
2#include <linux/ext2_fs.h>
3
4#include "uuid.h"
5
6int
7main(int argc, char *argv)
8{
9 uuid_t buf, tst;
10 char str[100];
11 unsigned char *cp;
12 int i;
13 int failed = 0;
14
15 uuid_generate(buf);
16 uuid_unparse(buf, str);
17 printf("UUID string = %s\n", str);
18 printf("UUID: ");
19 for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
20 printf("%02x", *cp++);
21 }
22 printf("\n");
23 uuid_parse(str, tst);
24 if (uuid_compare(buf, tst))
25 printf("UUID parse and compare succeeded.\n");
26 else {
27 printf("UUID parse and compare failed!\n");
28 failed++;
29 }
30 uuid_clear(tst);
31 if (uuid_is_null(tst))
32 printf("UUID clear and is null succeeded.\n");
33 else {
34 printf("UUID clear and is null failed!\n");
35 failed++;
36 }
37 uuid_copy(buf, tst);
38 if (uuid_compare(buf, tst))
39 printf("UUID copy and compare succeeded.\n");
40 else {
41 printf("UUID copy and compare failed!\n");
42 failed++;
43 }
44 if (failed) {
45 printf("%d failures.\n", failed);
46 exit(1);
47 }
48 return 0;
49}
50
51
52