1: -module(mongoose_lib_SUITE). 2: -include_lib("eunit/include/eunit.hrl"). 3: -compile([export_all, nowarn_export_all]). 4: 5: all() -> 6: [pmap_works]. 7: 8: init_per_suite(C) -> 9: C. 10: 11: end_per_suite(C) -> 12: C. 13: 14: pmap_works(_C) -> 15: ?assertEqual([{ok, 1}, {ok, 2}, {ok, 3}], 16: mongoose_lib:pmap(fun(X) -> X end, [1, 2, 3])), 17: ?assertMatch([{ok, 1}, {error, {oops, _}}, {ok, 3}], 18: mongoose_lib:pmap(fun(2) -> error(oops); (X) -> X end, 19: [1, 2, 3])), 20: ?assertMatch([_, {error, timeout}, _], 21: mongoose_lib:pmap(fun(2) -> timer:sleep(50000); (X) -> X end, 22: [1, 2, 3], 10)).