diff --git a/tests/filter.rs b/tests/filter.rs index 8fd220d..d1c94a6 100644 --- a/tests/filter.rs +++ b/tests/filter.rs @@ -141,78 +141,78 @@ fn return_type() { fn op_default() { setup(); -// select_and_then_compare( -// "$.school[?(@.friends == @.friends)]", -// read_json("./benchmark/data_obj.json"), -// json!([{ -// "friends": [ -// {"id": 0, "name": "Millicent Norman"}, -// {"id": 1, "name": "Vincent Cannon" }, -// {"id": 2, "name": "Gray Berry"} -// ] -// }]), -// ); -// -// select_and_then_compare( -// "$.friends[?(@.name)]", -// read_json("./benchmark/data_obj.json"), -// json!([ -// { "id" : 1, "name" : "Vincent Cannon" }, -// { "id" : 2, "name" : "Gray Berry" } -// ]), -// ); -// -// select_and_then_compare( -// "$.friends[?(@.id >= 2)]", -// read_json("./benchmark/data_obj.json"), -// json!([ -// { "id" : 2, "name" : "Gray Berry" } -// ]), -// ); -// -// select_and_then_compare( -// "$.friends[?(@.id >= 2 || @.id == 1)]", -// read_json("./benchmark/data_obj.json"), -// json!([ -// { "id" : 2, "name" : "Gray Berry" }, -// { "id" : 1, "name" : "Vincent Cannon" } -// ]), -// ); -// -// select_and_then_compare( -// "$.friends[?( (@.id >= 2 || @.id == 1) && @.id == 0)]", -// read_json("./benchmark/data_obj.json"), -// json!([Value::Null]), -// ); -// -// select_and_then_compare( -// "$..friends[?(@.id == $.index)].id", -// read_json("./benchmark/data_obj.json"), -// json!([0, 0]), -// ); -// -// select_and_then_compare( -// "$..book[?($.store.bicycle.price < @.price)].price", -// read_json("./benchmark/example.json"), -// json!([22.99]), -// ); -// -// select_and_then_compare( -// "$..book[?( (@.price == 12.99 || @.category == 'reference') && @.price > 10)].price", -// read_json("./benchmark/example.json"), -// json!([12.99]), -// ); -// -// select_and_then_compare( -// "$..[?(@.age > 40)]", -// json!([ -// { "name": "이름1", "age": 40, "phone": "+33 12341234" }, -// { "name": "이름2", "age": 42, "phone": "++44 12341234" } -// ]), -// json!([ -// { "name" : "이름2", "age" : 42, "phone" : "++44 12341234" } -// ]), -// ); + select_and_then_compare( + "$.school[?(@.friends == @.friends)]", + read_json("./benchmark/data_obj.json"), + json!([{ + "friends": [ + {"id": 0, "name": "Millicent Norman"}, + {"id": 1, "name": "Vincent Cannon" }, + {"id": 2, "name": "Gray Berry"} + ] + }]), + ); + + select_and_then_compare( + "$.friends[?(@.name)]", + read_json("./benchmark/data_obj.json"), + json!([ + { "id" : 1, "name" : "Vincent Cannon" }, + { "id" : 2, "name" : "Gray Berry" } + ]), + ); + + select_and_then_compare( + "$.friends[?(@.id >= 2)]", + read_json("./benchmark/data_obj.json"), + json!([ + { "id" : 2, "name" : "Gray Berry" } + ]), + ); + + select_and_then_compare( + "$.friends[?(@.id >= 2 || @.id == 1)]", + read_json("./benchmark/data_obj.json"), + json!([ + { "id" : 2, "name" : "Gray Berry" }, + { "id" : 1, "name" : "Vincent Cannon" } + ]), + ); + + select_and_then_compare( + "$.friends[?( (@.id >= 2 || @.id == 1) && @.id == 0)]", + read_json("./benchmark/data_obj.json"), + json!([Value::Null]), + ); + + select_and_then_compare( + "$..friends[?(@.id == $.index)].id", + read_json("./benchmark/data_obj.json"), + json!([0, 0]), + ); + + select_and_then_compare( + "$..book[?($.store.bicycle.price < @.price)].price", + read_json("./benchmark/example.json"), + json!([22.99]), + ); + + select_and_then_compare( + "$..book[?( (@.price == 12.99 || @.category == 'reference') && @.price > 10)].price", + read_json("./benchmark/example.json"), + json!([12.99]), + ); + + select_and_then_compare( + "$..[?(@.age > 40)]", + json!([ + { "name": "이름1", "age": 40, "phone": "+33 12341234" }, + { "name": "이름2", "age": 42, "phone": "++44 12341234" } + ]), + json!([ + { "name" : "이름2", "age" : 42, "phone" : "++44 12341234" } + ]), + ); select_and_then_compare( "$..[?(@.age >= 30)]",