From 24161596eb13a66b68ed9826ac177cfed502914d Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Thu, 19 Nov 2026 01:55:05 +0100 Subject: [PATCH] Name the test that discharges every abstract test stating a response The distance, velocity and acceleration queries of Annex A (/conf/movingfeatures/tpgeometry-query-*) are response rows of the suite, discharged by the tests reading what the service answers, and every row stating a response -- over the fixture database (atsLive) or a scripted backend (atsResponse) -- names the test asserting it in atsDischargedBy. TestATSEveryAnsweredRowIsDischarged, which TestATSEveryLiveRowIsDischarged becomes, holds every such row to a test any test file declares. Witness. Each of the three query tests states a response ("a Distance query returns a TReal time-to-distance curve"), and the suite discharged them as route rows, by the existence of GET /collections/{cid}/items/{fid}/tgsequence/ {tgid}/{qtype} alone: a route answering 404 for every query would have passed them. The four response rows (collections-get-success, collection-get-success, tgsequence-get-success, tproperties-get-success) were counted as "response asserted" by TestATSCoverageReport with nothing naming the test that asserts them. With the check widened to response rows and the map unfilled, it fails on exactly those four. Measured. go test -run TestATS: every test passes; 24 abstract tests state a response (17 over the fixture, 7 over a scripted backend), 0 undischarged; the coverage report reads 45 abstract tests, 25 served, 0 not served, 17 needing a backend. Route rows go from 21 to 18, response rows from 4 to 7; no abstract test leaves the registry. Why. An abstract test is discharged by what it states. A test stating a response is met only by a test that reads that response, so the row names it; whether the answer comes from the fixture or a scripted backend changes where the test runs, not what a reader of the suite is owed. Acceleration's row names the test pinning its 501 and its reason, the position the implementation states on the wiki page of Part 1 until the standard scopes the query (plan MobilityDB #3805, row A1). --- ats_part1_test.go | 55 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/ats_part1_test.go b/ats_part1_test.go index 56026a4..37c47af 100644 --- a/ats_part1_test.go +++ b/ats_part1_test.go @@ -18,6 +18,7 @@ import ( "net/http" "net/http/httptest" "os" + "path/filepath" "sort" "strings" "testing" @@ -45,7 +46,7 @@ const ( // ⛔ AN UNCONDITIONAL "awaits its live assertion" UNDERSTATES CONFORMANCE. A row a // named group already asserts reads as outstanding, so the tier's own coverage report // is the thing that makes the claim look worse than the suite is. The entry is what -// tells the two apart, and TestATSEveryLiveRowIsDischarged keeps every row carrying +// tells the two apart, and TestATSEveryAnsweredRowIsDischarged keeps every row carrying // one that names a test which exists. var atsDischargedBy = map[string]string{ "/conf/mf-collection/collections-post-success": "TestATSLiveCollectionLifecycle", @@ -65,6 +66,13 @@ var atsDischargedBy = map[string]string{ "/conf/movingfeatures/param-leaf-response": "TestATSLiveQueryParameters", "/conf/movingfeatures/param-subtrajectory-response": "TestATSLiveQueryParameters", "/conf/movingfeatures/param-subtemporalvalue-response": "TestATSLiveSubTemporalValue", + "/conf/mf-collection/collections-get-success": "TestATSCollectionsGetSuccess", + "/conf/mf-collection/collection-get-success": "TestATSCollectionGetSuccess", + "/conf/movingfeatures/tgsequence-get-success": "TestATSTGSequenceGetSuccess", + "/conf/movingfeatures/tproperties-get-success": "TestATSTPropertiesGetSuccess", + "/conf/movingfeatures/tpgeometry-query-distance": "TestATSTPGeometryQueryDistanceAndVelocity", + "/conf/movingfeatures/tpgeometry-query-velocity": "TestATSTPGeometryQueryDistanceAndVelocity", + "/conf/movingfeatures/tpgeometry-query-acceleration": "TestATSTPGeometryQueryAccelerationNotDerivable", } // atsTest is one abstract test of Annex A. @@ -117,9 +125,9 @@ var atsPart1 = []atsTest{ {"/conf/movingfeatures/tgsequence-post-success", classFeatures, atsLive, "", "", "the POST response is 201 or 202"}, {"/conf/movingfeatures/tpgeometry-delete", classFeatures, atsRoute, "DELETE", "/collections/{cid}/items/{fid}/tgsequence/{tgid}", "the TemporalPrimitiveGeometry can be deleted at the expected location"}, {"/conf/movingfeatures/tpgeometry-delete-success", classFeatures, atsLive, "", "", "the DELETE response is 200, 202 or 204"}, - {"/conf/movingfeatures/tpgeometry-query-distance", classFeatures, atsRoute, "GET", "/collections/{cid}/items/{fid}/tgsequence/{tgid}/{qtype}", "a Distance query returns a TReal time-to-distance curve"}, - {"/conf/movingfeatures/tpgeometry-query-velocity", classFeatures, atsRoute, "GET", "/collections/{cid}/items/{fid}/tgsequence/{tgid}/{qtype}", "a Velocity query returns a TReal time-to-velocity curve"}, - {"/conf/movingfeatures/tpgeometry-query-acceleration", classFeatures, atsRoute, "GET", "/collections/{cid}/items/{fid}/tgsequence/{tgid}/{qtype}", "an Acceleration query returns a TReal time-to-acceleration curve"}, + {"/conf/movingfeatures/tpgeometry-query-distance", classFeatures, atsResponse, "", "", "a Distance query returns a TReal time-to-distance curve"}, + {"/conf/movingfeatures/tpgeometry-query-velocity", classFeatures, atsResponse, "", "", "a Velocity query returns a TReal time-to-velocity curve"}, + {"/conf/movingfeatures/tpgeometry-query-acceleration", classFeatures, atsResponse, "", "", "an Acceleration query returns a TReal time-to-acceleration curve"}, // -- movingfeatures: the temporal properties ---------------------------- {"/conf/movingfeatures/tproperties-get", classFeatures, atsRoute, "GET", "/collections/{cid}/items/{fid}/tproperties", "the TemporalProperties can be extracted using query parameters"}, @@ -336,36 +344,49 @@ func TestATSCoverageReport(t *testing.T) { len(rows), served, missing, live)) } -// Every abstract test needing a backend names a live test that discharges it, and -// every name is a test that exists. +// Every abstract test a response discharges -- read from the service over the +// fixture database (atsLive) or over a scripted backend (atsResponse) -- names the +// test asserting that response, and every name is a test that exists. // // ⛔ A MAP ENTRY NAMING A TEST THAT DOES NOT EXIST IS WORSE THAN NO ENTRY: it reports // an abstract test as discharged by nothing at all, which is the failure the entry -// was added to end. The source is read for the declaration rather than trusted. -func TestATSEveryLiveRowIsDischarged(t *testing.T) { - src, err := os.ReadFile("ats_live_test.go") +// was added to end. The sources are read for the declaration rather than trusted. +// +// ⛔ A RESPONSE ROW IS NO WEAKER A CLAIM THAN A LIVE ONE. Both state what the service +// answers, so both name the test that reads the answer; a response row counted as +// asserted without one is a claim nothing checks. +func TestATSEveryAnsweredRowIsDischarged(t *testing.T) { + files, err := filepath.Glob("*_test.go") if err != nil { t.Fatal(err) } - var live, undischarged int + var src []byte + for _, f := range files { + b, err := os.ReadFile(f) + if err != nil { + t.Fatal(err) + } + src = append(src, b...) + } + var answered, undischarged int for _, a := range atsPart1 { - if a.kind != atsLive { + if a.kind != atsLive && a.kind != atsResponse { continue } - live++ + answered++ by := atsDischargedBy[a.id] if by == "" { undischarged++ - t.Errorf("%s needs a backend and names no live test that discharges it (%s)", + t.Errorf("%s states a response and names no test that discharges it (%s)", a.id, a.purpose) continue } if !bytes.Contains(src, []byte("func "+by+"(")) { - t.Errorf("%s names %s, which ats_live_test.go does not declare", a.id, by) + t.Errorf("%s names %s, which no test file declares", a.id, by) } } - if live == 0 { - t.Fatal("the registry carries no live row, so this test would assert nothing") + if answered == 0 { + t.Fatal("the registry carries no row stating a response, so this test would assert nothing") } - t.Logf("%d abstract tests need a backend; %d are undischarged", live, undischarged) + t.Logf("%d abstract tests state a response; %d are undischarged", answered, undischarged) }