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

Version Path
trackler-2.2.1.126 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.125 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.124 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.123 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.122 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.121 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.120 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.119 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.118 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.117 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.116 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.115 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.114 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.113 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.111 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.110 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.109 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.108 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.107 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.106 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R