=== source code for shell_SUITE:progex_lc/1
=== Test case started with:
shell_SUITE:progex_lc([{watchdog,<0.7643.6>},
{tc_logfile,"/home/pi/R16B03/otp-support/release/tests/test_server/ct_run.test_server@localhost.2014-01-03_17.38.00/tests.stdlib_test.logs/run.2014-01-03_17.51.25/shell_suite.progex_lc.html"},
{tc_group_properties,[{name,progex}]},
{tc_group_path,[]},
{data_dir,"/home/pi/R16B03/otp-support/release/tests/stdlib_test/shell_SUITE_data/"},
{priv_dir,"/home/pi/R16B03/otp-support/release/tests/test_server/ct_run.test_server@localhost.2014-01-03_17.38.00/tests.stdlib_test.logs/run.2014-01-03_17.51.25/log_private/"},
{nodenames,[]}])
=== Current directory is "/home/pi/R16B03/otp-support/release/tests/test_server/ct_run.test_server@localhost.2014-01-03_17.38.00"
=== Started at 2014-01-03 20:21:01
*** Testing [a,4,b,5,6] = [X || X <- [1,2,a,3,4,b,5,6], X > 3],
[4,5,6] = [X || X <- [1,2,a,3,4,b,5,6], integer(X), X > 3],
[{1,a},{1,b},{2,a},{2,b},{3,a},{3,b}] =
[{X, Y} || X <- [1,2,3], Y <- [a,b]],
Sort = fun([Pivot|T], Fn) ->
Fn([ X || X <- T, X < Pivot], Fn) ++
[Pivot] ++
Fn([ X || X <- T, X >= Pivot], Fn);
([], _Fn) -> []
end,
[1,2,3,4,5,6,7,8] = Sort([4,5,1,8,3,6,7,2], Sort),
Perms = fun([], _Fn) -> [[]];
(L, Fn) -> [[H|T] || H <- L, T <- Fn(L--[H], Fn)]
end,
[[b,u,g],[b,g,u],[u,b,g],[u,g,b],[g,b,u],[g,u,b]] =
Perms([b,u,g], Perms),
Pyth = fun(N) ->
[ {A,B,C} ||
A <- lists:seq(1,N),
B <- lists:seq(1,N),
C <- lists:seq(1,N),
A+B+C =< N,
A*A+B*B == C*C
]
end,
[] = Pyth(11),
[{3,4,5},{4,3,5}] = Pyth(12),
%[{3,4,5},{4,3,5},{5,12,13},{6,8,10},{8,6,10},{8,15,17},
% {9,12,15},{12,5,13},{12,9,15},{12,16,20},{15,8,17},
% {16,12,20}] = Pyth(50),
Pyth1 = fun(N) ->
[{A,B,C} ||
A <- lists:seq(1,N),
B <- lists:seq(1,N-A+1),
C <- lists:seq(1,N-A-B+2),
A+B+C =< N,
A*A+B*B == C*C ]
end,
[] = Pyth1(11),
[{3,4,5},{4,3,5}] = Pyth1(12),
[{3,4,5},{4,3,5},{5,12,13},{6,8,10},{8,6,10},{8,15,17},
{9,12,15},{12,5,13},{12,9,15},{12,16,20},{15,8,17},
{16,12,20}] = Pyth1(50),
Append = fun(L) -> [X || L1 <- L, X <- L1] end,
[1,2,3,4,5] = Append([[1,2,3],[4,5]]),
Map = fun(Fun, L) -> [Fun(X) || X <- L] end,
[2,3,4] = Map(fun(X) -> X + 1 end, [1,2,3]),
Filter = fun(Pred, L) -> [X || X <- L, Pred(X)] end,
[2,4] = Filter(fun(X) -> X > 1 end, [0,2,4]),
Select = fun(X, L) -> [Y || {X, Y} <- L] end,
[1,2,3,7] = Select(b,[{a,1},{b,2},{c,3},{b,7}]),
Select2 = fun(X, L) -> [Y || {X1, Y} <- L, X == X1] end,
[2,7] = Select2(b,[{a,1},{b,2},{c,3},{b,7}]),
ok.
=== Ended at 2014-01-03 20:21:08
=== successfully completed test case
=== returned value = ok
Test run history
| Top level test index