openresty 테스트

This commit is contained in:
freestrings
2019-08-23 22:09:09 +09:00
parent b5c5d6b88e
commit 422a23ee57
8 changed files with 124 additions and 54 deletions

View File

@ -1,4 +1,4 @@
require("lib")
local jsonpath = require("jsonpath")
local iter;
if arg[1] == nil or arg[1] == '' then
@ -9,11 +9,13 @@ end
print(string.format("%s - %u", "lua iter", iter));
local file = io.open("../benchmark/example.json", "r");
local file = io.open("../../benchmark/example.json", "r");
io.input(file)
local data = io.read("*a");
io.close(file);
local template = compile("$..book[?(@.price<30 && @.category==\"fiction\")]");
jsonpath.init('../target/release/deps/libjsonpath_lib.so')
local template = jsonpath.compile("$..book[?(@.price<30 && @.category==\"fiction\")]");
for i = 0, iter do
local r = template(data);
-- print(r);