Skip to content

test: add comprehensive integration tests for Prototypes module - #761

Merged
ooples merged 1 commit into
masterfrom
test/prototypes-integration-tests
Jan 24, 2026
Merged

ooples merged 1 commit into
masterfrom
test/prototypes-integration-tests

Conversation

@ooples

@ooples ooples commented Jan 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add 58 comprehensive integration tests for the Prototypes module
  • Tests cover PrototypeVector, PrototypeAdamOptimizer, SimpleLinearRegression, and SimpleNeuralNetwork
  • Remove stale CLBlast project reference from test project

Tests Added

PrototypeVector (26 tests)

  • Constructor and indexer operations
  • Factory methods (Zeros, Ones, FromArray)
  • Arithmetic operations (Add, Subtract, Multiply, Divide)
  • Mathematical functions (Sqrt, Power)
  • Length mismatch validation
  • Multi-type support (double, float, decimal)

PrototypeAdamOptimizer (12 tests)

  • Constructor with default and custom parameters
  • Parameter update behavior
  • Time step tracking
  • State reset
  • Convergence verification
  • Null argument validation

SimpleLinearRegression (9 tests)

  • Model initialization
  • Single and batch predictions
  • Training reduces MSE
  • MSE and R2 score computation
  • Learning synthetic data

SimpleNeuralNetwork (11 tests)

  • Network initialization and deterministic seeding
  • Forward pass output
  • Loss computation
  • Gradient computation and backward pass
  • Parameter get/set
  • XOR training scenario

Test plan

  • All 58 tests pass on net10.0 framework
  • Build succeeds with no errors
  • No breaking changes to existing code

Closes #667

🤖 Generated with Claude Code

Add 58 integration tests covering PrototypeVector, PrototypeAdamOptimizer,
SimpleLinearRegression, and SimpleNeuralNetwork classes.

Tests include:
- PrototypeVector: construction, indexing, arithmetic operations, factory methods
- PrototypeAdamOptimizer: construction, parameter updates, convergence behavior
- SimpleLinearRegression: training, prediction, MSE/R2 computation
- SimpleNeuralNetwork: forward/backward passes, XOR training scenario
- Cross-component integration scenarios

Also removes stale CLBlast project reference from test project.

Closes #667

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jan 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
aidotnet-playground-api Ready Ready Preview, Comment Jan 23, 2026 9:41pm

@coderabbitai

coderabbitai Bot commented Jan 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • Tests

    • Introduced comprehensive integration test suite for prototype components covering vector operations, optimizer behavior, linear regression training and accuracy, neural network computations, and cross-component scenarios with numerical stability validation.
  • Chores

    • Removed unused project dependency reference.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Removed a native CLBlast project dependency from test configuration and added comprehensive integration tests for the Prototypes module, including PrototypeVector, PrototypeAdamOptimizer, SimpleLinearRegression, SimpleNeuralNetwork, and cross-component operations.

Changes

Cohort / File(s) Summary
Project Configuration
tests/AiDotNet.Tests/AiDotNetTests.csproj
Removed ProjectReference to AiDotNet.Native.CLBlast.csproj from net10.0 condition group
Prototypes Integration Tests
tests/AiDotNet.Tests/IntegrationTests/Prototypes/PrototypesIntegrationTests.cs
New comprehensive test suite covering PrototypeVector construction/indexing/arithmetic, PrototypeAdamOptimizer parameter updates/convergence, SimpleLinearRegression training/predictions, SimpleNeuralNetwork forward/backward passes, XOR training, and cross-component integration scenarios with 50+ test methods

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Suggested labels

feature

Poem

