av/cmd/rv/probe_test.go

24 lines
500 B
Go
Raw Normal View History

package main
import (
2022-01-10 06:47:52 +03:00
"io/ioutil"
"testing"
2022-01-10 06:47:52 +03:00
)
2022-01-11 07:05:53 +03:00
// TestProbe reads a given video file and writes the sharpness and contrast scores to a turbidity probe
func TestProbe(t *testing.T) {
ts := new(turbidityProbe)
2022-01-11 07:05:53 +03:00
video, err := ioutil.ReadFile("logo.h264")
2022-01-10 06:47:52 +03:00
if err != nil {
2022-01-11 07:05:53 +03:00
t.Fatalf("failed to read file: %v", err)
2022-01-10 06:47:52 +03:00
}
2022-01-11 07:05:53 +03:00
_, err = ts.Write(video)
2022-01-10 06:47:52 +03:00
if err != nil {
2022-01-11 07:05:53 +03:00
t.Fatalf("failed to write sharpness and contrast: %v", err)
2022-01-10 06:47:52 +03:00
}
2022-01-11 07:05:53 +03:00
t.Logf("contrast: %v, sharpness: %v\n", ts.contrast, ts.sharpness)
}