henrik
03/28/2019, 5:26 AMrobstoll
03/28/2019, 8:12 AMsam
03/28/2019, 11:34 AMhenrik
04/01/2019, 7:30 AMwhere:
is super nice.sam
04/01/2019, 3:20 PMforall(
row(2, 3, 3),
row(0, 0, 0),
row(4, -1, 4),
row(-2, -1, -1)
) { a, b, max ->
Math.max(a, b) shouldBe max
}
sam
04/01/2019, 3:20 PMsam
04/01/2019, 3:20 PMsam
04/01/2019, 3:21 PMhenrik
04/03/2019, 7:13 AM@Unroll
def "maximum of two numbers, given #a and #b"() {
expect:
Math.max(a, b) == c
where:
a | b | c
1 | 3 | 3
7 | 4 | 4
0 | 0 | 0
}
sam
04/03/2019, 2:24 PMtest("maximum of two numbers, given #a and #b") {
forall(
row(1, 3, 3),
row(7, 4, 4),
row(0, 0, 0)
) { a, b, max ->
Math.max(a, b) shouldBe max
}
}
I don't think it's hugely different, but the spock syntax is definitely nicer as it has less ceremony. Let me see what we can come up with to improve and get closer to spock.henrik
04/04/2019, 4:59 AMhenrik
04/05/2019, 7:47 AMsam
04/05/2019, 7:53 AMhenrik
04/09/2019, 12:07 PMsam
08/18/2019, 3:05 AMexpect(
{ max(it.a, it.c) shouldBe it.c },
where(
row(1, 2, 3),
row(4, 5, 9),
row(7, 0, 7)
)
)
sam
08/18/2019, 3:12 AMexpect(
{ max(it.a, it.c) shouldBe it.c },
row(1, 2, 3),
row(4, 5, 9),
row(7, 0, 7)
)
sam
08/18/2019, 4:15 AMexpect<Int, Int, Int> {
max(it.a, it.c) shouldBe it.c
}.where(
row(1, 2, 3),
row(4, 5, 9),
row(7, 0, 7)
)
henrik
08/19/2019, 9:33 AMsam
08/19/2019, 1:41 PM