48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
# Spark Lane Verification Script
|
|
# Used for snippet-level micro-tasks in the spark lane
|
|
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
from datetime import datetime, timezone
|
|
|
|
def verify_word_counter():
|
|
"""Verify word_counter.py functions correctly."""
|
|
sys.path.insert(0, '/root/troupe-standup/wizard-work/spark')
|
|
from word_counter import count_words
|
|
|
|
tests = [
|
|
("Hello world test", 3),
|
|
("", 0),
|
|
(" ", 0),
|
|
("one", 1),
|
|
("one two three four five", 5),
|
|
]
|
|
|
|
passed = 0
|
|
for text, expected in tests:
|
|
result = count_words(text)
|
|
if result == expected:
|
|
passed += 1
|
|
|
|
return passed == len(tests), passed, len(tests)
|
|
|
|
def main():
|
|
print("=== SPARK LANE VERIFICATION ===")
|
|
print(f"Timestamp: {datetime.now(timezone.utc).isoformat()}")
|
|
print()
|
|
|
|
# Run verification
|
|
success, passed, total = verify_word_counter()
|
|
|
|
print(f"word_counter.py: {passed}/{total} tests passed")
|
|
|
|
if success:
|
|
print("\nVERDICT: All snippets verified successfully")
|
|
sys.exit(0)
|
|
else:
|
|
print("\nVERDICT: Some snippets failed verification")
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main() |