The standalone prototype should be the root-level project shape for fengqun while preserving the existing planning documents already at the root. This keeps README, examples, tests, and the Python package directly discoverable without deleting the prior docs. Constraint: User clarified that swarm-minimal is the repository root, but other existing root files must remain. Rejected: Deleting existing root docs | They are part of the fengqun repository context and were explicitly protected. Confidence: high Scope-risk: narrow Directive: Keep secrets in ignored .env only; do not commit live credentials. Tested: python3 -B -m unittest discover -s tests; git diff --check; secret-pattern scan showed only placeholders/test values/task-id false positives. Not-tested: Remote web UI rendering after push.
24 lines
1011 B
Python
24 lines
1011 B
Python
import unittest
|
|
|
|
from examples.run_swarm_vs_traditional_benchmark import run_benchmark
|
|
|
|
|
|
class SwarmVsTraditionalBenchmarkTest(unittest.TestCase):
|
|
def test_benchmark_quantifies_swarm_advantage(self) -> None:
|
|
report = run_benchmark()
|
|
|
|
self.assertEqual(report["status"], "PASS")
|
|
scenarios = {scenario["id"]: scenario for scenario in report["scenarios"]}
|
|
|
|
self.assertEqual(scenarios["C01"]["metric"]["traditional"], 0.0)
|
|
self.assertEqual(scenarios["C01"]["metric"]["swarm"], 1.0)
|
|
self.assertEqual(scenarios["C02"]["details"]["traditional_best_single"]["candidate"], "gamma")
|
|
self.assertEqual(scenarios["C02"]["details"]["swarm_aggregated_best"]["candidate"], "beta")
|
|
self.assertGreater(scenarios["C03"]["details"]["steps_to_best_reduction_percent"], 0)
|
|
self.assertEqual(scenarios["C04"]["metric"]["swarm"], 1.0)
|
|
self.assertGreater(report["overall_normalized_score"]["ratio"], 1.0)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|