Sha256: 85d85c220393f9d2434b317a880da347745b87b45f6293186ea7949c77d0e4a0

Contents?: true

Size: 1.15 KB

Versions: 26

Compression:

Stored size: 1.15 KB

Contents

source("./scrabble-score.R")
library(testthat)

test_that("lowercase letter", {
  input <- "a"
  expect_equal(scrabble_score(input), 1)
})

test_that("uppercase letter", {
  input <- "A"
  expect_equal(scrabble_score(input), 1)
})

test_that("valuable letter", {
  input <- "f"
  expect_equal(scrabble_score(input), 4)
})

test_that("short word", {
  input <- "at"
  expect_equal(scrabble_score(input), 2)
})

test_that("short, valuable word", {
  input <- "zoo"
  expect_equal(scrabble_score(input), 12)
})

test_that("medium word", {
  input <- "street"
  expect_equal(scrabble_score(input), 6)
})

test_that("medium, valuable word", {
  input <- "quirky"
  expect_equal(scrabble_score(input), 22)
})

test_that("long, mixed-case word", {
  input <- "OxyphenButazone"
  expect_equal(scrabble_score(input), 41)
})

test_that("english-like word", {
  input <- "pinata"
  expect_equal(scrabble_score(input), 8)
})

test_that("empty input", {
  input <- ""
  expect_equal(scrabble_score(input), 0)
})

test_that("entire alphabet available", {
  input <- "abcdefghijklmnopqrstuvwxyz"
  expect_equal(scrabble_score(input), 87)
})

print("All tests passed for exercise: scrabble-score")

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
trackler-2.1.0.27 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.26 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.25 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.24 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.23 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.22 tracks/r/exercises/scrabble-score/test_scrabble-score.R