Commit 25105ac6 authored by Jaromil's avatar Jaromil
Browse files

zenroom pack now has zstd working for zpack

parent bff65940
...@@ -147,7 +147,7 @@ zstd: ...@@ -147,7 +147,7 @@ zstd:
ZSTD_LEGACY_SUPPORT=0 \ ZSTD_LEGACY_SUPPORT=0 \
HUF_FORCE_DECOMPRESS_X1=1 \ HUF_FORCE_DECOMPRESS_X1=1 \
ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT=1 \ ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT=1 \
ZSTD_STRIP_ERROR_STRINGS=1 \ ZSTD_STRIP_ERROR_STRINGS=0 \
ZSTD_NO_INLINE=1 ZSTD_NO_INLINE=1
# ------------------- # -------------------
......
...@@ -33,4 +33,21 @@ When("create the '' decoded from mpack ''", function(dst, src) ...@@ -33,4 +33,21 @@ When("create the '' decoded from mpack ''", function(dst, src)
ZEN.assert(type(pack) == 'zenroom.octet', "Invalid mpack, not an octet: "..src) ZEN.assert(type(pack) == 'zenroom.octet', "Invalid mpack, not an octet: "..src)
ACK[dst] = MPACK.decode( OCTET.to_string( pack ) ) ACK[dst] = MPACK.decode( OCTET.to_string( pack ) )
new_codec(dst) new_codec(dst)
end) end)
\ No newline at end of file
When("create the zpack of ''", function(src)
empty'zpack'
local source = have(src)
ACK.zpack = ZPACK.encode(source)
new_codec('zpack', { zentype = 'element'})
end)
When("create the '' decoded from zpack ''", function(dst, src)
empty(dst)
local pack = have(src)
ZEN.assert(ZEN.CODEC[src].zentype == 'element', "Invalid zpack, not an element: "..src)
ZEN.assert(type(pack) == 'zenroom.octet', "Invalid zpack, not an octet: "..src)
ACK[dst] = ZPACK.decode( pack )
new_codec(dst)
end)
...@@ -564,6 +564,7 @@ int zen_zstd_decompress(lua_State *L) { ...@@ -564,6 +564,7 @@ int zen_zstd_decompress(lua_State *L) {
src = o_arg(L, 1); SAFE(src); src = o_arg(L, 1); SAFE(src);
dst = o_new(L, src->len * 3); // assuming max bound is *3 dst = o_new(L, src->len * 3); // assuming max bound is *3
SAFE(dst); SAFE(dst);
func(L, "decompressing octet: %u", src->len);
dst->len = ZSTD_decompressDCtx(Z->zstd_d, dst->len = ZSTD_decompressDCtx(Z->zstd_d,
dst->val, dst->max, dst->val, dst->max,
src->val, src->len); src->val, src->len);
......
...@@ -645,7 +645,7 @@ cat <<EOF | save array table-arrays.json ...@@ -645,7 +645,7 @@ cat <<EOF | save array table-arrays.json
EOF EOF
cat <<EOF | zexe remote-table-from-table.zen -a table-arrays.json | jq . cat <<EOF | zexe remove-table-from-table.zen -a table-arrays.json | jq .
Given I have a 'string array' named 'identities' Given I have a 'string array' named 'identities'
Given I have a 'string array' named 'identity' Given I have a 'string array' named 'identity'
When I create the size of 'identities' When I create the size of 'identities'
...@@ -657,5 +657,4 @@ Then print the 'before' ...@@ -657,5 +657,4 @@ Then print the 'before'
and print the 'after' and print the 'after'
EOF EOF
success success
...@@ -68,14 +68,13 @@ EOF ...@@ -68,14 +68,13 @@ EOF
cat << EOF | zexe zpack.zen -a newblock.json | save zenswarm zpack.json cat << EOF | zexe zpack.zen -a newblock.json | save zenswarm zpack.json
Given I have a 'hex dictionary' named 'newblock' Given I have a 'hex dictionary' named 'newblock'
When I create the zpack of 'newblock' When I create the zpack of 'newblock'
Then print the 'zpack' Then print the 'zpack' as 'base64'
EOF EOF
cat << EOF | debug zunpack.zen -a newblock.json -k zpack.json cat << EOF | zexe zunpack.zen -a newblock.json -k zpack.json
Given I have a 'base64' named 'zpack' Given I have a 'base64' named 'zpack'
and I have a 'hex dictionary' named 'newblock' and I have a 'hex dictionary' named 'newblock'
When I create the 'decoded' decoded from zpack 'zpack' When I create the 'decoded' decoded from zpack 'zpack'
and debug
and I verify 'decoded' is equal to 'newblock' and I verify 'decoded' is equal to 'newblock'
Then print the string 'ZPACK SUCCESS' Then print the string 'ZPACK SUCCESS'
EOF EOF
...@@ -83,3 +82,4 @@ EOF ...@@ -83,3 +82,4 @@ EOF
success
...@@ -48,7 +48,6 @@ When I move 'parentHash' from 'result' to 'newblock' ...@@ -48,7 +48,6 @@ When I move 'parentHash' from 'result' to 'newblock'
When I move 'timestamp' from 'result' to 'newblock' When I move 'timestamp' from 'result' to 'newblock'
# When I insert 'system_timestamp' in 'newblock' # When I insert 'system_timestamp' in 'newblock'
When I create the mpack of 'newblock' When I create the mpack of 'newblock'
and debug
Then print the 'mpack' as 'base64' Then print the 'mpack' as 'base64'
EOF EOF
......
Supports Markdown
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