🐰 Hop hop, tests arise,
Vector, Optimizer, Network in size,
CLBlast removed with care,
Integration tests everywhere!
Coverage blooms, quality shines bright,
Prototypes tested right! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR adds comprehensive integration tests for PrototypeVector, PrototypeAdamOptimizer, SimpleLinearRegression, and SimpleNeuralNetwork, addressing issue #667's requirement for integration tests covering prototype network operations. However, no tests for distance computations or classification are evident, and coverage metrics are not documented. Verify that all Prototypes module test categories (prototype network operations, distance computations, classification) are adequately covered and document the achieved test coverage percentage to confirm the 80%+ criterion.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'test: add comprehensive integration tests for Prototypes module' directly and clearly describes the main change—adding integration tests for the Prototypes module.
Description check ✅ Passed The description is fully related to the changeset, providing detailed information about the 58 integration tests added for various components of the Prototypes module and the removal of the CLBlast reference.
Out of Scope Changes check ✅ Passed All code changes align with the PR's stated objectives: adding integration tests for the Prototypes module and removing a stale CLBlast reference. No unrelated changes are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/prototypes-integration-tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@ooples
ooples merged commit 634bf99 into master Jan 24, 2026
41 checks passed
@ooples
ooples deleted the test/prototypes-integration-tests branch January 24, 2026 02:18
ooples added a commit that referenced this pull request Jan 24, 2026
Add 58 integration tests covering PrototypeVector, PrototypeAdamOptimizer,
SimpleLinearRegression, and SimpleNeuralNetwork classes.

Tests include:
- PrototypeVector: construction, indexing, arithmetic operations, factory methods
- PrototypeAdamOptimizer: construction, parameter updates, convergence behavior
- SimpleLinearRegression: training, prediction, MSE/R2 computation
- SimpleNeuralNetwork: forward/backward passes, XOR training scenario
- Cross-component integration scenarios

Also removes stale CLBlast project reference from test project.

Closes #667

