2 # Copyright (C) 2008-2010, Parrot Foundation.
11 % prove t/library/uuid.t
20 load_bytecode 'uuid.pbc'
22 .include 'test_more.pir'
27 test_generate_random()
38 $P0 = get_global ['uuid'], 'generate'
41 is($S1,'uuid', 'generate 1')
46 $P0 = get_global ['uuid'], 'generate'
48 like($P1, '<[0..9a..f]>**8\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**12', 'generate 2' )
52 .sub test_generate_random
53 $P0 = get_global ['uuid'], 'generate_random'
55 like($P1, '<[0..9a..f]>**8\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**12', 'generate random')
59 .sub test_generate_time
60 $P0 = get_global ['uuid'], 'generate_time'
62 like($P1, '<[0..9a..f]>**8\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**12', 'generate time')
67 $P0 = get_global ['uuid'], 'parse'
68 ($I0, $P1) = $P0("84949cc5-4701-4a84-895b-354c584a981b")
71 is($S1, 'uuid', 'parse 1')
76 $P0 = get_global ['uuid'], 'parse'
77 $I0 = $P0("84949cc5-4701-4a84-895b-354c584a981b")
79 $I0 = $P0("84949CC5-4701-4A84-895B-354C584A981B")
81 $I0 = $P0("84949cc5-4701-4a84-895b-354c584a981bc")
82 is($I0, -1, 'parse 2')
83 $I0 = $P0("84949cc5-4701-4a84-895b-354c584a981")
84 is($I0, -1, 'parse 2')
85 $I0 = $P0("84949cc5x4701-4a84-895b-354c584a981b")
86 is($I0, -1, 'parse 2')
87 $I0 = $P0("84949cc504701-4a84-895b-354c584a981b")
88 is($I0, -1, 'parse 2')
89 $I0 = $P0("84949cc5-470104a84-895b-354c584a981b")
90 is($I0, -1, 'parse 2')
91 $I0 = $P0("84949cc5-4701-4a840895b-354c584a981b")
92 is($I0, -1, 'parse 2')
93 $I0 = $P0("84949cc5-4701-4a84-895b0354c584a981b")
94 is($I0, -1, 'parse 2')
95 $I0 = $P0("g4949cc5-4701-4a84-895b-354c584a981b")
96 is($I0, -1, 'parse 2')
97 $I0 = $P0("84949cc5-4701-4a84-895b-354c584a981g")
98 is($I0, -1, 'parse 2')
103 $P0 = get_global ['uuid'], 'parse'
104 ($I0, $P1) = $P0("84949cc5-4701-4a84-895b-354c584a981b")
111 $P0 = get_global ['uuid'], 'generate'
119 $P0 = get_global ['uuid'], 'generate'
121 $I0 = $P1.'variant'()
122 is($I0, 1, 'variant')
130 # vim: expandtab shiftwidth=4 ft=pir: