mirror of
https://github.com/JamesTheGiblet/BuddAI.git
synced 2026-01-08 21:58:40 +00:00
Add unit tests for analytics, fallback client, and refactored validators
- Implemented comprehensive unit tests for the BuddAI Analytics module, covering fallback statistics calculations. - Created tests for the FallbackClient to ensure proper escalation to various AI models and handling of missing API keys. - Developed unit tests for the refactored validator system, validating various hardware and coding standards. - Established a base validator interface and implemented specific validators for ESP32, Arduino, motor control, memory safety, and more. - Enhanced the validator registry to auto-discover and manage validators effectively. - Included detailed validation logic for common issues in embedded systems programming, such as unused variables, safety timeouts, and coding style violations.
This commit is contained in:
parent
99ef8f5592
commit
d4e09f6d13
43 changed files with 5036 additions and 622 deletions
|
|
@ -349,6 +349,20 @@ class SmartLearner:
|
|||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
def store_rule(self, pattern: str, confidence: float, source: str):
|
||||
"""Store a single rule from fallback or other sources"""
|
||||
conn = sqlite3.connect(DB_PATH)
|
||||
cursor = conn.cursor()
|
||||
|
||||
cursor.execute("""
|
||||
INSERT INTO code_rules
|
||||
(rule_text, pattern_find, pattern_replace, confidence, learned_from)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
""", (pattern, "", "", confidence, source))
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
def diff_code(self, original: str, corrected: str) -> str:
|
||||
"""Generate a simple diff"""
|
||||
return "\n".join(difflib.unified_diff(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue