AtlatestRepositorysigil-http3

sigil-http3 / tree / tools / interop / testtest-observations.sgl

1(import (sigil test)
2 (sigil quic address)
3 (sigil http3 interop observations))
4
5(test-group "Phone server observations"
6 (test "actual endpoint tuples preserve IPv4 and bracket IPv6"
7 (assert-equal "127.0.0.1:51000" (interop-peer-text (quic-address "127.0.0.1" 51000)))
8 (assert-equal "[::1]:52000" (interop-peer-text (quic-address "::1" 52000))))
9
10 (test "path records preserve distinct before and after tuples"
11 (assert-equal
12 "{\"type\":\"path-change\",\"seq\":3,\"serverTime\":\"2026-10-18T20:00:00Z\",\"before\":\"[::1]:51000\",\"after\":\"[::1]:52000\"}"
13 (interop-observation-json "path-change" 3 "2026-10-18T20:00:00Z"
14 '(("before" . "[::1]:51000") ("after" . "[::1]:52000")))))
16 (test "unexpected control characters and JSON syntax never enter tokens"
17 (for-each
18 (lambda (text)
19 (assert-true
20 (guard (exn (else #t))
21 (interop-json-token text)
22 #f)))
23 (list "bad\npeer" "bad\"peer" "bad\\peer" (make-string 257 #\a))))
25 (test "envelope rejects exhausted sequence numbers and unknown fields"
26 (assert-true
27 (guard (exn (else #t))
28 (interop-observation-json "peer" 4096 "UTC" '(("peer" . "[::1]:51000")))
29 #f))
30 (assert-true
31 (guard (exn (else #t))
32 (interop-observation-json "peer" 0 "UTC" '(("unexpected" . "value")))
33 #f))))