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.65 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.64 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.63 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.62 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.61 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.60 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.59 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.58 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.57 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.56 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.55 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.54 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.53 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.52 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.51 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.50 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.49 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.48 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.47 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R
trackler-2.2.1.46 tracks/r/exercises/collatz-conjecture/test_collatz-conjecture.R