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