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.48 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.47 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.46 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.45 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.44 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.43 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.42 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.41 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.40 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.39 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.38 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.37 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.36 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.34 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.33 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.32 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.31 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.30 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.29 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.28 tracks/r/exercises/scrabble-score/test_scrabble-score.R