()
| 223 | |
| 224 | #[test] |
| 225 | fn min() { |
| 226 | let (e, amount) = (1, 2); |
| 227 | let data = vec![ |
| 228 | TxData::add(1, ":amount", Number(5)), |
| 229 | TxData::add(2, ":amount", Number(10)), |
| 230 | TxData::add(2, ":amount", Number(10)), |
| 231 | TxData::add(1, ":amount", Number(2)), |
| 232 | TxData::add(1, ":amount", Number(4)), |
| 233 | TxData::add(1, ":amount", Number(6)), |
| 234 | ]; |
| 235 | |
| 236 | run_cases(vec![ |
| 237 | Case { |
| 238 | description: "[:find (min ?amount) :where [?e :amount ?amount]]", |
| 239 | plan: Plan::Aggregate(Aggregate { |
| 240 | variables: vec![amount], |
| 241 | plan: Box::new(Plan::Project(Project { |
| 242 | variables: vec![amount], |
| 243 | plan: Box::new(Plan::MatchA(e, ":amount".to_string(), amount)), |
| 244 | })), |
| 245 | aggregation_fns: vec![AggregationFn::MIN], |
| 246 | key_variables: vec![], |
| 247 | aggregation_variables: vec![amount], |
| 248 | with_variables: vec![], |
| 249 | }), |
| 250 | transactions: vec![data.clone()], |
| 251 | expectations: vec![vec![(vec![Number(2)], 0, 1)]], |
| 252 | }, |
| 253 | Case { |
| 254 | description: "[:find ?e (min ?amount) :where [?e :amount ?amount]]", |
| 255 | plan: Plan::Aggregate(Aggregate { |
| 256 | variables: vec![e, amount], |
| 257 | plan: Box::new(Plan::MatchA(e, ":amount".to_string(), amount)), |
| 258 | aggregation_fns: vec![AggregationFn::MIN], |
| 259 | key_variables: vec![e], |
| 260 | aggregation_variables: vec![amount], |
| 261 | with_variables: vec![], |
| 262 | }), |
| 263 | transactions: vec![data.clone()], |
| 264 | expectations: vec![vec![ |
| 265 | (vec![Eid(1), Number(2)], 0, 1), |
| 266 | (vec![Eid(2), Number(10)], 0, 1), |
| 267 | ]], |
| 268 | }, |
| 269 | ]); |
| 270 | } |
| 271 | |
| 272 | #[test] |
| 273 | fn sum() { |
nothing calls this directly
no test coverage detected