mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-04-25 09:22:19 +00:00
Restore wrong commit
This commit is contained in:
parent
b736c962d2
commit
32eef3f7c7
144
tests/filter.rs
144
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)]",
|
||||
|
Loading…
x
Reference in New Issue
Block a user