From 4be967290ee7ca2f6b0439c08e16999e7bbd5f66 Mon Sep 17 00:00:00 2001
From: Maria Matejka <mq@ucw.cz>
Date: Sat, 14 Mar 2026 18:42:03 +0100
Subject: Filter: Document and extend ASPA verification tests

These extensions minimalistically replicate the downstream bug reported
by Evann DREUMONT. (See next commit.)

Issue: #355

diff --git a/filter/test.conf b/filter/test.conf
index 3df9b6975..18a531ada 100644
--- a/filter/test.conf
+++ b/filter/test.conf
@@ -2395,10 +2395,19 @@ bt_test_suite(t_roa_check, "Testing ROA");
 
 aspa table at;
 
+# ASPA structure:
+#
+#
+#     65544               65545
+#       |     \ /   \ /     |
+#     65540  65542 65543  65541
+#       |            |
+#     65550        65551
+
 protocol static
 {
 	aspa { table at; };
-	route aspa 65540 providers 65544;
+	route aspa 65540 providers 65544, 65549;
 	route aspa 65541 providers 65545;
 	route aspa 65542 providers 65544, 65545;
 	route aspa 65543 providers 65544, 65545;
@@ -2440,6 +2449,27 @@ function t_aspa_check()
 	p3.prepend(65544);
 	bt_assert(aspa_check(at, p3, false) = ASPA_INVALID);
 	bt_assert(aspa_check(at, p3, true) = ASPA_INVALID);
+
+	bgppath p4 = +empty+;
+	p4.prepend(65540);
+	p4.prepend(65544);
+
+	bt_assert(aspa_check(at, p4, false) = ASPA_VALID);
+	bt_assert(aspa_check(at, p4, true) = ASPA_VALID);
+
+	p4.prepend(65545);
+
+	bt_assert(aspa_check(at, p4, false) = ASPA_VALID);
+	bt_assert(aspa_check(at, p4, true) = ASPA_INVALID);
+
+	p4.prepend(65555);
+
+	bt_assert(aspa_check(at, p4, false) = ASPA_UNKNOWN);
+	bt_assert(aspa_check(at, p4, true) = ASPA_INVALID);
+
+	bgppath p5 = +empty+.prepend(65550).prepend(65540).prepend(65549);
+	bt_assert(aspa_check(at, p5, false) = ASPA_VALID);
+	bt_assert(aspa_check(at, p5, true) = ASPA_VALID);
 }
 
 bt_test_suite(t_aspa_check, "Testing ASPA (our tests)");
