uuid 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +1 -1
- data/README +76 -76
- data/Rakefile +135 -136
- data/bin/uuid-setup +3 -4
- data/changelog.txt +6 -0
- data/lib/uuid.rb +407 -384
- data/test/test-uuid.rb +26 -26
- metadata +30 -24
data/test/test-uuid.rb
CHANGED
@@ -15,34 +15,34 @@ require 'uuid'
|
|
15
15
|
|
16
16
|
class TestUUID < Test::Unit::TestCase
|
17
17
|
|
18
|
-
|
18
|
+
def setup
|
19
|
+
end
|
20
|
+
|
21
|
+
def teardown
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_format
|
25
|
+
10.times do
|
26
|
+
uuid = UUID.new :compact
|
27
|
+
assert uuid =~ /^[0-9a-fA-F]{32}$/, "UUID does not conform to :compact format"
|
28
|
+
uuid = UUID.new :default
|
29
|
+
assert uuid =~ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/, "UUID does not conform to :default format"
|
30
|
+
uuid = UUID.new :urn
|
31
|
+
assert uuid =~ /^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i, "UUID does not conform to :urn format"
|
19
32
|
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
assert uuid =~ /^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i, "UUID does not conform to :urn format"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_monotonic
|
36
|
-
count = 100000
|
37
|
-
seen = {}
|
38
|
-
count.times do |i|
|
39
|
-
uuid = UUID.new
|
40
|
-
assert !seen.has_key?(uuid), "UUID repeated"
|
41
|
-
seen[uuid] = true
|
42
|
-
print '.' if (i % 10000) == 0
|
43
|
-
STDOUT.flush
|
44
|
-
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_monotonic
|
36
|
+
count = 100000
|
37
|
+
seen = {}
|
38
|
+
count.times do |i|
|
39
|
+
uuid = UUID.new
|
40
|
+
assert !seen.has_key?(uuid), "UUID repeated"
|
41
|
+
seen[uuid] = true
|
42
|
+
print '.' if (i % 10000) == 0
|
43
|
+
STDOUT.flush
|
45
44
|
end
|
45
|
+
end
|
46
46
|
|
47
47
|
end
|
48
48
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.0
|
3
3
|
specification_version: 1
|
4
4
|
name: uuid
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date:
|
6
|
+
version: 1.0.1
|
7
|
+
date: 2006-07-27 00:00:00 -07:00
|
8
8
|
summary: UUID generator
|
9
9
|
require_paths:
|
10
|
-
|
10
|
+
- lib
|
11
11
|
email: assaf@labnotes.org
|
12
12
|
homepage: http://trac.labnotes.org/cgi-bin/trac.cgi/wiki/Ruby/UuidGenerator
|
13
13
|
rubyforge_project: reliable-msg
|
@@ -18,33 +18,39 @@ bindir: bin
|
|
18
18
|
has_rdoc: true
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
version: 0.0.0
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
25
24
|
version:
|
26
25
|
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
27
29
|
authors:
|
28
|
-
|
30
|
+
- Assaf Arkin
|
29
31
|
files:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
- bin/uuid-setup
|
33
|
+
- test/test-uuid.rb
|
34
|
+
- lib/uuid.rb
|
35
|
+
- README
|
36
|
+
- MIT-LICENSE
|
37
|
+
- Rakefile
|
38
|
+
- changelog.txt
|
37
39
|
test_files: []
|
40
|
+
|
38
41
|
rdoc_options:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
- --main
|
43
|
+
- README
|
44
|
+
- --title
|
45
|
+
- UUID generator
|
46
|
+
- --line-numbers
|
44
47
|
extra_rdoc_files:
|
45
|
-
|
48
|
+
- README
|
46
49
|
executables:
|
47
|
-
|
50
|
+
- uuid-setup
|
48
51
|
extensions: []
|
52
|
+
|
49
53
|
requirements: []
|
50
|
-
|
54
|
+
|
55
|
+
dependencies: []
|
56
|
+
|