diff --git a/lib/excoveralls/local.ex b/lib/excoveralls/local.ex index 2317f719..2660a1fc 100644 --- a/lib/excoveralls/local.ex +++ b/lib/excoveralls/local.ex @@ -2,8 +2,8 @@ defmodule ExCoveralls.Local do @moduledoc """ Locally displays the result to screen. """ - - + + defmodule Count do @moduledoc """ @@ -145,16 +145,16 @@ defmodule ExCoveralls.Local do end defp format_info([stat, count]) do - coverage = get_coverage(count) + coverage = count |>get_coverage() |> Float.floor(1) file_width = ExCoveralls.Settings.get_file_col_width - print_string("~5.1f% ~-#{file_width}s ~8w ~8w ~8w", + print_string("~5w% ~-#{file_width}s ~8w ~8w ~8w", [coverage, stat[:name], count.lines, count.relevant, count.relevant - count.covered]) end defp format_total(info) do totals = Enum.reduce(info, %Count{}, fn([_, count], acc) -> append(count, acc) end) - coverage = get_coverage(totals) - print_string("[TOTAL] ~5.1f%", [coverage]) + coverage = totals |> get_coverage() |> Float.floor(1) + print_string("[TOTAL] ~5w%", [coverage]) end defp append(a, b) do diff --git a/lib/excoveralls/stats.ex b/lib/excoveralls/stats.ex index 75e0b205..5362f0f2 100644 --- a/lib/excoveralls/stats.ex +++ b/lib/excoveralls/stats.ex @@ -207,7 +207,7 @@ defmodule ExCoveralls.Stats do if value == trunc(value) do trunc(value) else - Float.round(value, 1) + Float.floor(value, 1) end end diff --git a/test/stats_test.exs b/test/stats_test.exs index e6d68674..4649e180 100644 --- a/test/stats_test.exs +++ b/test/stats_test.exs @@ -133,7 +133,7 @@ defmodule ExCoveralls.StatsTest do test "coverage stats are rounded to one decimal place" do results = Stats.source(@fractional_source_info) - assert(results.coverage == 66.7) + assert(results.coverage == 66.6) end describe "update_stats/2" do