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