-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
68 lines (57 loc) · 1.94 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from merkleTree import MerkleTree, getDifferenceInTrees
# Hashing content from system1
def testCase1() -> None:
print("Test case 1:")
mTree = MerkleTree("data/system1")
root_hash = mTree.getRootHash()
print("system1:", root_hash)
print("")
# Hashing content from system1
# Hashing content from system2
# Compare the hashes manually for now
def testCase2() -> None:
print("Test case 2:")
mTree1 = MerkleTree("data/system1")
root_hash1 = mTree1.getRootHash()
print("system1:", root_hash1)
mTree2 = MerkleTree("data/system2")
root_hash2 = mTree2.getRootHash()
print("system2:", root_hash2)
print("There is no difference." \
if root_hash1 == root_hash2 else "Different hash values when it should be the same")
print("")
# Hashing content from system1
# Hashing content from system2
# Compare the hashes manually for now
def testCase3() -> None:
print("Test case 3:")
mTree1 = MerkleTree("data/system1")
root_hash1 = mTree1.getRootHash()
print("system1:", root_hash1)
mTree3 = MerkleTree("data/system3")
root_hash3 = mTree3.getRootHash()
print("system3:", root_hash3)
print("There is no difference." \
if root_hash1 == root_hash3 else "Different hash values")
print("")
# Compare system1 and system2
# The result should be the same
def testCase4() -> None:
print("Test case 4:")
difference = getDifferenceInTrees("data/system1", "data/system2")
print("There is no difference." if difference is None else difference)
print("")
# Compare system1 and system3
# The result should be the different
# It will return list of list of different filename
def testCase5() -> None:
print("Test case 5:")
difference = getDifferenceInTrees("data/system1", "data/system3")
print("There is no difference." if difference is None else difference)
print("")
if __name__ == "__main__":
testCase1()
testCase2()
testCase3()
testCase4()
testCase5()