go-whisper-api/punctuation/punctuation_test.go
admin b5c083e06f
Some checks failed
CodeQL / Analyze (go) (push) Successful in 6m28s
Docker Image / build-docker (push) Failing after 13m26s
Lint and Testing / lint (push) Successful in 11m17s
Lint and Testing / test (push) Successful in 11m17s
Lint and Testing / golangci (push) Successful in 2m40s
first commit
2026-06-04 18:10:52 +07:00

41 lines
856 B
Go

package punctuation
import (
"context"
"testing"
"go-whisper-api/config"
)
func TestNop(t *testing.T) {
r, err := New(config.Punctuation{Engine: "off"})
if err != nil {
t.Fatal(err)
}
out, err := Apply(context.Background(), r, true, "hello world", "en")
if err != nil {
t.Fatal(err)
}
if out != "hello world" {
t.Fatalf("got %q", out)
}
}
func TestApply_disabled(t *testing.T) {
r := Heuristic{}
out, err := Apply(context.Background(), r, false, "hello", "en")
if err != nil || out != "hello" {
t.Fatalf("got %q err=%v", out, err)
}
}
func TestNew_heuristic(t *testing.T) {
r, err := New(config.Punctuation{Enabled: true, Engine: "heuristic"})
if err != nil {
t.Fatal(err)
}
if !r.Active() {
t.Fatal("expected active")
}
}