def setUp(self): self.reference = gbd_hash(io.BytesIO(b"1 2 0 3 0"))
def test_normalize_spaces(self): variant = gbd_hash( io.BytesIO(b" c test\np cnf 2 2 \n1 2 0 \r\n 3 0 \n ")) self.assertEqual(self.reference, variant)
def test_normalize_missing_trailing_zero(self): variant = gbd_hash(io.BytesIO(b"p cnf 2 2\n1 2 0\n3")) self.assertEqual(self.reference, variant)
def test_normalize_linebreaks(self): variant1 = gbd_hash(io.BytesIO(b"p cnf 2 2\n1 2 0\r\n 3 0")) variant2 = gbd_hash(io.BytesIO(b"\np cnf 2 2\n1 2 0\r\n 3 0\n")) self.assertEqual(self.reference, variant1) self.assertEqual(self.reference, variant2)
def test_normalize_header(self): variant = gbd_hash(io.BytesIO(b"p cnf 2 2\n1 2 0 3 0")) self.assertEqual(self.reference, variant)
def hash_file(path): return gbd_hash(path)
def compute_hash(nohashvalue, path, args): eprint('Hashing {}'.format(path)) hashvalue = gbd_hash(path) return [('local', hashvalue, path)]
def compute_hash(path): eprint('Hashing {}'.format(path)) hashvalue = gbd_hash(path) attributes = [('INSERT', 'local', path)] return {'hashvalue': hashvalue, 'attributes': attributes}