def test_identity(self): s1 = "sixteenasterisks" s2 = "" h1 = bogohash.bogo(s1 + s2) h2 = bogohash.bogo(s1) self.assertEqual(h1.digest(), h2.digest())
def test_associative(self): s1 = "räksmörgås" s2 = "ålsås" h1 = bogohash.bogo(s1 + s2) h2 = bogohash.bogo(s2 + s1) self.assertEqual(h1.digest(), h2.digest())
def test_commutative(self): s1 = "hoola" s2 = "bandoola" h1 = bogohash.bogo(s1) h2 = bogohash.bogo(s2) self.assertEqual(h1.digest() + h2.digest(), h2.digest() + h1.digest())
def test_distributive(self): s1 = "sparris" s2 = "bollar" h1 = bogohash.bogo(s1) h2 = bogohash.bogo(s2) h3 = bogohash.bogo(s1) h3.update(s2) self.assertEqual(h1.digest() + h2.digest(), h3.digest())
def test_korv(self): mjau = bogohash.bogo("korv") self.assertEqual("****", mjau.digest())
def test_update(self): mjau = bogohash.bogo("katt") mjau.update("lusse") self.assertEqual("*********", mjau.digest())