Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zenroom
Zenroom
Commits
25105ac6
Commit
25105ac6
authored
May 20, 2022
by
Jaromil
Browse files
zenroom pack now has zstd working for zpack
parent
bff65940
Changes
6
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
25105ac6
...
...
@@ -147,7 +147,7 @@ zstd:
ZSTD_LEGACY_SUPPORT
=
0
\
HUF_FORCE_DECOMPRESS_X1
=
1
\
ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
=
1
\
ZSTD_STRIP_ERROR_STRINGS
=
1
\
ZSTD_STRIP_ERROR_STRINGS
=
0
\
ZSTD_NO_INLINE
=
1
# -------------------
...
...
src/lua/zencode_pack.lua
View file @
25105ac6
...
...
@@ -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
)
ACK
[
dst
]
=
MPACK
.
decode
(
OCTET
.
to_string
(
pack
)
)
new_codec
(
dst
)
end
)
\ No newline at end of file
end
)
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
)
src/zen_io.c
View file @
25105ac6
...
...
@@ -564,6 +564,7 @@ int zen_zstd_decompress(lua_State *L) {
src
=
o_arg
(
L
,
1
);
SAFE
(
src
);
dst
=
o_new
(
L
,
src
->
len
*
3
);
// assuming max bound is *3
SAFE
(
dst
);
func
(
L
,
"decompressing octet: %u"
,
src
->
len
);
dst
->
len
=
ZSTD_decompressDCtx
(
Z
->
zstd_d
,
dst
->
val
,
dst
->
max
,
src
->
val
,
src
->
len
);
...
...
test/zencode_array/run.sh
View file @
25105ac6
...
...
@@ -645,7 +645,7 @@ cat <<EOF | save array table-arrays.json
EOF
cat
<<
EOF
| zexe remo
t
e-table-from-table.zen -a table-arrays.json | jq .
cat
<<
EOF
| zexe remo
v
e-table-from-table.zen -a table-arrays.json | jq .
Given I have a 'string array' named 'identities'
Given I have a 'string array' named 'identity'
When I create the size of 'identities'
...
...
@@ -657,5 +657,4 @@ Then print the 'before'
and print the 'after'
EOF
success
test/zencode_pack/run.sh
View file @
25105ac6
...
...
@@ -68,14 +68,13 @@ EOF
cat
<<
EOF
| zexe zpack.zen -a newblock.json | save zenswarm zpack.json
Given I have a 'hex dictionary' named 'newblock'
When I create the zpack of 'newblock'
Then print the 'zpack'
Then print the 'zpack'
as 'base64'
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'
and I have a 'hex dictionary' named 'newblock'
When I create the 'decoded' decoded from zpack 'zpack'
and debug
and I verify 'decoded' is equal to 'newblock'
Then print the string 'ZPACK SUCCESS'
EOF
...
...
@@ -83,3 +82,4 @@ EOF
success
test/zencode_zenswarm/run.sh
View file @
25105ac6
...
...
@@ -48,7 +48,6 @@ When I move 'parentHash' from 'result' to 'newblock'
When I move 'timestamp' from 'result' to 'newblock'
# When I insert 'system_timestamp' in 'newblock'
When I create the mpack of 'newblock'
and debug
Then print the 'mpack' as 'base64'
EOF
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment