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

Function base_projections

tests/query_test.rs:164–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

162
163#[test]
164fn base_projections() {
165 let data = vec![
166 TxData::add(100, ":name", String("Dipper".to_string())),
167 TxData::add(100, ":name", String("Alias".to_string())),
168 TxData::add(200, ":name", String("Mabel".to_string())),
169 ];
170
171 run_cases(vec![
172 Case {
173 description: "[:find ?e :where [?e :name ?n]]",
174 plan: Plan::Project(Project {
175 variables: vec![0],
176 plan: Box::new(Plan::MatchA(0, ":name".to_string(), 1)),
177 }),
178 transactions: vec![data.clone()],
179 expectations: vec![vec![(vec![Eid(100)], 0, 2), (vec![Eid(200)], 0, 1)]],
180 },
181 Case {
182 description: "[:find ?n :where [?e :name ?n]]",
183 plan: Plan::Project(Project {
184 variables: vec![1],
185 plan: Box::new(Plan::MatchA(0, ":name".to_string(), 1)),
186 }),
187 transactions: vec![data.clone()],
188 expectations: vec![vec![
189 (vec![String("Dipper".to_string())], 0, 1),
190 (vec![String("Alias".to_string())], 0, 1),
191 (vec![String("Mabel".to_string())], 0, 1),
192 ]],
193 },
194 Case {
195 description: "[:find ?e ?n :where [?e :name ?n]]",
196 plan: Plan::Project(Project {
197 variables: vec![0, 1],
198 plan: Box::new(Plan::MatchA(0, ":name".to_string(), 1)),
199 }),
200 transactions: vec![data.clone()],
201 expectations: vec![vec![
202 (vec![Eid(100), String("Dipper".to_string())], 0, 1),
203 (vec![Eid(100), String("Alias".to_string())], 0, 1),
204 (vec![Eid(200), String("Mabel".to_string())], 0, 1),
205 ]],
206 },
207 Case {
208 description: "[:find ?n ?e :where [?e :name ?n]]",
209 plan: Plan::Project(Project {
210 variables: vec![1, 0],
211 plan: Box::new(Plan::MatchA(0, ":name".to_string(), 1)),
212 }),
213 transactions: vec![data.clone()],
214 expectations: vec![vec![
215 (vec![String("Dipper".to_string()), Eid(100)], 0, 1),
216 (vec![String("Alias".to_string()), Eid(100)], 0, 1),
217 (vec![String("Mabel".to_string()), Eid(200)], 0, 1),
218 ]],
219 },
220 ]);
221}

Callers

nothing calls this directly

Calls 1

run_casesFunction · 0.70

Tested by

no test coverage detected