Simulator Test

This commit is contained in:
mjalalzai 2023-07-20 19:31:38 -04:00
parent ac1d5fd17a
commit d0283db5c0
2 changed files with 3 additions and 2 deletions

View File

@ -53,6 +53,7 @@ def simulate_message_passing(committee, latency):
"""
# Base case: if the committee is the root (no parent), return 0 (the message reached the root)
time.sleep(latency)
print(committee.committee_id)
if committee.parent_committee is None:
return 0
# Simulate the message passing to the parent committee and get its result

View File

@ -16,9 +16,9 @@ def test_message_passing():
result = simulate_message_passing(leaf_committee, latency)
end_time = time.time()
expected_result = num_levels
expected_result = num_levels - 1
assert result == expected_result, f"Test Case 1 failed. Expected: {expected_result}, Got: {result}"
print(expected_result)
print(f"Test Case 1: Number of Levels Message Passed: {result}, Elapsed Time: {end_time - start_time:.4f} seconds")
# Test Case 2: Binary tree with 5 levels (L0, L1, L2, L3, L4)