def test_add_2(self): merkle_tree = MerkleTree() merkle_tree.add(elements[0]) merkle_tree.add(elements[1]) self.assertEqual(len(merkle_tree), 2) self.assertEqual(merkle_tree.get(0), elements[0]) self.assertEqual(merkle_tree.get(1), elements[1])
def test_add_many(self): merkle_tree = MerkleTree() for i in range(len(elements)): merkle_tree.add(elements[i]) self.assertEqual(len(merkle_tree), i + 1) self.assertEqual(merkle_tree.get(i), elements[i])
def test_add_1(self): merkle_tree = MerkleTree() self.assertEqual(len(merkle_tree), 0) merkle_tree.add(elements[0]) self.assertEqual(len(merkle_tree), 1) self.assertEqual(merkle_tree.get(0), elements[0])