Spock Web Console

subscribe to the feed Subscribe
Testing max() function (via #spockwebconsole)
tweet this script Tweet

Testing max() function

Published 9 months ago by mmelnik with tags array parametrized unroll
Actions  ➤ Edit In Console Back To Console Show/Hide Line Numbers View Recent Scripts
import spock.lang.*

class MyFirstSpec extends Specification {

@Unroll("max(#a,#b) = #c")  
def "max function returns correct maximum"() {
    expect:
    Math.max(a, b) == c
    
    where:
    a << [2,0,4]
    b << [1,1,3]
    c << [2,1,4]
  }
}