Skip to content

Commit

Permalink
Add timers to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljaouen committed Apr 15, 2024
1 parent 04968f4 commit 38a311e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/dynamic_programming_in_elixir_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ defmodule DynamicProgrammingInElixirTest do
_e4 = :digraph.add_edge(g, v2, sink, DynamicProgrammingInElixir.make_cost_fn(4))
_e5 = :digraph.add_edge(g, v3, sink, DynamicProgrammingInElixir.make_cost_fn(1))

assert DynamicProgrammingInElixir.lowest_cost_path(g, source, sink) ==
{:ok, [source, v1, sink], 4}
{time_in_microseconds, ret_val} =
:timer.tc(fn -> DynamicProgrammingInElixir.lowest_cost_path(g, source, sink) end)

IO.puts("Time in microseconds: #{time_in_microseconds}")
assert ret_val == {:ok, [source, v1, sink], 4}
end
end

0 comments on commit 38a311e

Please sign in to comment.