feat: build vehicle data platform and production pipeline

This commit is contained in:
lingniu
2026-07-14 12:35:33 +08:00
parent b452be3b94
commit bb59303a4b
270 changed files with 88016 additions and 1975 deletions

View File

@@ -124,6 +124,28 @@ func TestAutoResponseEchoesRawVINAndOriginalTime(t *testing.T) {
}
}
func TestAutoResponseRejectsEnforcedInvalidPlatformLogin(t *testing.T) {
body := []byte{0x1a, 0x07, 0x02, 0x00, 0x26, 0x0f, 0x00, 0x01}
body = append(body, fixedASCII("platform-a", 12)...)
body = append(body, fixedASCII("wrong-password", 20)...)
body = append(body, 0x01)
request := buildFrame(0x05, 0xfe, "12345678901234567", body)
env, err := ParseFrame(request, 1782914969584, "127.0.0.1:32960")
if err != nil {
t.Fatal(err)
}
env.AuthenticationEnforced = true
env.AuthenticationStatus = "rejected"
response, ok, err := AutoResponse(request, env)
if err != nil || !ok {
t.Fatalf("AutoResponse() ok=%v err=%v", ok, err)
}
if response[3] != responseError {
t.Fatalf("response flag = 0x%02x, want 0x%02x", response[3], responseError)
}
}
func TestParseFrameExtractsRealtimeVehicleMileageAndPosition(t *testing.T) {
body := []byte{0x1a, 0x06, 0x1e, 0x16, 0x17, 0x39}
body = append(body, 0x01)