test/test-uuid.rb in uuid-1.0.3 vs test/test-uuid.rb in uuid-1.0.4
- old
+ new
@@ -1,11 +1,11 @@
#
# = test-uuid.rb - UUID generator test cases
#
# Author:: Assaf Arkin assaf@labnotes.org
# Documentation:: http://trac.labnotes.org/cgi-bin/trac.cgi/wiki/Ruby/UuidGenerator
-# Copyright:: Copyright (c) 2005 Assaf Arkin
+# Copyright:: Copyright (c) 2005,2007 Assaf Arkin
# License:: MIT and/or Creative Commons Attribution-ShareAlike
#
#--
#++
@@ -23,13 +23,17 @@
def test_format
10.times do
uuid = UUID.new :compact
assert uuid =~ /^[0-9a-fA-F]{32}$/, "UUID does not conform to :compact format"
+ assert uuid =~ UUID::REGEXP_COMPACT, "UUID does not conform to :compact format"
uuid = UUID.new :default
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"
+ assert uuid =~ UUID::REGEXP, "UUID does not conform to :compact format"
+ assert uuid =~ UUID::REGEXP_FULL, "UUID does not conform to :compact format"
uuid = UUID.new :urn
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"
+ assert uuid =~ UUID::REGEXP, "UUID does not conform to :compact format"
end
end
def test_monotonic
count = 100000