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

Function max

tests/aggregation_test.rs:177–222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

175
176#[test]
177fn max() {
178 let (e, amount) = (1, 2);
179 let data = vec![
180 TxData::add(1, ":amount", Number(5)),
181 TxData::add(2, ":amount", Number(10)),
182 TxData::add(2, ":amount", Number(10)),
183 TxData::add(1, ":amount", Number(2)),
184 TxData::add(1, ":amount", Number(4)),
185 TxData::add(1, ":amount", Number(6)),
186 ];
187
188 run_cases(vec![
189 Case {
190 description: "[:find (max ?amount) :where [?e :amount ?amount]]",
191 plan: Plan::Aggregate(Aggregate {
192 variables: vec![amount],
193 plan: Box::new(Plan::Project(Project {
194 variables: vec![amount],
195 plan: Box::new(Plan::MatchA(e, ":amount".to_string(), amount)),
196 })),
197 aggregation_fns: vec![AggregationFn::MAX],
198 key_variables: vec![],
199 aggregation_variables: vec![amount],
200 with_variables: vec![],
201 }),
202 transactions: vec![data.clone()],
203 expectations: vec![vec![(vec![Number(10)], 0, 1)]],
204 },
205 Case {
206 description: "[:find ?e (max ?amount) :where [?e :amount ?amount]]",
207 plan: Plan::Aggregate(Aggregate {
208 variables: vec![e, amount],
209 plan: Box::new(Plan::MatchA(e, ":amount".to_string(), amount)),
210 aggregation_fns: vec![AggregationFn::MAX],
211 key_variables: vec![e],
212 aggregation_variables: vec![amount],
213 with_variables: vec![],
214 }),
215 transactions: vec![data.clone()],
216 expectations: vec![vec![
217 (vec![Eid(1), Number(6)], 0, 1),
218 (vec![Eid(2), Number(10)], 0, 1),
219 ]],
220 },
221 ]);
222}
223
224#[test]
225fn min() {

Callers

nothing calls this directly

Calls 1

run_casesFunction · 0.70

Tested by

no test coverage detected