mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-07 13:37:44 +00:00
test: refine robustness test to be more agnostic
This commit is contained in:
Vendored
+31
-29
@@ -1,12 +1,12 @@
|
||||
{
|
||||
// ???????????????????????????????????????????????????????????????????
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
// GitHub Copilot Settings for QuanTAlib Workspace
|
||||
// Optimized for high-performance financial library development
|
||||
// ???????????????????????????????????????????????????????????????????
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// Copilot Core Settings
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
// Enable Copilot completions (suggestions appear automatically)
|
||||
"github.copilot.editor.enableAutoCompletions": true,
|
||||
@@ -25,9 +25,9 @@
|
||||
// Always show the inline suggestion toolbar
|
||||
"editor.inlineSuggest.showToolbar": "always",
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// Copilot Chat Settings (Manual Review Required)
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
// DO NOT auto-apply chat edits - require manual review for quality control
|
||||
"chat.editing.autoApply": "off",
|
||||
@@ -38,9 +38,9 @@
|
||||
// Show chat panel on the side
|
||||
"chat.editor.wordWrap": "on",
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// Editor Settings for Productivity
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
// Enable quick suggestions in all contexts
|
||||
"editor.quickSuggestions": {
|
||||
@@ -64,9 +64,9 @@
|
||||
// Tab key behavior
|
||||
"editor.tabCompletion": "on",
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// C# Specific Settings
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
"[csharp]": {
|
||||
"editor.formatOnSave": true,
|
||||
@@ -81,14 +81,16 @@
|
||||
}
|
||||
},
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// Performance & Quality Control
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
// Save automatically (helps with Copilot context)
|
||||
"files.autoSave": "afterDelay",
|
||||
"files.autoSaveDelay": 1000,
|
||||
|
||||
// Force LF line endings (matches .gitattributes and .editorconfig)
|
||||
"files.eol": "\n",
|
||||
// Show whitespace (important for performance-critical code)
|
||||
"editor.renderWhitespace": "boundary",
|
||||
|
||||
@@ -99,9 +101,9 @@
|
||||
"editor.bracketPairColorization.enabled": true,
|
||||
"editor.guides.bracketPairs": true,
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// Git Integration
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
// Auto-fetch git changes
|
||||
"git.autofetch": true,
|
||||
@@ -116,9 +118,9 @@
|
||||
"terminal.integrated.suggest.enabled": true,
|
||||
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// File Exclusions (Reduce Noise)
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
"files.exclude": {
|
||||
"**/bin": true,
|
||||
@@ -136,17 +138,17 @@
|
||||
"**/coverage": true
|
||||
},
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// .NET Specific Settings
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
"omnisharp.enableEditorConfigSupport": true,
|
||||
"omnisharp.enableRoslynAnalyzers": true,
|
||||
"dotnet.backgroundAnalysis.enabled": true,
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// Testing Integration
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
"dotnet.defaultSolution": "QuanTAlib.sln",
|
||||
"dotnet.testController.enabled": true,
|
||||
@@ -163,9 +165,9 @@
|
||||
"qodana.pathPrefix": "",
|
||||
"qodana.args": ["--config", ".qodana/qodana.yaml"],
|
||||
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
// Terminal Settings
|
||||
// ?????????????????????????????????????????????????????????????????
|
||||
// ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
// Set PowerShell 7 as the default terminal on Windows
|
||||
"terminal.integrated.defaultProfile.windows": "PowerShell",
|
||||
@@ -189,11 +191,11 @@
|
||||
},
|
||||
"coderabbit.autoReviewMode": "disabled"
|
||||
|
||||
// ???????????????????????????????????????????????????????????????????
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
// Keyboard Shortcuts Reference
|
||||
// ???????????????????????????????????????????????????????????????????
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
// Tab - Accept inline suggestion
|
||||
// Ctrl+? - Accept next word
|
||||
// Ctrl+Right - Accept next word
|
||||
// Ctrl+Enter - Accept line
|
||||
// Esc - Dismiss suggestion
|
||||
// Alt+] - Next suggestion
|
||||
@@ -201,8 +203,8 @@
|
||||
// Ctrl+I - Open Copilot Chat
|
||||
//
|
||||
// Quality Control Reminders:
|
||||
// ? Review all Copilot suggestions for optimization patterns
|
||||
// ? Run tests after accepting: dotnet test
|
||||
// ? Check performance impact with benchmarks
|
||||
// ? Validate against reference implementations
|
||||
// - Review all Copilot suggestions for optimization patterns
|
||||
// - Run tests after accepting: dotnet test
|
||||
// - Check performance impact with benchmarks
|
||||
// - Validate against reference implementations
|
||||
}
|
||||
|
||||
@@ -51,31 +51,27 @@ public class IndicatorPropertiesTests
|
||||
[Fact]
|
||||
public void Indicator_ShouldRecoverFromNaN_WhenReset()
|
||||
{
|
||||
var ema = new Ema(period: 10);
|
||||
|
||||
// Feed valid value
|
||||
ema.Update(new TValue(DateTime.Today.AddDays(1), 100));
|
||||
|
||||
// Feed NaN, which should corrupt state
|
||||
ema.Update(new TValue(DateTime.Today.AddDays(2), double.NaN));
|
||||
var sma = new Sma(period: 10);
|
||||
|
||||
// Let's actually ensure it is corrupted depending on implementation
|
||||
// Some robust implementations might discard NaN internally, so we don't assert it strictly
|
||||
// We just ensure it recovers properly.
|
||||
// Feed valid value
|
||||
sma.Update(new TValue(DateTime.Today.AddDays(1), 100));
|
||||
|
||||
// Feed NaN, which should corrupt state
|
||||
sma.Update(new TValue(DateTime.Today.AddDays(2), double.NaN));
|
||||
|
||||
// Reset should clear the corrupted state
|
||||
ema.Reset();
|
||||
|
||||
sma.Reset();
|
||||
|
||||
// Feed valid value again
|
||||
ema.Update(new TValue(DateTime.Today.AddDays(3), 100));
|
||||
|
||||
sma.Update(new TValue(DateTime.Today.AddDays(3), 100));
|
||||
|
||||
// Wait for Warmup
|
||||
for (int i = 4; i < 3 + ema.WarmupPeriod; i++) {
|
||||
ema.Update(new TValue(DateTime.Today.AddDays(i), 100));
|
||||
for (int i = 4; i < 3 + sma.WarmupPeriod; i++) {
|
||||
sma.Update(new TValue(DateTime.Today.AddDays(i), 100));
|
||||
}
|
||||
|
||||
|
||||
// Verify recovery after warmup
|
||||
Assert.False(double.IsNaN(ema.Last.Value));
|
||||
Assert.Equal(100, Math.Round(ema.Last.Value, 5));
|
||||
Assert.False(double.IsNaN(sma.Last.Value));
|
||||
Assert.Equal(100, Math.Round(sma.Last.Value, 5));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user