Selaa lähdekoodia

feat: report source label in dry-run summaries

tags/v0.4.0-pre
Jan Svabenik 1 kuukausi sitten
vanhempi
commit
02a9b6176d
3 muutettua tiedostoa jossa 19 lisäystä ja 1 poistoa
  1. +1
    -1
      docs/README.md
  2. +6
    -0
      internal/dryrun/dryrun.go
  3. +12
    -0
      internal/dryrun/dryrun_test.go

+ 1
- 1
docs/README.md Näytä tiedosto

@@ -55,7 +55,7 @@ Current patchable runtime fields via `POST /config`:
## Dry run

The dry-run mode generates a synthetic, hardware-free frame summary based on the current config.
It is intended as a no-hardware smoke path for the CLI and config/control-adjacent logic.
It now reports the active source label as well, so dry-run output is less disconnected from the offline/sim paths.

The HTTP control plane also exposes `GET /dry-run` for quick inspection of the currently effective no-hardware summary.



+ 6
- 0
internal/dryrun/dryrun.go Näytä tiedosto

@@ -19,6 +19,7 @@ type FrameSummary struct {
PilotLevel float64 `json:"pilotLevel"`
RDSInjection float64 `json:"rdsInjection"`
OutputDrive float64 `json:"outputDrive"`
Source string `json:"source"`
PreviewSamples []float64 `json:"previewSamples"`
}

@@ -32,6 +33,10 @@ func Generate(cfg cfgpkg.Config) FrameSummary {
}
preview[i] = sign * base * float64(i+1) / 16.0
}
source := "tones"
if cfg.Audio.InputPath != "" {
source = cfg.Audio.InputPath
}
return FrameSummary{
Mode: "dry-run",
FrequencyMHz: cfg.FM.FrequencyMHz,
@@ -42,6 +47,7 @@ func Generate(cfg cfgpkg.Config) FrameSummary {
PilotLevel: cfg.FM.PilotLevel,
RDSInjection: cfg.FM.RDSInjection,
OutputDrive: cfg.FM.OutputDrive,
Source: source,
PreviewSamples: preview,
}
}


+ 12
- 0
internal/dryrun/dryrun_test.go Näytä tiedosto

@@ -17,6 +17,18 @@ func TestGenerate(t *testing.T) {
if len(frame.PreviewSamples) != 16 {
t.Fatalf("unexpected preview length: %d", len(frame.PreviewSamples))
}
if frame.Source != "tones" {
t.Fatalf("unexpected source: %s", frame.Source)
}
}

func TestGenerateUsesInputPathAsSource(t *testing.T) {
cfg := cfgpkg.Default()
cfg.Audio.InputPath = "demo.wav"
frame := Generate(cfg)
if frame.Source != "demo.wav" {
t.Fatalf("unexpected source: %s", frame.Source)
}
}

func TestWriteJSONFile(t *testing.T) {


Loading…
Peruuta
Tallenna