1 -module(hope_option_SUITE).
19 -define(GROUP, option).
22 %% ============================================================================
23 %% Common Test callbacks
24 %% ============================================================================
38 Properties = [parallel],
39 [ {?GROUP, Properties, Tests}
43 %% =============================================================================
45 %% =============================================================================
48 IsFoo = fun (foo) -> true; (_) -> false end,
49 {some, foo} = hope_option:put(foo, IsFoo),
50 none = hope_option:put(bar, IsFoo).
53 foo = hope_option:get({some, foo}, bar),
54 bar = hope_option:get(none , bar).
57 FooToBar = fun (foo) -> bar end,
58 {some, bar} = hope_option:map({some, foo}, FooToBar),
59 none = hope_option:map(none , FooToBar).
63 Put = fun (Val) -> _ = put(Key, Val), ok end,
64 Get = fun () -> get(Key) end,
66 ok = hope_option:iter(none , Put),
68 ok = hope_option:iter({some, Val}, Put),
75 ResultError = {error, Bar},
76 {some, Foo} = hope_option:of_result(ResultOk),
77 none = hope_option:of_result(ResultError).