package cwdecode

import (
	"fmt"
	"testing"
)

// TestDebugTrace prints the element stream for a chosen case — a development
// aid, not an assertion test. Run with: go test -run TestDebugTrace -v
func TestDebugTrace(t *testing.T) {
	if testing.Short() {
		t.Skip("debug aid")
	}
	const fs = 16000
	samples := keyMessage("CQ TEST DE F4BPO K", fs, 40, 700, 9000)
	var d *Decoder
	d = New(fs, func(s string) { fmt.Printf("EMIT %q (muDit=%.0f muDah=%.0f)\n", s, d.muDit, d.muDah) }, nil)
	lastMarks := 0
	for i := 0; i < len(samples); i += 256 {
		end := i + 256
		if end > len(samples) {
			end = len(samples)
		}
		d.Process(samples[i:end])
		if d.marksSeen != lastMarks {
			lastMarks = d.marksSeen
			fmt.Printf("mark#%d elems=%v muDit=%.0f muDah=%.0f\n", d.marksSeen, d.elemMs, d.muDit, d.muDah)
		}
	}
}
