refactor + size_cmp

This commit is contained in:
JMARyA 2024-06-05 11:38:38 +02:00
parent a371b29b50
commit a023352b0a
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
4 changed files with 129 additions and 8 deletions

View file

@ -359,6 +359,23 @@ mod tests {
));
}
#[test]
fn array_size_cmp() {
let empty: Vec<i32> = vec![];
let one = vec![1];
let two = vec![1, 2];
let many = vec![1, 2, 3, 4, 5, 6];
let filter = json!({
"list": {"$size": {"$gt": 0}}
});
assert!(!matches(&filter, &json!({"list": empty})));
assert!(matches(&filter, &json!({"list": one})));
assert!(matches(&filter, &json!({"list": two})));
assert!(matches(&filter, &json!({"list": many})));
}
#[test]
fn nested_modifier() {
assert!(matches(