Sha256: 5f571e30670a572a7777675fbab8d2e3cbe3eb109a3959d148a9534128dd4eca

Contents?: true

Size: 1.12 KB

Versions: 38

Compression:

Stored size: 1.12 KB

Contents

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

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

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

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

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

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

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

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

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

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

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

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

print("All tests passed!")

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
trackler-2.1.0.19 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.18 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.17 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.16 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.15 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.14 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.13 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.12 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.11 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.10 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.9 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.8 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.7 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.6 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.5 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.4 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.3 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.2 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.1 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.1.0.0 tracks/r/exercises/scrabble-score/test_scrabble-score.R