From 6f325e44e031aee8021dae2a589321d82436b266 Mon Sep 17 00:00:00 2001 From: Groshev Dmitry Date: Tue, 4 Oct 2011 01:08:53 +0400 Subject: [PATCH] first approach to property-based testing --- test/jiffy_SUITE.erl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/jiffy_SUITE.erl diff --git a/test/jiffy_SUITE.erl b/test/jiffy_SUITE.erl new file mode 100644 index 0000000..0806037 --- /dev/null +++ b/test/jiffy_SUITE.erl @@ -0,0 +1,25 @@ +-module(jiffy_SUITE). +-include_lib("proper/include/proper.hrl"). +-include_lib("proper_stdlib/include/proper_ct.hrl"). +-compile(export_all). + +all() -> proper_ct:testcases(?MODULE). + +init_per_testcase(tc_prop_foo, Config) -> + [{proper, [{numtests, 1000}]} | Config]. + +-type json_any() :: json_list() + | json_dict() + | json_number() + | json_string() + | json_null(). +-type json_list() :: list(json_any()). +-type json_dict() :: {[{json_key(), json_any()}]}. +-type json_key() :: binary(). +-type json_number() :: integer() | float(). +-type json_string() :: binary(). +-type json_null() :: null. + +prop_foo() -> + ?FORALL(Data, json_any(), + Data == jiffy:decode(jiffy:encode(Data))).