2026-07-22 16:01:28 +08:00
|
|
|
package spike
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestRunPoseRejectsWrongInputLengthBeforeLoadingRuntime(t *testing.T) {
|
|
|
|
|
_, err := RunPose("missing.onnx", "missing.dll", []float32{0})
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Fatal("RunPose accepted an input that is not 1x3x640x640")
|
|
|
|
|
}
|
|
|
|
|
if !strings.Contains(err.Error(), "input length") {
|
|
|
|
|
t.Fatalf("RunPose error = %q, want input length error", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-07-22 16:18:16 +08:00
|
|
|
|
|
|
|
|
func TestOpenRuntimeReportsMissingDLL(t *testing.T) {
|
|
|
|
|
_, err := OpenRuntime("missing.onnx", "missing.dll")
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Fatal("OpenRuntime accepted a missing ONNX Runtime DLL")
|
|
|
|
|
}
|
|
|
|
|
if !strings.Contains(err.Error(), "initialize ONNX Runtime") {
|
|
|
|
|
t.Fatalf("OpenRuntime error = %q", err)
|
|
|
|
|
}
|
|
|
|
|
}
|