From 9edccb8f3393be3db280aaa6e8f1efdac89d7e9d Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 8 May 2026 12:39:04 +0000 Subject: [PATCH] datalog: bipartite friends-with-hobby join test (229/229) --- lib/datalog/scoreboard.json | 8 ++++---- lib/datalog/scoreboard.md | 4 ++-- lib/datalog/tests/eval.sx | 12 ++++++++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/datalog/scoreboard.json b/lib/datalog/scoreboard.json index 72e9732b..2267c839 100644 --- a/lib/datalog/scoreboard.json +++ b/lib/datalog/scoreboard.json @@ -1,13 +1,13 @@ { "lang": "datalog", - "total_passed": 228, + "total_passed": 229, "total_failed": 0, - "total": 228, + "total": 229, "suites": [ {"name":"tokenize","passed":26,"failed":0,"total":26}, {"name":"parse","passed":18,"failed":0,"total":18}, {"name":"unify","passed":28,"failed":0,"total":28}, - {"name":"eval","passed":30,"failed":0,"total":30}, + {"name":"eval","passed":31,"failed":0,"total":31}, {"name":"builtins","passed":20,"failed":0,"total":20}, {"name":"semi_naive","passed":8,"failed":0,"total":8}, {"name":"negation","passed":10,"failed":0,"total":10}, @@ -16,5 +16,5 @@ {"name":"magic","passed":28,"failed":0,"total":28}, {"name":"demo","passed":21,"failed":0,"total":21} ], - "generated": "2026-05-08T12:35:21+00:00" + "generated": "2026-05-08T12:38:51+00:00" } diff --git a/lib/datalog/scoreboard.md b/lib/datalog/scoreboard.md index 39b7704f..d0fbaa9b 100644 --- a/lib/datalog/scoreboard.md +++ b/lib/datalog/scoreboard.md @@ -1,13 +1,13 @@ # datalog scoreboard -**228 / 228 passing** (0 failure(s)). +**229 / 229 passing** (0 failure(s)). | Suite | Passed | Total | Status | |-------|--------|-------|--------| | tokenize | 26 | 26 | ok | | parse | 18 | 18 | ok | | unify | 28 | 28 | ok | -| eval | 30 | 30 | ok | +| eval | 31 | 31 | ok | | builtins | 20 | 20 | ok | | semi_naive | 8 | 8 | ok | | negation | 10 | 10 | ok | diff --git a/lib/datalog/tests/eval.sx b/lib/datalog/tests/eval.sx index 8bc70a2b..fafb4c7a 100644 --- a/lib/datalog/tests/eval.sx +++ b/lib/datalog/tests/eval.sx @@ -273,6 +273,18 @@ (dl-saturated? db)) false) + ;; Bipartite-style join: pair-of-friends who share a hobby. + ;; Three-relation join exercising the planner's join order. + (dl-et-test-set! "bipartite friends-with-hobby" + (dl-query + (dl-program + "hobby(alice, climb). hobby(bob, paint). + hobby(carol, climb). + friend(alice, carol). friend(bob, alice). + match(A, B, H) :- friend(A, B), hobby(A, H), hobby(B, H).") + (list (quote match) (quote A) (quote B) (quote H))) + (list {:A (quote alice) :B (quote carol) :H (quote climb)})) + ;; Repeated variable (diagonal): p(X, X) only matches tuples ;; whose two args are equal. The unifier handles this via the ;; subst chain — first occurrence binds X, second occurrence