quickcheck/000755 000765 000024 00000000000 11347736021 013615 5ustar00mietekstaff000000 000000 quickcheck/e1.erl000644 000765 000024 00000000240 11347736007 014626 0ustar00mietekstaff000000 000000 -module(e1). -compile(export_all). from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}; from_additive(blue) -> {cyan, magenta}. quickcheck/e2.erl000644 000765 000024 00000000242 11347736007 014631 0ustar00mietekstaff000000 000000 -module(e2). -compile(export_all). from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}. % from_additive(blue) -> {cyan, magenta}. quickcheck/e3.erl000644 000765 000024 00000000223 11347736007 014631 0ustar00mietekstaff000000 000000 -module(e3). -compile(export_all). from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}; from_additive(blue) -> 42. quickcheck/e4.erl000644 000765 000024 00000000240 11347736007 014631 0ustar00mietekstaff000000 000000 -module(e4). -compile(export_all). from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}; from_additive(bleu) -> {cyan, magenta}. quickcheck/e5.erl000644 000765 000024 00000000240 11347736007 014632 0ustar00mietekstaff000000 000000 -module(e5). -compile(export_all). from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}; from_additive(blue) -> {cyan, magneta}. quickcheck/ed1.erl000644 000765 000024 00000000563 11347736007 015002 0ustar00mietekstaff000000 000000 -module(ed1). -compile(export_all). -type additive() :: red | green | blue. -type subtractive() :: cyan | magenta | yellow. -spec from_additive(additive()) -> {subtractive(), subtractive()}. from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}; from_additive(blue) -> {cyan, magenta}. test() -> from_additive(blue). quickcheck/ed2.erl000644 000765 000024 00000000565 11347736007 015005 0ustar00mietekstaff000000 000000 -module(ed2). -compile(export_all). -type additive() :: red | green | blue. -type subtractive() :: cyan | magenta | yellow. -spec from_additive(additive()) -> {subtractive(), subtractive()}. from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}. % from_additive(blue) -> {cyan, magenta}. test() -> from_additive(blue). quickcheck/ed3.erl000644 000765 000024 00000000546 11347736007 015005 0ustar00mietekstaff000000 000000 -module(ed3). -compile(export_all). -type additive() :: red | green | blue. -type subtractive() :: cyan | magenta | yellow. -spec from_additive(additive()) -> {subtractive(), subtractive()}. from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}; from_additive(blue) -> 42. test() -> from_additive(blue). quickcheck/ed4.erl000644 000765 000024 00000000563 11347736007 015005 0ustar00mietekstaff000000 000000 -module(ed4). -compile(export_all). -type additive() :: red | green | blue. -type subtractive() :: cyan | magenta | yellow. -spec from_additive(additive()) -> {subtractive(), subtractive()}. from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}; from_additive(bleu) -> {cyan, magenta}. test() -> from_additive(blue). quickcheck/ed5.erl000644 000765 000024 00000000563 11347736007 015006 0ustar00mietekstaff000000 000000 -module(ed5). -compile(export_all). -type additive() :: red | green | blue. -type subtractive() :: cyan | magenta | yellow. -spec from_additive(additive()) -> {subtractive(), subtractive()}. from_additive(red) -> {magenta, yellow}; from_additive(green) -> {cyan, yellow}; from_additive(blue) -> {cyan, magneta}. test() -> from_additive(blue). quickcheck/h1.hs000644 000765 000024 00000000432 11347736007 014464 0ustar00mietekstaff000000 000000 module H1 where data Additive = Red | Green | Blue data Subtractive = Cyan | Magenta | Yellow fromAdditive :: Additive -> (Subtractive, Subtractive) fromAdditive Red = (Magenta, Yellow) fromAdditive Green = (Cyan, Yellow) fromAdditive Blue = (Cyan, Magenta) quickcheck/h2.hs000644 000765 000024 00000000415 11347736007 014466 0ustar00mietekstaff000000 000000 module H2 where data Additive = Red | Green | Blue data Subtractive = Cyan | Magenta | Yellow fromAdditive :: Additive -> (Subtractive, Subtractive) fromAdditive Red = (Magenta, Yellow) fromAdditive Green = (Cyan, Yellow) -- fromAdditive Blue = (Cyan, Magenta) quickcheck/h3.hs000644 000765 000024 00000000375 11347736007 014474 0ustar00mietekstaff000000 000000 module H3 where data Additive = Red | Green | Blue data Subtractive = Cyan | Magenta | Yellow fromAdditive :: Additive -> (Subtractive, Subtractive) fromAdditive Red = (Magenta, Yellow) fromAdditive Green = (Cyan, Yellow) fromAdditive Blue = 42 quickcheck/h4.hs000644 000765 000024 00000000412 11347736007 014465 0ustar00mietekstaff000000 000000 module H4 where data Additive = Red | Green | Blue data Subtractive = Cyan | Magenta | Yellow fromAdditive :: Additive -> (Subtractive, Subtractive) fromAdditive Red = (Magenta, Yellow) fromAdditive Green = (Cyan, Yellow) fromAdditive Bleu = (Cyan, Magenta) quickcheck/main.hs000644 000765 000024 00000000160 11347736007 015076 0ustar00mietekstaff000000 000000 module Main where import H1 () import H2 () -- import H3 () -- import H4 () main :: IO () main = putStrLn "." quickcheck/Makefile000644 000765 000024 00000000374 11347736007 015265 0ustar00mietekstaff000000 000000 ERLS = $(wildcard *.erl) BEAMS = $(patsubst %.erl,%.beam,$(ERLS)) all: hs erl erl: $(BEAMS) hs: ghc --make -Wall Main.hs -o main %.beam: %.erl erlc -Wall $< type: typer -r . dialyze: dialyzer -n --src -r . clean: rm -f main *.hi *.o *.beam quickcheck/qc1.erl000644 000765 000024 00000000627 11347736007 015016 0ustar00mietekstaff000000 000000 -module(qc1). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). -define(ADDITIVE, [red, green, blue]). -define(SUBTRACTIVE, [cyan, magenta, yellow]). additive() -> oneof(?ADDITIVE). prop_from_additive(Module) -> ?FORALL(A, additive(), begin {S1, S2} = Module:from_additive(A), lists:member(S1, ?SUBTRACTIVE) andalso lists:member(S2, ?SUBTRACTIVE) end). quickcheck/qc10.erl000644 000765 000024 00000000662 11347736007 015075 0ustar00mietekstaff000000 000000 -module(qc10). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). queue() -> ?SIZED(N, queue(N)). queue(0) -> {call, queue, new, []}; queue(N) -> ?LAZY(oneof([queue(0), {call, queue, cons, [int(), queue(N - 1)]}])). model(Q) -> queue:to_list(Q). prop_queue_last_cons() -> ?FORALL({I, Q}, {int(), queue()}, model(queue:cons(I, eval(Q))) == model(eval(Q)) ++ [I]). quickcheck/qc11.erl000644 000765 000024 00000000661 11347736007 015075 0ustar00mietekstaff000000 000000 -module(qc11). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). queue() -> ?SIZED(N, queue(N)). queue(0) -> {call, queue, new, []}; queue(N) -> ?LAZY(oneof([queue(0), {call, queue, cons, [int(), queue(N - 1)]}])). model(Q) -> queue:to_list(Q). prop_queue_last_cons() -> ?FORALL({I, Q}, {int(), queue()}, model(queue:cons(I, eval(Q))) == [I | model(eval(Q))]). quickcheck/qc2.erl000644 000765 000024 00000000306 11347736007 015011 0ustar00mietekstaff000000 000000 -module(qc2). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). prop_lists_delete() -> ?FORALL(I, int(), ?FORALL(L, list(int()), not lists:member(I, lists:delete(I, L)))). quickcheck/qc3.erl000644 000765 000024 00000000337 11347736007 015016 0ustar00mietekstaff000000 000000 -module(qc3). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). prop_lists_delete() -> ?FORALL(I, int(), ?FORALL(L, list(int()), collect({I, L}, not lists:member(I, lists:delete(I, L))))). quickcheck/qc4.erl000644 000765 000024 00000000353 11347736007 015015 0ustar00mietekstaff000000 000000 -module(qc4). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). prop_lists_delete() -> ?FORALL(I, int(), ?FORALL(L, list(int()), collect(lists:member(I, L), not lists:member(I, lists:delete(I, L))))). quickcheck/qc5.erl000644 000765 000024 00000000350 11347736007 015013 0ustar00mietekstaff000000 000000 -module(qc5). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). prop_lists_delete() -> ?FORALL(I, int(), ?FORALL(L, list(int()), ?IMPLIES(lists:member(I, L), not lists:member(I, lists:delete(I, L))))). quickcheck/qc6.erl000644 000765 000024 00000000364 11347736007 015021 0ustar00mietekstaff000000 000000 -module(qc6). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). prop_lists_delete() -> ?FORALL(I, int(), ?FORALL(L, list(int()), ?IMPLIES(lists:member(I, L), fails( not lists:member(I, lists:delete(I, L)))))). quickcheck/qc7.erl000644 000765 000024 00000000260 11347736007 015015 0ustar00mietekstaff000000 000000 -module(qc7). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). prop_queue_last_cons() -> ?FORALL(I, int(), I == queue:last(queue:cons(I, queue:new()))). quickcheck/qc8.erl000644 000765 000024 00000000545 11347736007 015024 0ustar00mietekstaff000000 000000 -module(qc8). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). queue() -> ?SIZED(N, queue(N)). queue(0) -> queue:new(); queue(N) -> oneof([queue(0), ?LET({I, Q}, {int(), queue(N - 1)}, queue:cons(I, Q))]). prop_queue_last_cons() -> ?FORALL({I, Q}, {int(), queue()}, queue:last(queue:cons(I, Q)) == I). quickcheck/qc9.erl000644 000765 000024 00000000573 11347736007 015026 0ustar00mietekstaff000000 000000 -module(qc9). -compile(export_all). -include_lib("eqc/include/eqc.hrl"). queue() -> ?SIZED(N, queue(N)). queue(0) -> {call, queue, new, []}; queue(N) -> ?LAZY(oneof([queue(0), {call, queue, cons, [int(), queue(N - 1)]}])). prop_queue_last_cons() -> ?FORALL({I, Q}, {int(), queue()}, queue:last(queue:cons(I, eval(Q))) == I).