MCPcopy Create free account
hub / github.com/comnik/declarative-dataflow / wco_joins

Function wco_joins

tests/query_test.rs:300–376  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

298
299#[test]
300fn wco_joins() {
301 let data = vec![
302 TxData::add(1, ":name", String("Ivan".to_string())),
303 TxData::add(1, ":age", Number(15)),
304 TxData::add(2, ":name", String("Petr".to_string())),
305 TxData::add(2, ":age", Number(37)),
306 TxData::add(3, ":name", String("Ivan".to_string())),
307 TxData::add(3, ":age", Number(37)),
308 TxData::add(4, ":age", Number(15)),
309 ];
310
311 run_cases(vec![
312 Case {
313 description: "[:find ?e :where [?e :name]]",
314 plan: q(vec![0], vec![Binding::attribute(0, ":name", 1)]),
315 transactions: vec![data.clone()],
316 expectations: vec![vec![
317 (vec![Eid(1)], 0, 1),
318 (vec![Eid(2)], 0, 1),
319 (vec![Eid(3)], 0, 1),
320 ]],
321 },
322 Case {
323 description: "[:find ?e ?v :where [?e :name Ivan] [?e :age ?v]]",
324 plan: q(
325 vec![0, 2],
326 vec![
327 Binding::attribute(0, ":name", 1),
328 Binding::constant(1, String("Ivan".to_string())),
329 Binding::attribute(0, ":age", 2),
330 ],
331 ),
332 transactions: vec![data.clone()],
333 expectations: vec![vec![
334 (vec![Eid(1), Number(15)], 0, 1),
335 (vec![Eid(3), Number(37)], 0, 1),
336 ]],
337 },
338 Case {
339 description: "[:find ?e1 ?e2 :where [?e1 :name ?n] [?e2 :name ?n]]",
340 plan: q(
341 vec![0, 2],
342 vec![
343 Binding::attribute(0, ":name", 1),
344 Binding::attribute(2, ":name", 1),
345 ],
346 ),
347 transactions: vec![data.clone()],
348 expectations: vec![vec![
349 (vec![Eid(1), Eid(1)], 0, 1),
350 (vec![Eid(2), Eid(2)], 0, 1),
351 (vec![Eid(3), Eid(3)], 0, 1),
352 (vec![Eid(1), Eid(3)], 0, 1),
353 (vec![Eid(3), Eid(1)], 0, 1),
354 ]],
355 },
356 {
357 let (e, c, e2, a, n) = (0, 1, 2, 3, 4);

Callers

nothing calls this directly

Calls 1

run_casesFunction · 0.70

Tested by

no test coverage detected