Ejemplo n.º 1
0
    def test_crossSession(self):
        """ tests to make sure that the same identifier is produced
            for a given seed/other inputs.
        """
        tuid.tuid_init(874738374, 3)
        a = tuid.tuid(42)
        tuid.tuid_init(874738374, 3)
        b = tuid.tuid(42)

        self.assertEqual(a, b)
Ejemplo n.º 2
0
 def test_crossSession(self):
     """ tests to make sure that the same identifier is produced
         for a given seed/other inputs.
     """
     tuid.tuid_init(874738374, 3)
     a = tuid.tuid(42)
     tuid.tuid_init(874738374, 3)      
     b = tuid.tuid(42)
      
     self.assertEqual(a, b)
Ejemplo n.º 3
0
    def test_coverage(self):
        length = 3
        tuid.tuid_init(None, length)

        alph = tuid.defaultAlphabet
        seen = set()
        dup = []
        for i in range(0, pow(len(alph), length)):
            if i % pow(2, 14) == 0: print i
            s = tuid.tuid(i)
            if s in seen:
                print i, s
                dup.append(s)
            else:
                seen.add(s)
        self.assertListEqual(dup, [])
Ejemplo n.º 4
0
 def test_coverage(self):
     length = 3
     tuid.tuid_init(None, length)  
     
     alph = tuid.defaultAlphabet
     seen = set()
     dup = []
     for i in range(0,pow(len(alph),length)):
         if i % pow(2,14) == 0: print i
         s = tuid.tuid(i)
         if s in seen:
             print i,s
             dup.append(s)
         else:
             seen.add(s)
     self.assertListEqual(dup,[])
Ejemplo n.º 5
0
 def test_normal(self):
     tuid.tuid_init(874733474, 4)
     str = tuid.tuid(324)
     self.assertIsNotNone(str)
Ejemplo n.º 6
0
 def test_displaysequence(self):
     tuid.tuid_init(764544738374, 4)
     for i in range(80):
         print tuid.tuid(i),
         if i % 20 == 0: print
     print
Ejemplo n.º 7
0
 def test_normal(self):
     tuid.tuid_init(874733474, 4)
     str = tuid.tuid(324)
     self.assertIsNotNone(str)
Ejemplo n.º 8
0
 def test_displaysequence(self):
     tuid.tuid_init(764544738374, 4)   
     for i in range(80):
         print tuid.tuid(i),
         if i%20 == 0:print
     print