diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bea7cac..f8c2c08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: image: shiguredo/erlang:otp-27.0.1-openssl-3.3.1-ubuntu-24.04-x86_64 steps: - uses: actions/checkout@v4 - - run: make + - run: make ci - name: Slack Notification if: failure() uses: rtCamp/action-slack-notify@v2 diff --git a/CHANGES.md b/CHANGES.md index 0606bcb..6741d51 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,9 @@ - [CHANGE] rebar3 の minimum_otp_vsn を 27.0 にする - @voluntas +- [ADD] PBT を追加 + - clockwork のみ + - @voluntas - [UPDATE] rebar3 3.23.0 に更新する - @voluntas - [UPDATE] GitHub Actions の docker の OTP を 27.0.1 / OpenSSL 3.3.1 に上げる diff --git a/Makefile b/Makefile index 93bf583..653dc4a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -.PHONY: all upgrade compile test dialyzer clean github +.PHONY: all upgrade compile dialyzer test proper clean ci publish -all: clean upgrade compile test dialyzer +all: clean upgrade compile dialyzer test proper upgrade: @./rebar3 do update, upgrade --all @@ -8,19 +8,19 @@ upgrade: compile: @./rebar3 xref +dialyzer: + @./rebar3 dialyzer + test: @./rebar3 as test eunit, cover -dialyzer: - @./rebar3 dialyzer +proper: + @./rebar3 as test proper clean: @./rebar3 clean -github: - $(MAKE) compile - $(MAKE) dialyzer - $(MAKE) test +ci: compile dialyzer test proper publish: @./rebar3 hex publish package diff --git a/rebar.config b/rebar.config index 745f289..0b9f8e1 100644 --- a/rebar.config +++ b/rebar.config @@ -35,3 +35,8 @@ {elvis_output_format, colors}. {plugins, [rebar3_hex]}. + +{profiles, + [{test, + [{plugins, [rebar3_proper]}, + {deps, [{proper, {git, "https://github.com/proper-testing/proper", {branch, "master"}}}]}]}]}. diff --git a/test/prop_base32_clockwork.erl b/test/prop_base32_clockwork.erl new file mode 100644 index 0000000..3df7cb3 --- /dev/null +++ b/test/prop_base32_clockwork.erl @@ -0,0 +1,35 @@ +-module(prop_base32_clockwork). + +-export([prop_base32_clockwork_encode_decode/1]). + +-include_lib("proper/include/proper.hrl"). + + +prop_base32_clockwork_encode_decode(doc) -> + "base32_clockwork を encode して decode する"; +prop_base32_clockwork_encode_decode(opts) -> + [{numtests, 100000}, {on_output, fun proper_output/2}]. + + +prop_base32_clockwork_encode_decode() -> + ?FORALL(N, + range(1, 100), + ?FORALL(RandomBytes, + binary(N), + begin + Base32edBytes = base32_clockwork:encode(RandomBytes), + case base32_clockwork:decode(Base32edBytes) of + {ok, RandomBytes} -> + true; + {ok, _} -> + false; + {error, _Reason} -> + false + end + end)). + + +proper_output(".", _Args) -> + ok; +proper_output(Format, Args) -> + io:format(Format, Args).