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