mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
492902cd2f
## Problem Learning data, patterns, and Q-values were not being persisted correctly due to database fragmentation across three separate files: - .agentic-qe/memory.db (MCP writes) - .agentic-qe/data/swarm-memory.db (CLI reads - wrong path) - .agentic-qe/agentdb.db (created but never used) ## Solution Unified ALL persistence to single database via SwarmMemoryManager singleton. ### Core Persistence Fixes - CLI commands now use getSharedMemoryManager() instead of hardcoded paths - learn status queries learning_experiences, patterns, q_values tables directly - patterns list queries patterns table instead of memory_entries - Removed agentDB default path from BaseAgent and agent factory - database-init no longer creates separate agentdb.db - Added queryRaw() method to SwarmMemoryManager for direct table queries ### New Self-Learning Features (Issue #118) - HNSWVectorMemory: 35K ops/sec vector search with HNSW indexing - ExplainableLearning: Natural language explanations for learning decisions - GossipPatternSharingProtocol: Distributed pattern sharing across agents - TransferLearningManager: Cross-domain knowledge transfer - PerformanceOptimizer: Adaptive performance tuning - PrivacyManager: GDPR/HIPAA compliant data handling - MAMLMetaLearner: Model-Agnostic Meta-Learning - HybridRouter: 80% local / 20% cloud routing with 63% cost savings - LearningTelemetry: OpenTelemetry integration for observability ### CI/CD & Testing - learning-integration.yml workflow for CI validation - Comprehensive unit tests for new learning modules - Performance benchmarks for learning operations - Quality validation test suite ### Frontend - learningApi.ts service for dashboard integration - TypeScript types for learning data structures ### Documentation - Sherlock investigation report for Issue #118 ### Version Updated to v2.2.1 Closes #118 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
/**
|
|
* Unit tests for add function
|
|
* Generated by: qe-test-generator
|
|
* Framework: Jest
|
|
* Test Type: Unit test with boundary analysis
|
|
*/
|
|
|
|
import { add } from '../../../src/utils/math';
|
|
|
|
describe('add', () => {
|
|
describe('basic functionality', () => {
|
|
it('should add two positive numbers', () => {
|
|
expect(add(2, 3)).toBe(5);
|
|
});
|
|
|
|
it('should add two negative numbers', () => {
|
|
expect(add(-2, -3)).toBe(-5);
|
|
});
|
|
|
|
it('should add a positive and negative number', () => {
|
|
expect(add(5, -3)).toBe(2);
|
|
});
|
|
|
|
it('should handle zero as first operand', () => {
|
|
expect(add(0, 5)).toBe(5);
|
|
});
|
|
|
|
it('should handle zero as second operand', () => {
|
|
expect(add(5, 0)).toBe(5);
|
|
});
|
|
|
|
it('should handle both operands as zero', () => {
|
|
expect(add(0, 0)).toBe(0);
|
|
});
|
|
});
|
|
|
|
describe('boundary cases', () => {
|
|
it('should handle very large numbers', () => {
|
|
expect(add(Number.MAX_SAFE_INTEGER - 1, 1)).toBe(Number.MAX_SAFE_INTEGER);
|
|
});
|
|
|
|
it('should handle very small numbers', () => {
|
|
expect(add(Number.MIN_SAFE_INTEGER + 1, -1)).toBe(Number.MIN_SAFE_INTEGER);
|
|
});
|
|
|
|
it('should handle decimal numbers', () => {
|
|
expect(add(0.1, 0.2)).toBeCloseTo(0.3, 10);
|
|
});
|
|
|
|
it('should handle negative decimal numbers', () => {
|
|
expect(add(-0.5, -0.3)).toBeCloseTo(-0.8, 10);
|
|
});
|
|
});
|
|
|
|
describe('edge cases', () => {
|
|
it('should handle infinity', () => {
|
|
expect(add(Infinity, 5)).toBe(Infinity);
|
|
expect(add(-Infinity, 5)).toBe(-Infinity);
|
|
});
|
|
|
|
it('should handle NaN', () => {
|
|
expect(add(NaN, 5)).toBe(NaN);
|
|
});
|
|
});
|
|
});
|