Includes AirPlan design documents, AircOding-alpha1-plan, AirPlanV2, AirPlan-ParaV2, AirPlan-Para V1 reference docs, and all working code changes across packages. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
90 lines
2.1 KiB
Python
Executable File
90 lines
2.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Xdb/Sdb/Ndb Mode 功能测试"""
|
|
|
|
import sys
|
|
import os
|
|
import tempfile
|
|
import json
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent / "lib"))
|
|
|
|
def test_xdb_enter():
|
|
"""测试 GUI 验证器初始化"""
|
|
from air_runtime.modes.xdb_sdb_ndb_modes import xdb_enter
|
|
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
project_root = Path(tmpdir)
|
|
|
|
result = xdb_enter(project_root)
|
|
assert "state_path" in result
|
|
assert Path(result["state_path"]).exists()
|
|
|
|
print("✓ Xdb 初始化测试通过")
|
|
return True
|
|
|
|
|
|
def test_sdb_enter():
|
|
"""测试静态分析器初始化"""
|
|
from air_runtime.modes.xdb_sdb_ndb_modes import sdb_enter
|
|
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
project_root = Path(tmpdir)
|
|
|
|
result = sdb_enter(project_root)
|
|
assert "state_path" in result
|
|
assert Path(result["state_path"]).exists()
|
|
|
|
print("✓ Sdb 初始化测试通过")
|
|
return True
|
|
|
|
|
|
def test_ndb_enter():
|
|
"""测试网络调试器初始化"""
|
|
from air_runtime.modes.xdb_sdb_ndb_modes import ndb_enter
|
|
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
project_root = Path(tmpdir)
|
|
|
|
result = ndb_enter(project_root)
|
|
assert "state_path" in result
|
|
assert Path(result["state_path"]).exists()
|
|
|
|
print("✓ Ndb 初始化测试通过")
|
|
return True
|
|
|
|
|
|
def main():
|
|
print("=" * 50)
|
|
print("Xdb/Sdb/Ndb Mode 功能测试")
|
|
print("=" * 50)
|
|
|
|
tests = [
|
|
("Xdb 初始化", test_xdb_enter),
|
|
("Sdb 初始化", test_sdb_enter),
|
|
("Ndb 初始化", test_ndb_enter),
|
|
]
|
|
|
|
passed = 0
|
|
failed = 0
|
|
|
|
for name, test_fn in tests:
|
|
try:
|
|
test_fn()
|
|
passed += 1
|
|
except Exception as e:
|
|
print(f"✗ {name} 失败: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
failed += 1
|
|
|
|
print("=" * 50)
|
|
print(f"测试结果: {passed} 通过, {failed} 失败")
|
|
print("=" * 50)
|
|
|
|
return failed == 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
success = main()
|
|
sys.exit(0 if success else 1) |