mirror of
https://github.com/logos-blockchain/logos-blockchain-specs.git
synced 2026-01-05 14:43:11 +00:00
Simulator Test
This commit is contained in:
parent
ab1d6e5b69
commit
ac1d5fd17a
@ -52,9 +52,9 @@ def simulate_message_passing(committee, latency):
|
||||
int: The number of levels the message passed through.
|
||||
"""
|
||||
# Base case: if the committee is the root (no parent), return 0 (the message reached the root)
|
||||
time.sleep(latency)
|
||||
if committee.parent_committee is None:
|
||||
return 0
|
||||
time.sleep(latency)
|
||||
# Simulate the message passing to the parent committee and get its result
|
||||
parent_result = simulate_message_passing(committee.parent_committee,latency)
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ def test_message_passing():
|
||||
result = simulate_message_passing(leaf_committee, latency)
|
||||
end_time = time.time()
|
||||
|
||||
expected_result = num_levels - 1
|
||||
expected_result = num_levels
|
||||
assert result == expected_result, f"Test Case 1 failed. Expected: {expected_result}, Got: {result}"
|
||||
|
||||
print(f"Test Case 1: Number of Levels Message Passed: {result}, Elapsed Time: {end_time - start_time:.4f} seconds")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user