package protocol_test import ( "encoding/hex" "os" "os/exec" "path/filepath" "strings" "testing" "hth/internal/protocol" "hth/internal/testutil" ) func TestIndependentPythonOracleMatchesGoSETALL(t *testing.T) { py := os.Getenv("PYTHON") if py == "" { py = "python3" } oracle := filepath.Join(testutil.HostRoot(t), "tools", "protocol_oracle.py") out, err := exec.Command(py, oracle, "--encode-demo").CombinedOutput() if err != nil { t.Fatalf("oracle: %v %s", err, out) } got, err := hex.DecodeString(strings.TrimSpace(string(out))) if err != nil { t.Fatal(err, string(out)) } want, err := protocol.SetAll{Fan: [4]uint8{10, 10, 10, 10}}.Encode() if err != nil { t.Fatal(err) } if hex.EncodeToString(got) != hex.EncodeToString(want) { t.Fatalf("oracle %x != go %x", got, want) } }