Spock Web Console

subscribe to the feed Subscribe
sum and multiplication (via #spockwebconsole)
tweet this script Tweet

sum and multiplication

Published 2 months ago by alican
Actions  ➤ Edit In Console Back To Console Show/Hide Line Numbers View Recent Scripts
class Maths extends Specification {
    def "Sum of two numbers"(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" (int a,int b,int c) {
        expect:
            multiplication (a,b)==c
        where:
        
            a | b | c
            1 | 3 | 3
            7 | 4 | 28
            0 | 0 | 0
            
    }

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


}