예제 #1
0
파일: test_db.py 프로젝트: 701/swift
    def test_chexor(self):
        ts = (normalize_timestamp(ts) for ts in
              itertools.count(int(time.time())))

        objects = [
            ('frank', ts.next()),
            ('bob', ts.next()),
            ('tom', ts.next()),
            ('frank', ts.next()),
            ('tom', ts.next()),
            ('bob', ts.next()),
        ]
        hash_ = '0'
        random.shuffle(objects)
        for obj in objects:
            hash_ = chexor(hash_, *obj)

        other_hash = '0'
        random.shuffle(objects)
        for obj in objects:
            other_hash = chexor(other_hash, *obj)

        self.assertEqual(hash_, other_hash)
예제 #2
0
    def test_chexor(self):
        ts = (normalize_timestamp(ts)
              for ts in itertools.count(int(time.time())))

        objects = [
            ('frank', ts.next()),
            ('bob', ts.next()),
            ('tom', ts.next()),
            ('frank', ts.next()),
            ('tom', ts.next()),
            ('bob', ts.next()),
        ]
        hash_ = '0'
        random.shuffle(objects)
        for obj in objects:
            hash_ = chexor(hash_, *obj)

        other_hash = '0'
        random.shuffle(objects)
        for obj in objects:
            other_hash = chexor(other_hash, *obj)

        self.assertEqual(hash_, other_hash)
예제 #3
0
파일: test_db.py 프로젝트: JioCloud/swift
 def test_normal_case(self):
     self.assertEquals(
         chexor('d41d8cd98f00b204e9800998ecf8427e',
                'new name', normalize_timestamp(1)),
         '4f2ea31ac14d4273fe32ba08062b21de')
예제 #4
0
 def test_normal_case(self):
     self.assertEquals(
         chexor('d41d8cd98f00b204e9800998ecf8427e',
                'new name', normalize_timestamp(1)),
         '4f2ea31ac14d4273fe32ba08062b21de')