Co-authored-by: franklinic <franklin@ivorycloud.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
ooples added a commit that referenced this pull request Jan 26, 2026
* test: add comprehensive Serving module integration tests (#670)

Add 62 integration tests covering:
- ContinuousBatcherConfig (defaults, configuration, model presets)
- BatchSchedulerConfig (defaults, model-specific configs)
- BatchScheduler<T> (scheduling, preemption, cancellation, statistics)
- SequenceState<T> (lifecycle, token management, stop conditions)
- GenerationRequest<T> (configuration options)
- GenerationResult<T> (result data)
- BatcherStatistics and SchedulerStatistics
- SequenceStatus, StopReason, SchedulingPolicy enums
- Full integration workflows

Also remove stale CLBlast project reference from test project.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test: add comprehensive FineTuning module integration tests (#640) (#753)

Add 49 integration tests covering all 16 fine-tuning methods:
- SFT (Supervised Fine-Tuning)
- DPO (Direct Preference Optimization)
- SimPO (Simple Preference Optimization)
- ORPO (Odds Ratio Preference Optimization)
- IPO (Identity Preference Optimization)
- RDPO (Robust Direct Preference Optimization)
- KTO (Kahneman-Tversky Optimization)
- CPO (Contrastive Preference Optimization)
- RLHF-PPO (Reinforcement Learning Human Feedback)
- GRPO (Group Relative Policy Optimization)
- PRO (Pairwise Ranking Optimization)
- RRHF (Rank Responses Human Feedback)
- RSO (Statistical Rejection Sampling)
- SPIN (Self-Play Fine-Tuning)
- CAI (Constitutional AI)

Tests cover:
- Constructor initialization
- Fine-tuning workflow completion
- Data validation (SFT, Preference, RL, Ranking)
- Serialization/deserialization
- Edge cases and parameter handling
- Cancellation support

Also removes stale CLBlast project reference from test project.

Co-authored-by: franklinic <franklin@ivorycloud.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* test: add Evaluation integration tests (#655) (#765)

Add 51 comprehensive integration tests for the Evaluation module covering:
- Enums: PredictionType (BinaryClassification, Regression, MultiClass, MultiLabel)
- DefaultModelEvaluator: Construction, options handling
- PredictionStatsOptions: Default values, configuration
- PredictionTypeInference: Inference from vectors, matrices, tensors

Tests validate prediction type inference logic including:
- Binary classification detection (0/1 labels)
- Multi-class detection (integer labels with low unique ratio)
- Regression detection (continuous values, NaN, infinity, high unique ratio)
- Multi-label detection (matrix with multiple positives per row)

Also fixes stale CLBlast project reference in test project.

Co-authored-by: franklinic <franklin@ivorycloud.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* test: add ProgramSynthesis integration tests (#665) (#763)

Add 50 comprehensive integration tests for the ProgramSynthesis module covering:
- Models: CodePosition, CodeSpan, CodeLocation, CodeIssue, Program<T>
- Enums: ProgramLanguage, CodeTask, CodeIssueSeverity, SqlDialect, etc.
- Execution: CompilationDiagnostic, SqlValue, ProgramExecuteResponse
- Results: CodeGenerationResult

All tests validate model construction, property access, and default values.

Co-authored-by: franklinic <franklin@ivorycloud.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* test: add comprehensive integration tests for PromptEngineering module (#762)

Add 81 integration tests covering Templates, Analysis, FewShot selectors,
Compression, Chains, and Tools components.

Tests include:
- SimplePromptTemplate: construction, variable extraction, formatting, validation
- PromptMetrics: property values and timestamp behavior
- PromptIssue and IssueSeverity: issue tracking and severity levels
- ValidationOptions: default, strict, and lenient configurations
- CompressionResult: token savings, compression ratio, success detection
- CompressionOptions: default, aggressive, conservative presets
- FixedExampleSelector: example management and selection behavior
- ToolRegistry: registration, execution, case-insensitivity, descriptions
- SequentialChain: step management, sync/async execution, cancellation
- FewShotExample: model properties

Also removes stale CLBlast project reference from test project.

Closes #666

Co-authored-by: franklinic <franklin@ivorycloud.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* test: add comprehensive integration tests for Prototypes module (#761)

Add 58 integration tests covering PrototypeVector, PrototypeAdamOptimizer,
SimpleLinearRegression, and SimpleNeuralNetwork classes.

Tests include:
- PrototypeVector: construction, indexing, arithmetic operations, factory methods
- PrototypeAdamOptimizer: construction, parameter updates, convergence behavior
- SimpleLinearRegression: training, prediction, MSE/R2 computation
- SimpleNeuralNetwork: forward/backward passes, XOR training scenario
- Cross-component integration scenarios

Also removes stale CLBlast project reference from test project.

Closes #667

Co-authored-by: franklinic <franklin@ivorycloud.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* test: add comprehensive TrainingMonitoring module integration tests (#673) (#755)

Add 92 integration tests for the TrainingMonitoring module covering:

- TrainingMonitor<T>: session lifecycle, metric logging, progress tracking,
  speed stats, resource usage, issue detection, and data export
- ResourceMonitor: lifecycle, snapshots, history, threshold alerts, events
- ExperimentTracker: experiments, runs, parameters, metrics, artifacts,
  tags, deletion/restoration, persistence, and search
- NotificationManager: services, sending, filtering, buffering, events
- Dashboard implementations (ConsoleDashboard, HtmlDashboard, LiveDashboard):
  scalar/histogram logging, hyperparameters, confusion matrix, reports
- Cross-module integration tests combining multiple components

Also removes stale CLBlast project reference from test project.

Co-authored-by: franklinic <franklin@ivorycloud.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Add comprehensive integration tests for AiDotNet.Serving module

Added 42 integration tests covering:
- ServingOptions configuration defaults and custom values
- StartupModel property validation
- PerformanceMetrics recording, percentiles, and statistics
- ContinuousBatchingStrategy concurrency and adaptive behavior
- TimeoutBatchingStrategy timeout-based processing
- SizeBatchingStrategy fixed-size batching
- AdaptiveBatchingStrategy latency-based adaptation
- BucketBatchingStrategy bucket index handling
- Padding strategies (Minimal, Bucket, Fixed) data preservation
- Configuration enum value verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: replace thread.sleep with deterministic timestamp in queue time test

Instead of using Thread.Sleep(50) which is flaky under CI load,
directly set GenerationStartedAt to a known offset from CreatedAt.
This makes the test deterministic and asserts the exact expected
duration instead of using >= comparison.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: use net471-compatible Enum.GetValues in serving tests

Replace Enum.GetValues<T>() (NET 5+ only) with
Enum.GetValues(typeof(T)).Cast<T>() for .NET Framework 4.7.1 compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: franklinic <franklin@ivorycloud.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — 9c38052a Deployed Jan 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Feature work item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Add integration tests for Prototypes module [P3]

2 participants