From 4906da9796192cedbabcf8ae04e594ab42c61b40 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Mon, 19 Dec 2022 15:35:40 +0800 Subject: [PATCH] test(rule-funcs): test compression funcs --- .../test/emqx_rule_funcs_SUITE.erl | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/apps/emqx_rule_engine/test/emqx_rule_funcs_SUITE.erl b/apps/emqx_rule_engine/test/emqx_rule_funcs_SUITE.erl index 35ff60831..504211440 100644 --- a/apps/emqx_rule_engine/test/emqx_rule_funcs_SUITE.erl +++ b/apps/emqx_rule_engine/test/emqx_rule_funcs_SUITE.erl @@ -843,6 +843,48 @@ prop_hash_fun() -> end ). +%%------------------------------------------------------------------------------ +%% Test cases for zip funcs +%%------------------------------------------------------------------------------ + +t_zip_funcs(_) -> + ?PROPTEST(prop_zip_fun). + +prop_zip_fun() -> + ?FORALL( + S, + binary(), + S == apply_func(unzip, [apply_func(zip, [S])]) + ). + +%%------------------------------------------------------------------------------ +%% Test cases for gzip funcs +%%------------------------------------------------------------------------------ + +t_gzip_funcs(_) -> + ?PROPTEST(prop_gzip_fun). + +prop_gzip_fun() -> + ?FORALL( + S, + binary(), + S == apply_func(gunzip, [apply_func(gzip, [S])]) + ). + +%%------------------------------------------------------------------------------ +%% Test cases for zip funcs +%%------------------------------------------------------------------------------ + +t_zip_compress_funcs(_) -> + ?PROPTEST(prop_zip_compress_fun). + +prop_zip_compress_fun() -> + ?FORALL( + S, + binary(), + S == apply_func(zip_uncompress, [apply_func(zip_compress, [S])]) + ). + %%------------------------------------------------------------------------------ %% Test cases for base64 %%------------------------------------------------------------------------------