-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace JUnit tests by ScalaTest tests
- Loading branch information
Julian Mendez
committed
Dec 20, 2017
1 parent
69506b7
commit ae511e1
Showing
6 changed files
with
43 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 31 additions & 35 deletions
66
tabulas-ext/src/test/scala/de/tudresden/inf/lat/tabulas/ext/parser/MyStackTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,51 @@ | ||
package de.tudresden.inf.lat.tabulas.ext.parser | ||
|
||
import org.scalatest.FunSpec | ||
import org.scalatest.FunSuite | ||
|
||
/** | ||
* Test class of MyStack[A] | ||
*/ | ||
class MyStackTest extends FunSpec { | ||
class MyStackTest extends FunSuite { | ||
|
||
describe("This tests a stack") { | ||
test("it should push and pop values in the right order") { | ||
val calPar = new CalendarParser() | ||
val myStack = new calPar.MyStack[String] | ||
|
||
it("should push and pop values in the right order") { | ||
val calPar = new CalendarParser() | ||
val myStack = new calPar.MyStack[String] | ||
assert(myStack.size === 0) | ||
|
||
assert(myStack.size === 0) | ||
myStack.push("1") | ||
myStack.push("2") | ||
assert(myStack.size === 2) | ||
|
||
myStack.push("1") | ||
myStack.push("2") | ||
assert(myStack.size === 2) | ||
myStack.push("2") | ||
assert(myStack.size === 3) | ||
|
||
myStack.push("2") | ||
assert(myStack.size === 3) | ||
myStack.push("3") | ||
assert(myStack.size === 4) | ||
|
||
myStack.push("3") | ||
assert(myStack.size === 4) | ||
val elem3: String = myStack.pop() | ||
assert(elem3 === "3") | ||
assert(myStack.size === 3) | ||
|
||
val elem3: String = myStack.pop() | ||
assert(elem3 === "3") | ||
assert(myStack.size === 3) | ||
val elem2: String = myStack.pop() | ||
assert(elem2 === "2") | ||
assert(myStack.size === 2) | ||
|
||
val elem2: String = myStack.pop() | ||
assert(elem2 === "2") | ||
assert(myStack.size === 2) | ||
val elem1: String = myStack.pop() | ||
assert(elem1 === "2") | ||
assert(myStack.size === 1) | ||
|
||
val elem1: String = myStack.pop() | ||
assert(elem1 === "2") | ||
assert(myStack.size === 1) | ||
|
||
val elem0: String = myStack.pop() | ||
assert(elem0 === "1") | ||
assert(myStack.size === 0) | ||
} | ||
val elem0: String = myStack.pop() | ||
assert(elem0 === "1") | ||
assert(myStack.size === 0) | ||
} | ||
|
||
it("should throw a NoSuchElementException after popping from an empty stack") { | ||
val calPar = new CalendarParser() | ||
val myStack = new calPar.MyStack[String] | ||
intercept[NoSuchElementException] { | ||
myStack.pop() | ||
} | ||
test("it should throw a NoSuchElementException after popping from an empty stack") { | ||
val calPar = new CalendarParser() | ||
val myStack = new calPar.MyStack[String] | ||
intercept[NoSuchElementException] { | ||
myStack.pop() | ||
} | ||
|
||
} | ||
|
||
} |