#!/usr/bin/ruby

var n = 0
++n if (1+1)==2
++n if (1+1)==3

assert_eq(n, 1)

var x = (1+5)/3
assert_eq(x, 2)

class Example {
    method +(a, b, c = (3)+(4), d=9) {
        assert_eq(a, 1)
        assert_eq(b, 2)
        assert_eq(c, 7)
        assert_eq(d, 9)
    }
}

var obj = Example()
obj + (1, 2)
obj + (b:(1)+(1), c: 7, d: 1+(8),a:1)

var a = [1,2,3,4]
var b = a»!()»»!!()»                     # double factorial of factorials
assert_eq(b, [1, 2, 48, 1961990553600])

b = (a»!()» »log» 2 »sqrt()»)            # this may change in the future
#b = a».!».log(2)».sqrt                  # possible candidate (unimplemented)
assert_eq(b, [1!.log2.sqrt, 2!.log2.sqrt, 3!.log2.sqrt, 4!.log2.sqrt])
