Sha256: 2931b10b346492b0ea969cd97fa1fc5c990cb26e34c6e6454d8360cfa44a15e7

Contents?: true

Size: 1.06 KB

Versions: 26

Compression:

Stored size: 1.06 KB

Contents

source("./perfect-numbers.R")
library(testthat)

test_that("first perfect number", {
  n <- 6
  expect_equal(is_perfect(n), TRUE)
})

test_that("no perfect number", {
  n <- 8
  expect_equal(is_perfect(n), FALSE)
})

test_that("second perfect number", {
  n <- 28
  expect_equal(is_perfect(n), TRUE)
})

test_that("abundant", {
  n <- 20
  expect_equal(is_perfect(n), FALSE)
})

test_that("answer to the ultimate question of life", {
  n <- 42
  expect_equal(is_perfect(n), FALSE)
})

test_that("third perfect number", {
  n <- 496
  expect_equal(is_perfect(n), TRUE)
})

test_that("odd abundant", {
  n <- 945
  expect_equal(is_perfect(n), FALSE)
})

test_that("fourth perfect number", {
  n <- 8128
  expect_equal(is_perfect(n), TRUE)
})

test_that("fifth perfect number", {
  n <- 33550336
  expect_equal(is_perfect(n), TRUE)
})

test_that("sixth perfect number", {
  n <- 8589869056
  expect_equal(is_perfect(n), TRUE)
})

test_that("seventh perfect number", {
  n <- 137438691328
  expect_equal(is_perfect(n), TRUE)
})

print("All tests passed for exercise: perfect-numbers")

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
trackler-2.1.0.48 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.47 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.46 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.45 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.44 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.43 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.42 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.41 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.40 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.39 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.38 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.37 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.36 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.34 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.33 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.32 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.31 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.30 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.29 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R
trackler-2.1.0.28 tracks/r/exercises/perfect-numbers/test_perfect-numbers.R