Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

40 linhas
1003 B

% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
-module(jiffy_10_short_double_tests).
-include_lib("eunit/include/eunit.hrl").
-include("jiffy_util.hrl").
filename() ->
{ok, Cwd} = file:get_cwd(),
case filename:basename(Cwd) of
".eunit" ->
"../test/cases/short-doubles.txt";
_ ->
"test/cases/short-doubles.txt"
end.
short_double_test_() ->
{ok, Fd} = file:open(filename(), [read, binary, raw]),
{timeout, 300, ?_assertEqual(0, run(Fd, 0))}.
run(Fd, Acc) ->
case file:read_line(Fd) of
{ok, Data} ->
V1 = re:replace(iolist_to_binary(Data), <<"\.\n">>, <<"">>),
V2 = iolist_to_binary(V1),
V3 = <<34, V2/binary, 34>>,
R = jiffy:encode(jiffy:decode(V3)),
case R == V3 of
true -> run(Fd, Acc);
false -> run(Fd, Acc + 1)
end;
eof ->
Acc
end.