Spock Web Console

subscribe to the feed Subscribe
Some Operations (via #spockwebconsole)
tweet this script Tweet

Some Operations

Published 5 months ago by alican with tags sum and multiplication and area
Actions  ➤ Edit In Console Back To Console Show/Hide Line Numbers View Recent Scripts
@Unroll
class Operations extends spock.lang.Specification {
    def "Sum of two numbers #a+#b=#c"(int a, int b, int c) {
        expect:
            sum (a,b )== c
        where:
            a | b | c
            1 | 3 | 4
            7 | 4 | 11
            0 | 0 | 0
    }

    def " multiplication of two number #a*#b=#c" (int a,int b,int c) {
        expect:
            multiplication (a,b)==c
        where:
        
            a | b | c
            2 | 8 | 16
            7 | 4 | 28
            0 | 3 | 0
            
    }
    
    def "area of circle Area  #b" (int a,double b){
        expect :
            calculateArea (a)==b
        where : 
            
            a|b
            2|12.56
            7|153.86
    }

    def sum (int a,int b)
    {
        return a+b
    }
    
    def multiplication  (int a,int b)
    {
        return a*b
    }
    def calculateArea (int a)
    {
        return a*a*3.14
    }


}