-module(nfail).
-export([test/1]).

iterate(0, Acc) -> Acc;
iterate(N, Acc) ->
	iterate(N - 1,
		[case string:to_integer("134217728,\n") of
			{Int, _} -> Int
		end | Acc]).

test(N) ->
	{Self, Ref} = {self(), make_ref()},
	spawn_opt(fun()->
		L = iterate(N, []),
		BadList = [X || X <- L, X =/= 134217728],
		BadLen = length(BadList),
		io:format("~b bad conversions: ~p~n", [BadLen, BadList]),
		Self ! {done, Ref, BadLen}
		end,
		[link,{fullsweep_after,0}]),
	receive {done, Ref, Len} -> Len end.
