File msgpack-erlang-0.8.1-git.patch of Package msgpack-erlang

diff --git a/.github/workflows/checkall.yml b/.github/workflows/checkall.yml
index f02b103..809cebb 100644
--- a/.github/workflows/checkall.yml
+++ b/.github/workflows/checkall.yml
@@ -10,7 +10,7 @@ jobs:
   build:
     strategy:
       matrix:
-        version: [22, 23, 24, 25]
+        version: [22, 23, 24, 25, 26]
     runs-on: ubuntu-latest
 
     container:
@@ -21,6 +21,6 @@ jobs:
     - name: Compile
       run: rebar3 compile
     - name: Test
-      run: rebar3 eunit
+      run: rebar3 do eunit, proper
     - name: Check
       run: rebar3 do xref, dialyzer
diff --git a/eqc/msgpack_eqc.erl b/eqc/msgpack_eqc.erl
deleted file mode 100644
index f82099c..0000000
--- a/eqc/msgpack_eqc.erl
+++ /dev/null
@@ -1,110 +0,0 @@
-%%
-%% MessagePack for Erlang
-%%
-%% Copyright (C) 2009-2014 UENISHI Kota
-%%
-%%    Licensed under the Apache License, Version 2.0 (the "License");
-%%    you may not use this file except in compliance with the License.
-%%    You may obtain a copy of the License at
-%%
-%%        http://www.apache.org/licenses/LICENSE-2.0
-%%
-%%    Unless required by applicable law or agreed to in writing, software
-%%    distributed under the License is distributed on an "AS IS" BASIS,
-%%    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%%    See the License for the specific language governing permissions and
-%%    limitations under the License.
-%%
-
--module(msgpack_eqc).
-
-
--ifdef(TEST).
--ifdef(EQC).
-
--compile(export_all).
--include_lib("eqc/include/eqc.hrl").
--include_lib("eunit/include/eunit.hrl").
-
--define(NUMTESTS, 16).
--define(QC_OUT(P),
-        eqc:on_output(fun(Str, Args) ->
-                              io:format(user, Str, Args) end, P)).
--define(_assertProp(S),
-        {timeout, ?NUMTESTS * 10,
-         ?_assert(quickcheck(numtests(?NUMTESTS, ?QC_OUT(S))))}).
-
-eqc_test_() ->
-    {inparallel,
-     [
-      ?_assertProp(prop_msgpack()),
-      ?_assertProp(prop_msgpack([{format, jiffy}])),
-      ?_assertProp(prop_msgpack([{format, jsx}]))
-      ]}.
-
-prop_msgpack() ->
-    ?FORALL(Obj, msgpack_object(),
-            begin
-                {ok, Obj} =:= msgpack:unpack(msgpack:pack(Obj))
-            end).
-
-prop_msgpack(Options) ->
-    ?FORALL(Obj, msgpack_object(),
-            begin
-                {ok, Obj} =:= msgpack:unpack(msgpack:pack(Obj, Options), Options)
-            end).
-
-msgpack_object() ->
-    oneof(container_types() ++ primitive_types()).
-
-container_types() ->
-    [ fix_array(), array16() ].
-%% TODO: add map
-
-primitive_types() ->
-    [null(),
-     positive_fixnum(), negative_fixnum(),
-     int8(), int16(), int32(), int64(),
-     uint8(), uint16(), uint32(), uint64(),
-     eqc_gen:real(), eqc_gen:bool(),
-     fix_raw(), raw16(), raw32()
-    ].
-          %% fix_raw(), raw16(), raw32()]).
-
-positive_fixnum() -> choose(0, 127).
-negative_fixnum() -> choose(-32, -1).
-
-int8() ->  choose(-16#80, 16#7F).
-int16() -> oneof([choose(-16#8000, -16#81),
-                  choose(16#80, 16#7FFF)]).
-int32() -> oneof([choose(-16#80000000, -16#8001),
-                  choose(16#10000, 16#7FFFFFFF)]).
-int64() -> oneof([choose(-16#8000000000000000, -16#80000001),
-                  choose(16#100000000, 16#7FFFFFFFFFFFFFFF)]).
-
-uint8() ->  choose(0, 16#FF).
-uint16() -> choose(16#100, 16#FFFF).
-uint32() -> choose(16#10000, 16#FFFFFFFF).
-uint64() -> choose(16#100000000, 16#FFFFFFFFFFFFFFFF).
-
-null() -> null.
-
-fix_raw() ->
-    ?LET(Integer, choose(0, 31),
-         ?LET(Binary, binary(Integer), Binary)).
-
-raw16() ->
-    ?LET(Integer, uint16(),
-         ?LET(Binary, binary(Integer), Binary)).
-
-raw32() ->
-    ?LET(Binary, binary(65537), Binary).
-
-fix_array() ->
-    eqc_gen:resize(16, eqc_gen:list(oneof(primitive_types()))).
-
-array16() ->
-    eqc_gen:resize(128, eqc_gen:list(oneof(primitive_types()))).
-
--endif.
--endif.
diff --git a/rebar.config b/rebar.config
index f6d12f9..8e5c229 100644
--- a/rebar.config
+++ b/rebar.config
@@ -4,7 +4,6 @@
 {require_otp_vsn, "22|23|24|25"}.
 
 {erl_opts, [fail_on_warning, debug_info, warn_untyped_record]}.
-%%, {parse_transform, eqc_cover}]}.
 
 {xref_checks, [undefined_function_calls]}.
 {cover_enabled, true}.
@@ -15,3 +14,19 @@
 {erl_first_files, [
                    "src/msgpack_ext.erl"
                   ]}.
+
+{project_plugins, [rebar3_proper]}.
+
+{profiles,
+ [{test, [
+          {erl_opts, [nowarn_export_all]},
+          {deps, [proper]}
+         ]
+  }]
+}.
+
+%% See: https://erlangforums.com/t/erlang-otp-26-0-released/2607/7
+{dialyzer, [
+            {plt_extra_apps, [eunit]}, % or alternatively to add eunit to the analysis set without making it a runtime dep
+            {plt_apps, all_deps} % default: top_level_deps
+]}.
diff --git a/src/msgpack.erl b/src/msgpack.erl
index 2830c66..920e83c 100644
--- a/src/msgpack.erl
+++ b/src/msgpack.erl
@@ -46,6 +46,7 @@
 -include("msgpack.hrl").
 
 -export_type([object/0, msgpack_map/0, options/0, ext_packer/0, ext_unpacker/0]).
+-export_type([msgpack_map_jiffy/0, msgpack_map_jsx/0]).
 -type object() :: msgpack_term().
 
 -type options() ::
diff --git a/src/msgpack.hrl b/src/msgpack.hrl
index d7afb2b..2d39702 100644
--- a/src/msgpack.hrl
+++ b/src/msgpack.hrl
@@ -28,6 +28,7 @@
 -type msgpack_term() :: [msgpack_term()] | msgpack_map() |
                         integer() | float() | boolean() | binary() | string() | {string, string()}.
 
+%% jiffy, jsx would be soon deprecated as the map is now primitive type.
 -type format_type() :: jsx|jiffy|map.
 
 -define(DEFAULT_MAP_FORMAT, map).
diff --git a/test/prop_msgpack.erl b/test/prop_msgpack.erl
new file mode 100644
index 0000000..488e143
--- /dev/null
+++ b/test/prop_msgpack.erl
@@ -0,0 +1,184 @@
+%% Copyright (C) 2009-2023 UENISHI Kota
+%%
+%%    Licensed under the Apache License, Version 2.0 (the "License");
+%%    you may not use this file except in compliance with the License.
+%%    You may obtain a copy of the License at
+%%
+%%        http://www.apache.org/licenses/LICENSE-2.0
+%%
+%%    Unless required by applicable law or agreed to in writing, software
+%%    distributed under the License is distributed on an "AS IS" BASIS,
+%%    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%%    See the License for the specific language governing permissions and
+%%    limitations under the License.
+%%
+
+-module(prop_msgpack).
+-include_lib("proper/include/proper.hrl").
+-include("msgpack.hrl").
+
+
+%% -define(NUMTESTS, 16).
+%% -define(QC_OUT(P),
+%%         eqc:on_output(fun(Str, Args) ->
+%%                               io:format(user, Str, Args) end, P)).
+%% -define(_assertProp(S),
+%%         {timeout, ?NUMTESTS * 10,
+%%          ?_assert(quickcheck(numtests(?NUMTESTS, ?QC_OUT(S))))}).
+
+%% eqc_test_() ->
+%%     {inparallel,
+%%      [
+%%       ?_assertProp(prop_msgpack()),
+%%       ?_assertProp(prop_msgpack([{format, jiffy}])),
+%%       ?_assertProp(prop_msgpack([{format, jsx}]))
+%%       ]}.
+
+%%% Primitive Properties %%%
+prop_uint() ->
+    ?FORALL(
+       {UnsignedInt, Opts},
+       {oneof([positive_fixnum(), uint8(), uint16(), uint32(), uint64()]),
+        stable_opts()},
+       pack_and_unpack(UnsignedInt, Opts)).
+
+prop_int() ->
+    ?FORALL(
+       {Int, Opts},
+       {oneof([positive_fixnum(), negative_fixnum(), int8(), int16(), int32(), int64()]),
+        stable_opts()},
+       pack_and_unpack(Int, Opts)).
+
+prop_binary() ->
+    ?FORALL(
+       {Binary, Opts},
+       {oneof([fix_raw(), raw16(), raw32()]), stable_opts()},
+       pack_and_unpack(Binary, Opts)).
+
+prop_float() ->
+    ?FORALL(
+       Float,
+       proper_types:float(),
+       pack_and_unpack(Float, [])).
+
+prop_primitive() ->
+    ?FORALL(
+       {PrimObj, Opts},
+       {oneof(primitive_types()), stable_opts()},
+       pack_and_unpack(PrimObj, Opts)).
+
+prop_array_primitive() ->
+    ?FORALL(
+       {Array, Opts},
+       {oneof([fix_array_primitive(), array16_primitive()]), stable_opts()},
+       pack_and_unpack(Array, Opts)).
+
+prop_map_primitive() ->
+    ?FORALL(
+       {Map, Opts},
+       {oneof([fix_map_primitive(), map16_primitive()]), stable_opts()},
+       pack_and_unpack(Map, Opts)).
+
+prop_msgpack() ->
+    ?FORALL({Obj, Opts},
+            {msgpack_object(), stable_opts()},
+            pack_and_unpack(Obj, Opts)).
+
+prop_string() ->
+    ?FORALL({Str, Opts},
+            {utf8(),
+             oneof(
+               [
+                [],
+                [{unpack_str, as_list},{pack_str, from_list},{validate_string,true}],
+                [{unpack_str, as_binary},{pack_str, from_binary},{validate_string,true}],
+                [{unpack_str, as_tagged_list},{pack_str, from_tagged_list},{validate_string,true}]
+               ])},
+            pack_and_unpack(unicode:characters_to_list(Str), Opts)).
+
+
+%%% Helpers %%%
+pack_and_unpack(Obj, Opts) ->
+    Bin = msgpack:pack(Obj, Opts),
+    {ok, Obj} = msgpack:unpack(Bin, Opts),
+    is_binary(Bin).
+
+
+%%% Generators %%%
+stable_opts() ->
+    % TODO: build property tests on options
+    [].
+
+null() -> null.
+
+positive_fixnum() -> choose(0, 127).
+negative_fixnum() -> choose(-32, -1).
+
+int8() ->  choose(-16#80, 16#7F).
+int16() -> oneof([choose(-16#8000, -16#81),
+                  choose(16#80, 16#7FFF)]).
+int32() -> oneof([choose(-16#80000000, -16#8001),
+                  choose(16#10000, 16#7FFFFFFF)]).
+int64() -> oneof([choose(-16#8000000000000000, -16#80000001),
+                  choose(16#100000000, 16#7FFFFFFFFFFFFFFF)]).
+
+uint8() ->  choose(0, 16#FF).
+uint16() -> choose(16#100, 16#FFFF).
+uint32() -> choose(16#10000, 16#FFFFFFFF).
+uint64() -> choose(16#100000000, 16#FFFFFFFFFFFFFFFF).
+
+fix_raw() ->
+    ?LET(Integer, choose(0, 31),
+         ?LET(Binary, binary(Integer), Binary)).
+
+raw16() ->
+    ?LET(Integer, uint16(),
+         ?LET(Binary, binary(Integer), Binary)).
+
+raw32() ->
+    ?LET(Binary, binary(65537), Binary).
+
+primitive_types() ->
+    [
+     null(),
+     positive_fixnum(), negative_fixnum(),
+     int8(), int16(), int32(), int64(),
+     uint8(), uint16(), uint32(), uint64(),
+     proper_types:float(), proper_types:bool(),
+     fix_raw(), raw16(), raw32()
+    ].
+
+
+container_types() ->
+    [ fix_array_primitive(), array16_primitive(),
+      fix_map_primitive(), map16_primitive() ].
+
+fix_array_primitive() ->
+    %% up to 2^4-1
+    %% TODO: check the first 4 bits be 1001
+    resize(15, proper_types:list(oneof(primitive_types()))).
+
+array16_primitive() ->
+    %% Up to 2^16-1, but for performance
+    %% TODO: check the first byte be 0xdc (so s 0xdd for array32)
+    resize(128, proper_types:list(oneof(primitive_types()))).
+
+fix_map_primitive() ->
+    %% up to 2^4-1
+    %% TODO: check the first 4 bits be 1000
+    resize(15,
+           proper_types:map(
+             oneof(primitive_types()),
+             oneof(primitive_types()))).
+
+map16_primitive() ->
+    %% Up to 2^16-1, but for performance
+    %% TODO: check the first byte be 0xde (so s 0xdf for map32)
+    resize(128,
+           proper_types:map(
+             oneof(primitive_types()),
+             oneof(primitive_types()))).
+
+%% TODO: add map
+msgpack_object() ->
+    oneof(container_types() ++ primitive_types()).
openSUSE Build Service is sponsored by