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.2.1.85 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.84 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.83 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.82 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.81 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.80 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.79 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.78 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.77 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.76 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.75 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.74 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.73 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.72 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.71 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.70 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.69 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.68 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.67 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala
trackler-2.2.1.66 tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala