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.109 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.108 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.107 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.106 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.105 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.104 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.103 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.102 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.101 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.100 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.99 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.98 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.97 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.96 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.95 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.94 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.93 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.92 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.91 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs
trackler-2.2.1.90 tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs