Permalink
Browse files

Add test for msec regressions as well

  • Loading branch information...
ctavan committed Jan 2, 2012
1 parent 4110465 commit 09f075222167552d9e9be267181bfb0548c15aad
Showing with 9 additions and 1 deletion.
  1. +9 −1 test/test.js
View
@@ -78,12 +78,20 @@ try {
}
assert(thrown, 'Exception thrown when > 10K ids created in 1 ms');
+// Verify clock regression bumps clockseq
+var uidt = uuid.v1({msecs: TIME});
+var uidtb = uuid.v1({msecs: TIME - 1});
+assert(
+ parseInt(uidtb.split('-')[3], 16) - parseInt(uidt.split('-')[3], 16) === 1,
+ 'Clock regression by msec increments the clockseq'
+);
+
// Verify clock regression bumps clockseq
var uidtn = uuid.v1({msecs: TIME, nsecs: 10});
var uidtnb = uuid.v1({msecs: TIME, nsecs: 9});
assert(
parseInt(uidtnb.split('-')[3], 16) - parseInt(uidtn.split('-')[3], 16) === 1,
- 'Clock regression increments the clockseq'
+ 'Clock regression by nsec increments the clockseq'
);
// Verify explicit options produce expected id

0 comments on commit 09f0752

Please sign in to comment.