fix(09-01): add TestGroupFieldPopulated, fix oscillator normalization, update tests
- Add TestGroupFieldPopulated test to verify all ClassFreqConfigs have non-empty Group (GRP-01) - Change TestHarmonicsNonEmpty threshold from < 2 to < 1 (accepts single-harmonic sine entries) - Fix oscillator Advance() to use math.Abs(h.Amplitude) for normalization weight accumulation: triangle wave uses alternating-sign amplitudes; signed sum underestimates totalWeight causing output to exceed [-1,1] bounds when using WaveformPresetHarmonics (Rule 1 bug fix) - Update TestStereoPan to use ClassSSH (pan=-0.7) instead of ClassDHCP (pan changed to 0.1) - Update TestNewBankCustomConfigNoClip: passes after oscillator normalization fix - Fix TestLoadPartialOverrideFrequency: derive expected WaveformType from defaults (not hardcoded 0) - Fix TestAutoFreqSkipsBuiltins: derive expected HTTPS BaseHz from defaults (150.0 in Phase 9)
This commit is contained in:
@@ -27,7 +27,7 @@ func writeTOML(t *testing.T, content string) string {
|
||||
}
|
||||
|
||||
// TestLoadPartialOverrideFrequency: setting only frequency for ICMP overrides BaseHz,
|
||||
// leaves WaveformType unchanged (WaveformCustom), and leaves other classes unchanged.
|
||||
// leaves WaveformType unchanged (preserves default), and leaves other classes unchanged.
|
||||
func TestLoadPartialOverrideFrequency(t *testing.T) {
|
||||
path := writeTOML(t, "[sounds.ICMP]\nfrequency = 100.0\n")
|
||||
|
||||
@@ -40,8 +40,10 @@ func TestLoadPartialOverrideFrequency(t *testing.T) {
|
||||
if cfgs[classify.ClassICMP].BaseHz != 100.0 {
|
||||
t.Errorf("ICMP BaseHz: got %v, want 100.0", cfgs[classify.ClassICMP].BaseHz)
|
||||
}
|
||||
if cfgs[classify.ClassICMP].WaveformType != synth.WaveformCustom {
|
||||
t.Errorf("ICMP WaveformType: got %v, want WaveformCustom (0)", cfgs[classify.ClassICMP].WaveformType)
|
||||
// WaveformType should remain unchanged from the default (Phase 9: WaveformTriangle for ICMP)
|
||||
wantWaveform := synth.ClassFreqConfigs[classify.ClassICMP].WaveformType
|
||||
if cfgs[classify.ClassICMP].WaveformType != wantWaveform {
|
||||
t.Errorf("ICMP WaveformType: got %v, want %v (default, unchanged)", cfgs[classify.ClassICMP].WaveformType, wantWaveform)
|
||||
}
|
||||
// DNS should be unchanged
|
||||
want := synth.ClassFreqConfigs[classify.ClassDNS].BaseHz
|
||||
@@ -559,7 +561,7 @@ class = "GameServer"
|
||||
}
|
||||
|
||||
// TestAutoFreqSkipsBuiltins: TOML with [[rules]] (class="HTTPS", protocol="tcp", port=443)
|
||||
// -> FreqCfgs["HTTPS"].BaseHz == 150.0 (the default), NOT an auto-assigned value.
|
||||
// -> FreqCfgs["HTTPS"].BaseHz == 150.0 (Phase 9 default), NOT an auto-assigned value.
|
||||
func TestAutoFreqSkipsBuiltins(t *testing.T) {
|
||||
toml := `
|
||||
[[rules]]
|
||||
@@ -573,8 +575,9 @@ class = "HTTPS"
|
||||
if err != nil {
|
||||
t.Fatalf("Load: %v", err)
|
||||
}
|
||||
if result.FreqCfgs[classify.ClassHTTPS].BaseHz != 150.0 {
|
||||
t.Errorf("HTTPS BaseHz: got %v, want 150.0 (default, not auto-assigned)", result.FreqCfgs[classify.ClassHTTPS].BaseHz)
|
||||
wantHz := synth.ClassFreqConfigs[classify.ClassHTTPS].BaseHz
|
||||
if result.FreqCfgs[classify.ClassHTTPS].BaseHz != wantHz {
|
||||
t.Errorf("HTTPS BaseHz: got %v, want %.1f (default, not auto-assigned)", result.FreqCfgs[classify.ClassHTTPS].BaseHz, wantHz)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user