Verified Commit 003e4498 authored by nagayama15's avatar nagayama15

add test data for jq-web

parent b0ae1b9b
!Makefile !Makefile
wasm-flate/ wasm-flate/
jq-web/
function-reorder/ function-reorder/
export-reorder/ export-reorder/
operand-swap/ operand-swap/
......
.PHONY: all .PHONY: all
all: \ all: zlib jq
### zlib
.PHONY: zlib
zlib: \
zlib/function-reorder/ANebjkXMZJwaaRMM \ zlib/function-reorder/ANebjkXMZJwaaRMM \
zlib/export-reorder/ANebjkXMZJwaaRMM \ zlib/export-reorder/ANebjkXMZJwaaRMM \
zlib/operand-swap/ANebjkXMZJwaaRMM \ zlib/operand-swap/ANebjkXMZJwaaRMM \
...@@ -38,7 +42,7 @@ zlib/raw/wasm-flate: ../node_modules/wasm-flate ...@@ -38,7 +42,7 @@ zlib/raw/wasm-flate: ../node_modules/wasm-flate
cp -r $< $@ cp -r $< $@
# $(eval $(call embed,watermark,method)) # $(eval $(call embed,watermark,method))
define embed define embed_zlib
.PHONY: zlib/$2/$1 .PHONY: zlib/$2/$1
zlib/$2/$1: zlib/$2/$1/bench.js zlib/$2/$1/wasm-flate/wasm_flate.js zlib/$2/$1/wasm-flate/wasm_flate_bg.wasm zlib/$2/$1: zlib/$2/$1/bench.js zlib/$2/$1/wasm-flate/wasm_flate.js zlib/$2/$1/wasm-flate/wasm_flate_bg.wasm
...@@ -55,15 +59,64 @@ zlib/$2/$1/wasm-flate/wasm_flate_bg.wasm: zlib/raw/wasm-flate ...@@ -55,15 +59,64 @@ zlib/$2/$1/wasm-flate/wasm_flate_bg.wasm: zlib/raw/wasm-flate
snpi -m $2 -w $1 -o $$@ $$</wasm_flate_bg.wasm snpi -m $2 -w $1 -o $$@ $$</wasm_flate_bg.wasm
endef endef
$(eval $(call embed,ANebjkXMZJwaaRMM,function-reorder)) $(eval $(call embed_zlib,ANebjkXMZJwaaRMM,function-reorder))
$(eval $(call embed,ANebjkXMZJwaaRMM,export-reorder)) $(eval $(call embed_zlib,ANebjkXMZJwaaRMM,export-reorder))
$(eval $(call embed,ANebjkXMZJwaaRMM,operand-swap)) $(eval $(call embed_zlib,ANebjkXMZJwaaRMM,operand-swap))
$(eval $(call embed_zlib,Qg5lb3WN8a7eRFRb,function-reorder))
$(eval $(call embed_zlib,Qg5lb3WN8a7eRFRb,export-reorder))
$(eval $(call embed_zlib,Qg5lb3WN8a7eRFRb,operand-swap))
$(eval $(call embed_zlib,oVs8OISLiQH0RXlq,function-reorder))
$(eval $(call embed_zlib,oVs8OISLiQH0RXlq,export-reorder))
$(eval $(call embed_zlib,oVs8OISLiQH0RXlq,operand-swap))
### jq
.PHONY: jq
jq: \
jq/function-reorder/ANebjkXMZJwaaRMM \
jq/export-reorder/ANebjkXMZJwaaRMM \
jq/operand-swap/ANebjkXMZJwaaRMM \
jq/function-reorder/Qg5lb3WN8a7eRFRb \
jq/export-reorder/Qg5lb3WN8a7eRFRb \
jq/operand-swap/Qg5lb3WN8a7eRFRb \
jq/function-reorder/oVs8OISLiQH0RXlq \
jq/export-reorder/oVs8OISLiQH0RXlq \
jq/operand-swap/oVs8OISLiQH0RXlq
jq/raw/jq-web: ../node_modules/jq-web
cp -r $< $@
# $(eval $(call embed,watermark,method))
define embed_jq
.PHONY: jq/$2/$1
jq/$2/$1: jq/$2/$1/bench.js jq/$2/$1/large-file.json jq/$2/$1/jq-web/jq.wasm.min.js jq/$2/$1/jq-web/jq.wasm.wasm
jq/$2/$1/bench.js: jq/raw/bench.js
mkdir -p $${@D}
cp $$< $$@
jq/$2/$1/large-file.json: jq/raw/large-file.json
mkdir -p $${@D}
cp $$< $$@
jq/$2/$1/jq-web/jq.wasm.min.js: jq/raw/jq-web
mkdir -p $${@D}
cp $$</jq.wasm.min.js $$@
jq/$2/$1/jq-web/jq.wasm.wasm: jq/raw/jq-web
mkdir -p $${@D}
snpi -m $2 -w $1 -o $$@ $$</jq.wasm.wasm
endef
$(eval $(call embed,Qg5lb3WN8a7eRFRb,function-reorder)) $(eval $(call embed_jq,ANebjkXMZJwaaRMM,function-reorder))
$(eval $(call embed,Qg5lb3WN8a7eRFRb,export-reorder)) $(eval $(call embed_jq,ANebjkXMZJwaaRMM,export-reorder))
$(eval $(call embed,Qg5lb3WN8a7eRFRb,operand-swap)) $(eval $(call embed_jq,ANebjkXMZJwaaRMM,operand-swap))
$(eval $(call embed,oVs8OISLiQH0RXlq,function-reorder)) $(eval $(call embed_jq,Qg5lb3WN8a7eRFRb,function-reorder))
$(eval $(call embed,oVs8OISLiQH0RXlq,export-reorder)) $(eval $(call embed_jq,Qg5lb3WN8a7eRFRb,export-reorder))
$(eval $(call embed,oVs8OISLiQH0RXlq,operand-swap)) $(eval $(call embed_jq,Qg5lb3WN8a7eRFRb,operand-swap))
$(eval $(call embed_jq,oVs8OISLiQH0RXlq,function-reorder))
$(eval $(call embed_jq,oVs8OISLiQH0RXlq,export-reorder))
$(eval $(call embed_jq,oVs8OISLiQH0RXlq,operand-swap))
large from json-iterator/test-data
https://github.com/json-iterator/test-data
const fs = require('fs');
const assert = require('assert');
const jq = require(`${__dirname}/jq-web/jq.wasm.min.js`);
const testData = fs.readFileSync(`${__dirname}/large-file.json`).toString();
const query = '.[5000].payload.commits | map(.message) | join("\\n")';
const expected = '"tdiary: fix nginx configuration (use try_files, alias, and named location)\\nfluentd-ui: fix nginx configuration (use try_files, alias, and named location)\\ngeminabox: fix nginx configuration (use try_files, alias, and named location)\\nMerge branch \'master\' into fix/nginx-configs\\nMerge branch \'master\' into fix/nginx-configs\\ndebian: updated README.md\\nMerge pull request #11 from minimum2scp/fix/nginx-configs\\n\\nFixed nginx configurations for some images (use try_files, alias, and named locattions)\\nMerge branch \'master\' into feature/es-kibana4"';
jq.onInitialized.addListener(() => {
// Check if jq-web works properly
assert.equal(jq.raw(testData, query), expected);
});
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment