mirror of
https://github.com/logos-blockchain/logos-blockchain-specs.git
synced 2026-01-02 13:13:06 +00:00
Simulator Test
This commit is contained in:
parent
ac1d5fd17a
commit
d0283db5c0
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user