Add comprehensive test suite for BuddAI v3.1

- Implemented tests for database initialization, SQL injection prevention, auto-learning pattern extraction, module detection, complexity detection, LRU cache performance, session export, actionable suggestions, repository indexing, search query safety, and context window management.
- Utilized SQLite for database operations and temporary directories for test isolation.
- Included detailed output for test results with color-coded pass/fail indicators.
This commit is contained in:
JamesTheGiblet 2025-12-29 13:38:31 +00:00
parent 406d848203
commit da3530774b
8 changed files with 1885 additions and 21 deletions

View file

@ -0,0 +1,78 @@
/*
* BuddAI Complex Test Sketch
* Purpose: Verify .ino detection in frontend
*/
#include <Arduino.h>
// Configuration
const int LED_PIN = 2;
const int SENSOR_PIN = 34;
const unsigned long INTERVAL = 1000;
// State Machine
enum State {
IDLE,
ACTIVE,
ERROR
};
State currentState = IDLE;
unsigned long previousMillis = 0;
// Function Prototypes
void updateState();
void handleSensors();
void setup() {
Serial.begin(115200);
pinMode(LED_PIN, OUTPUT);
pinMode(SENSOR_PIN, INPUT);
Serial.println("BuddAI System Initialized");
Serial.println("Waiting for input...");
}
void loop() {
unsigned long currentMillis = millis();
// Non-blocking timer
if (currentMillis - previousMillis >= INTERVAL) {
previousMillis = currentMillis;
updateState();
}
handleSensors();
}
void updateState() {
switch (currentState) {
case IDLE:
digitalWrite(LED_PIN, LOW);
Serial.println("State: IDLE");
currentState = ACTIVE;
break;
case ACTIVE:
digitalWrite(LED_PIN, HIGH);
Serial.println("State: ACTIVE");
// Simulate work
currentState = IDLE;
break;
case ERROR:
digitalWrite(LED_PIN, HIGH);
delay(100);
digitalWrite(LED_PIN, LOW);
delay(100);
break;
}
}
void handleSensors() {
int reading = analogRead(SENSOR_PIN);
if (reading > 4000) {
currentState = ERROR;
Serial.println("Alert: Sensor Overload!");
}
}

View file

@ -0,0 +1,21 @@
// Define the LED pin
const int ledPin = 9;
void setup() {
// Set up the LED pin as an output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Turn the LED on
digitalWrite(ledPin, HIGH);
// Wait for 1 second (1000 milliseconds)
delay(1000);
// Turn the LED off
digitalWrite(ledPin, LOW);
// Wait for another 1 second
delay(1000);
}

View file

@ -0,0 +1 @@
[object Object]