Created
January 9, 2020 23:14
-
-
Save sanjivsahayamrea/309b846e1b1ba6d2666ca694b500ffeb to your computer and use it in GitHub Desktop.
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
import org.specs2.mutable.Specification | |
import org.specs2.specification.core.Fragments | |
final class TabulatedSpec extends Specification { | |
def mult(value1: Int, value2: Int): Int = value1 * value2 | |
"Tabulated functions" should { | |
val table = Map( | |
(1, 1) -> 1, | |
(2, 2) -> 4, | |
(3, 3) -> 9, | |
(4, 4) -> 16 | |
) | |
Fragments.foreach(table.toSeq) { | |
case ((first, second), expected) => | |
s"mult ($first, $second)" ! { mult(first, second) must beEqualTo(expected) } ^ br | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment