2022-01-07 07:12:15 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-01-10 06:47:52 +03:00
|
|
|
"io/ioutil"
|
2022-01-07 07:12:15 +03:00
|
|
|
"testing"
|
2022-01-10 06:47:52 +03:00
|
|
|
)
|
2022-01-07 07:12:15 +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-07 07:12:15 +03:00
|
|
|
|
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-07 07:12:15 +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-07 07:12:15 +03:00
|
|
|
|
2022-01-11 07:05:53 +03:00
|
|
|
t.Logf("contrast: %v, sharpness: %v\n", ts.contrast, ts.sharpness)
|
2022-01-07 07:12:15 +03:00
|
|
|
}
|