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.0.8.55 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.54 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.53 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.52 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.51 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.50 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.49 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.48 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.47 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.46 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.45 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.44 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.43 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.42 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.41 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.40 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.39 tracks/r/exercises/scrabble-score/test_scrabble-score.R
trackler-2.0.8.38 tracks/r/exercises/scrabble-score/test_scrabble-score.R