Sha256: 43a54ddaa7b96d2f887c0080799194b92c2cca45209f77f6217017a6a7387177

Contents?: true

Size: 1.67 KB

Versions: 140

Compression:

Stored size: 1.67 KB

Contents

import org.scalatest.{Matchers, FunSuite}

/** @version 1.0.1 */
class BookStoreTest extends FunSuite with Matchers {

  test("Only a single book") {
    BookStore.total(List(1)) should be (8)
  }

  test("Two of the same book") {
    pending
    BookStore.total(List(2, 2)) should be (16)
  }

  test("Empty basket") {
    pending
    BookStore.total(List()) should be (0)
  }

  test("Two different books") {
    pending
    BookStore.total(List(1, 2)) should be (15.2)
  }

  test("Three different books") {
    pending
    BookStore.total(List(1, 2, 3)) should be (21.6)
  }

  test("Four different books") {
    pending
    BookStore.total(List(1, 2, 3, 4)) should be (25.6)
  }

  test("Five different books") {
    pending
    BookStore.total(List(1, 2, 3, 4, 5)) should be (30)
  }

  test("Two groups of four is cheaper than group of five plus group of three") {
    pending
    BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 5)) should be (51.2)
  }

  test("Group of four plus group of two is cheaper than two groups of three") {
    pending
    BookStore.total(List(1, 1, 2, 2, 3, 4)) should be (40.8)
  }

  test("Two each of first 4 books and 1 copy each of rest") {
    pending
    BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5)) should be (55.6)
  }

  test("Two copies of each book") {
    pending
    BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5)) should be (60)
  }

  test("Three copies of first book and 2 each of remaining") {
    pending
    BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1)) should be (68)
  }

  test("Three each of first 2 books and 2 each of remaining books") {
    pending
    BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2)) should be (75.2)
  }
}

Version data entries

140 entries across 140 versions & 1 rubygems

Version Path
trackler-2.1.0.48 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.47 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.46 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.45 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.44 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.43 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.42 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.41 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.40 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.39 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.38 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.37 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.36 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.34 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.33 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.32 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.31 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.30 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.29 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.1.0.28 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala