Sha256: d7b3f0f23cb76bbc3db6919c5ea2d511e68e8908cd6068d9cb3af4611c2c8cb1

Contents?: true

Size: 1.31 KB

Versions: 148

Compression:

Stored size: 1.31 KB

Contents

import org.scalatest.{Matchers, FlatSpec}

/** @version created manually **/
class DequeTest extends FlatSpec with Matchers {

  it should "handle push then pop" in {
    val deque = Deque[Char]()
    deque.push('a')
    deque.push('b')
    deque.pop should be (Some('b'))
    deque.pop should be (Some('a'))
//    linkedList.pop should be (None)
  }

  it should "handle push then shift" in {
    pending
    val deque = Deque[Char]()
    deque.push('a')
    deque.push('b')
    deque.shift should be (Some('a'))
    deque.shift should be (Some('b'))
//    linkedList.shift should be (None)
  }

  it should "handle unshift then shift" in {
    pending
    val deque = Deque[Char]()
    deque.unshift('a')
    deque.unshift('b')
    deque.shift should be (Some('b'))
    deque.shift should be (Some('a'))
  }

  it should "handle unshift then pop" in {
    pending
    val deque = Deque[Char]()
    deque.unshift('a')
    deque.unshift('b')
    deque.pop should be (Some('a'))
    deque.pop should be (Some('b'))
  }

  it should "handle complex interaction" in {
    pending
    val deque = Deque[Int]()
    deque.push(1)
    deque.push(2)
    deque.pop should be (Some(2))
    deque.push(3)
    deque.unshift(4)
    deque.push(5)
    deque.shift should be (Some(4))
    deque.pop should be (Some(5))
    deque.pop should be (Some(3))
  }
}

Version data entries

148 entries across 148 versions & 1 rubygems

Version Path
trackler-2.2.1.38 tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala
trackler-2.2.1.37 tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala
trackler-2.2.1.36 tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala
trackler-2.2.1.35 tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala
trackler-2.2.1.34 tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala
trackler-2.2.1.33 tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala
trackler-2.2.1.32 tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala
trackler-2.2.1.31 tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala