From d0283db5c0e3789cdec7bf51cdf341be5f279752 Mon Sep 17 00:00:00 2001 From: mjalalzai <33738574+MForensic@users.noreply.github.com> Date: Thu, 20 Jul 2023 19:31:38 -0400 Subject: [PATCH] Simulator Test --- carnot/carnot_simulation_psuedocode.py | 1 + carnot/test_carnot_simulation.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/carnot/carnot_simulation_psuedocode.py b/carnot/carnot_simulation_psuedocode.py index 496842e..11fd88e 100644 --- a/carnot/carnot_simulation_psuedocode.py +++ b/carnot/carnot_simulation_psuedocode.py @@ -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 diff --git a/carnot/test_carnot_simulation.py b/carnot/test_carnot_simulation.py index 6d24cba..34c5dd8 100644 --- a/carnot/test_carnot_simulation.py +++ b/carnot/test_carnot_simulation.py @@ -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)