Sha256: fbf41f4b9838710d7ff47e91be0b30d13ae7c4a9f637d0c8f81b15ab54df0205
Contents?: true
Size: 739 Bytes
Versions: 119
Compression:
Stored size: 739 Bytes
Contents
source("./collatz-conjecture.R") library(testthat) test_that("Input of 1 results in 0 steps", { expect_equal(collatz_step_counter(1), 0) }) test_that("Even input with repeated even steps", { expect_equal(collatz_step_counter(16), 4) }) test_that("Input which results in small number of even and odd steps", { expect_equal(collatz_step_counter(12), 9) }) test_that("Input which results in large number of even and odd steps", { expect_equal(collatz_step_counter(1000000), 152) }) test_that("Input of 0 results in an error", { expect_error(collatz_step_counter(0)) }) test_that("Negative input results in an error", { expect_error(collatz_step_counter(-15)) }) message("All tests passed for exercise: collatz-conjecture")
Version data entries
119 entries across 119 versions & 1 rubygems