Created
June 29, 2018 22:04
-
-
Save koljamaier/c43d4b19034940c1e9784bf83c65155d to your computer and use it in GitHub Desktop.
This is a simple Test suite for scala unit testing
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
package nqueens | |
import org.junit.runner.RunWith | |
import org.scalatest.FunSuite | |
import org.scalatest.junit.JUnitRunner | |
@RunWith(classOf[JUnitRunner]) | |
class NqueensTest extends FunSuite { | |
// test("string take") { | |
// val message = "hello, world" | |
// assert(message.take(5) == "hello") | |
// } | |
trait TestSet { | |
val queens = List(0,3,1) | |
} | |
test("adding ints") { | |
assert(1 + 2 === 3) // z.B: so assert(1 + 4 === 3) | |
} | |
test("testIsValid") { | |
assert(Nqueens.isValid(col = 2,n = 4, partialSolution = List(2,2,2)) == false) | |
} | |
test("testIsSafe") { | |
new TestSet { | |
assert(Nqueens.isSafe(col = 2, queens)) | |
assert(Nqueens.isSafe(col = 2, queens) === true) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment