Sha256: 09f25398e0393b98d5fb3c9c57372fa713f406a7b41b84fd44a856ae77a3f7cc

Contents?: true

Size: 1.21 KB

Versions: 124

Compression:

Stored size: 1.21 KB

Contents

if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("collatz_conjecture.exs", __DIR__)
end

ExUnit.start
ExUnit.configure exclude: :pending, trace: true

defmodule CollatzConjectureTest do
  use ExUnit.Case

  test "zero steps for one" do
    assert CollatzConjecture.calc(1) == 0
  end

  @tag :pending
  test "zero is an error" do
    assert_raise FunctionClauseError, fn -> CollatzConjecture.calc(0) end
  end

  @tag :pending
  test "divide if even" do
    assert CollatzConjecture.calc(16) == 4
  end

  @tag :pending
  test "even and odd steps" do
    assert CollatzConjecture.calc(12) == 9
  end

  @tag :pending
  test "Large number of even and odd steps" do
    assert CollatzConjecture.calc(1000000) == 152
  end

  @tag :pending
  test "start with odd step" do
    assert CollatzConjecture.calc(21) == 7
  end

  @tag :pending
  test "more steps than starting number" do
    assert CollatzConjecture.calc(7) == 16
  end

  @tag :pending
  test "negative value is an error " do
    assert_raise FunctionClauseError, fn -> CollatzConjecture.calc(-15) end
  end

  @tag :pending
  test "string as input value is an error " do
    assert_raise FunctionClauseError, fn -> CollatzConjecture.calc("fubar") end
  end
end

Version data entries

124 entries across 124 versions & 1 rubygems

Version Path
trackler-2.2.1.29 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.28 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.27 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.26 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.25 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.24 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.23 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.22 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.21 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.20 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.19 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.18 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.17 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.16 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.15 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.14 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.13 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.12 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.11 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.10 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs