======== #1 :nocast attribute in argument list ========

expected error occured:TypeError: variable 'x' cannot take number value in 'x:string:nocast'
expected error occured:TypeError: variable 'x' cannot take list value in 'x:string:nocast'
first
second
third

======== #2 implicit-mapping and member-mapping ========

filterNames(['aaaa', 'bbb', 'ccccc'], 4).join(',') .. AAAA,CCCCC

======== #3 block parameter in a different line from that of opening brace ========

0
1
2

======== #4 destructor order ========

this must be first
this must be second

======== #5 variable expansion by asterisk operator ========

a=1 b=[2,3,4]
a=1 b=2 c=3 d=4 e=[]
a=1 b=[2,3,4,5]
a=1 b=2 c=3 d=4 e=[5]
a=1 b=[2,3,4,5,6]
a=1 b=2 c=3 d=4 e=[5,6]
a=1 b=[2,3,4,5,6,7,8,9,10]
a=1 b=2 c=3 d=4 e=[5,6,7,8,9,10]

======== #6 optional attribute ========

foo:1 bar:0 hoge:0
foo:0 bar:1 hoge:0
foo:0 bar:0 hoge:1
foo:1 bar:1 hoge:0
foo:1 bar:0 hoge:1
foo:0 bar:1 hoge:1
foo:1 bar:1 hoge:1

======== #7 expr#eval() ========

hello world

======== #8 ampasand operator creates functions that come along with arguments ========

f(x, y, z) = {|x, y, z| x * y * z }
f(5, 7, 8) .. 280
expected error occurs: TypeError: variable 'x' cannot take string value in 'x:number'

======== #9 giving argument values by asterisk operator ========

1
2
3
4
5
6
7
8
9
10
12345678910
aaaabbbb
aaaabbbb
ccccdddd
eeeeffff
aaaabbbb
ccccdddd
eeeeffff
str.mid * [[0, 1], [0, 2], [0, 5], [6, -1]] .. ['H', 'He', 'Hello', 'World']

======== #10 :reduce attribute ========

f(1 .. 10) .. 55

======== #11 calls methods of instances that have been created in a different module ========

message from object-1
message from object-2
message from object-3
message from object-1
message from object-2
message from object-3
message from object-1
message from object-2
message from object-3

======== #12 blocks that take quoted value ========

nil
expr

======== #13 dictionary argument ========

%{a => `println('hello')}
%{a => `println('hello')}

======== #14 blocks that take function instance ========

3

======== #15 giving functions a dictionary as their arguments ========

f(% { `a => 1, `b => 2, `c => 3, `d => 4 }%) .. a=1 b=2 c=3 d=4 %{}
f(% { `a => 1, `b => 2 }%, % { `c => 3, `d => 4 }%) .. a=1 b=2 c=3 d=4 %{}
f(% { `a => 1, `b => 2 }%, % { `c => 3 }%, d => 4) .. a=1 b=2 c=3 d=4 %{}
expected error occured:ValueError: argument confliction
f(1, 2, 3, 4, % { 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4 }%) .. a=1 b=2 c=3 d=4 %{'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4}
expected error occured:ValueError: argument confliction

======== #16 modifies function symbol ========

funcorg() = {}
funcnew() = {}
funcnew1() = {}

======== #17 test of switch-case ========

[a, b] = [1, 1]
[a, b] = [1, 2]
[a, b] = [1, default]
[a, b] = [2, 1]
[a, b] = [2, 2]
[a, b] = [2, default]
[a, b] = [default, 1]
[a, b] = [default, 2]
[a, b] = [default, default]

======== #18 ========

f(x) .. 15

======== #19 ========

f(a, b, c, d, e:number):cut_extra_args = { a + b + c + d + e }
f(1, 2, 3, 4, 5) .. 15

======== #20 ========

f([1, 2, 3], [4, 5, 6]) .. [[1, 4], [2, 5], [3, 6]]
g([1, 2, 3], [4, 5, 6]) .. [[1, [4, 5, 6]], [2, [4, 5, 6]], [3, [4, 5, 6]]]

======== #21 ========

f(1 .. 10) .. [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
f(1 .. 10) .. ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
f(1 .. 10) .. [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

======== #22 ========

100
expected error occurs: TypeError: variable 'm' cannot take number value in 'm:re.match'
expected error occurs: TypeError: variable 'm' cannot take string value in 'm:re.match'

======== #23 ========

f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .. a=1 b=2 c=3 d=4 e=5 f=6 g=7 h=8 i=9 j=10 %{}
f(1, 2, 3, [4 .. 10]*) .. a=1 b=2 c=3 d=4 e=5 f=6 g=7 h=8 i=9 j=10 %{}
f(1, 2, 3, [4 .. 6]*, 7, 8, 9, 10) .. a=1 b=2 c=3 d=4 e=5 f=6 g=7 h=8 i=9 j=10 %{}
f(1, 2, 3, [4 .. 6]*, 7, [8 .. 10]*) .. a=1 b=2 c=3 d=4 e=5 f=6 g=7 h=8 i=9 j=10 %{}
f([1 .. 3]*, [4 .. 6]*, 7, [8 .. 10]*) .. a=1 b=2 c=3 d=4 e=5 f=6 g=7 h=8 i=9 j=10 %{}

======== #24 ========

f .. string#left(len?:number):map
f(3) .. hel
f(5) .. hello
f(9) .. hello wor
['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh']::left * 2 .. ['fi', 'se', 'th', 'fo', 'fi', 'si', 'se']
[['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh']:*left * 2] .. ['fi', 'se', 'th', 'fo', 'fi', 'si', 'se']

======== #25 ========

f(a, b, c, d, rest*, dict%) = { format('a=%d b=%d c=%d d=%d rest=%s dict=%s', a, b, c, d, rest, dict):nomap }
f(1, 2, 3, 4, 5, 6) .. a=1 b=2 c=3 d=4 rest=[5, 6] dict=%{}
f(1, 2, 3, 4, 5, 6, e => 2, f => 3) .. a=1 b=2 c=3 d=4 rest=[5, 6] dict=%{e => 2, f => 3}

======== #26 ========

f(a, b, c, d, dict%) = format('a=%d b=%d c=%d d=%d dict=%s', a, b, c, d, dict)
f(1, 2, 3, 4) .. a=1 b=2 c=3 d=4 dict=%{}
f(1, 2, d => 4, c => 4) .. a=1 b=2 c=4 d=4 dict=%{}
f(a => 1, b => 2, c => 3, d => 4) .. a=1 b=2 c=3 d=4 dict=%{}
f(c => 3, a => 1, b => 2, d => 4) .. a=1 b=2 c=3 d=4 dict=%{}
f(b => 2, c => 3, d => 4, a => 1, e => 1) .. a=1 b=2 c=3 d=4 dict=%{e => 1}
f(d => 4, 1, 2, 3) .. a=1 b=2 c=3 d=4 dict=%{}
f(d => 4, 1, 2, 3, e => 5, f => 6, g => 7) .. a=1 b=2 c=3 d=4 dict=%{e => 5, f => 6, g => 7}

======== #27 ========

a=2, b=nil:0, c=nil:0
a=2, b=3:1, c=nil:0
a=2, b=3:1, c=def:1
a=2, b=10, c=abc
a=2, b=3, c=abc
a=2, b=3, c=def
a=2, b=3, c=[4, 5, 6, 7]
a=2, b=3, c=[]
a=2, b=3, c=[4, 5, 6, 7]
expected error occurs: TypeError: not enough arguments

======== #28 ========

test of closure
 3 4 5 6 7 8
 5  3  2  4
 6  4  3  5
 7  5  4  6
 8  6  5  7
 9  7  6  8
10  8  7  9
11  9  8 10
12 10  9 11
13 11 10 12
14 12 11 13

======== #29 ========

  0  1  2  3  4  5  6  7  8  9 10

======== #30 ========

-0.139708

======== #31 ========

f(x) = x
g(x):void = x
f(2) .. 2
g(2) .. nil

======== #32 ========

f($x, $y) = { $x < $y }
f(1, 3) .. true
f(4, 3) .. false

======== #33 ========

f($a, $b, $c, $d, $e, $f, $g, $h, $i, $j) = { $a + $b + $c + $d + $e + $f + $g + $h + $i + $j }
f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .. 55

======== #34 ========

math.acos(num):map:[deg] .. [1.5708, 1.45946, 1.3467, 1.23096, 1.11024, 0.981765, 0.841069, 0.679674, 0.475882, 0]
math.asin(num):map:[deg] .. [0, 0.111341, 0.224093, 0.339837, 0.460554, 0.589031, 0.729728, 0.891123, 1.09491, 1.5708]
math.atan(num):map:[deg] .. [0, 0.110657, 0.218669, 0.321751, 0.418224, 0.507099, 0.588003, 0.661043, 0.726642, 0.785398]
math.ceil(num):map .. [-2, -1, -1, 0, 0, 0, 1, 1, 2, 2, 2]
math.cos(num):map:[deg] .. [-0.416147, -0.0291995, 0.362358, 0.696707, 0.921061, 1, 0.921061, 0.696707, 0.362358, -0.0291995, -0.416147]
math.cosh(num):map .. [3.7622, 2.57746, 1.81066, 1.33743, 1.08107, 1, 1.08107, 1.33743, 1.81066, 2.57746, 3.7622]
math.exp(num):map .. [0.135335, 0.201897, 0.301194, 0.449329, 0.67032, 1, 1.49182, 2.22554, 3.32012, 4.95303, 7.38906]
math.abs(num):map .. [2, 1.6, 1.2, 0.8, 0.4, 0, 0.4, 0.8, 1.2, 1.6, 2]
math.floor(num):map .. [-2, -2, -2, -1, -1, 0, 0, 0, 1, 1, 2]
math.sin(num):map:[deg] .. [-0.909297, -0.999574, -0.932039, -0.717356, -0.389418, 0, 0.389418, 0.717356, 0.932039, 0.999574, 0.909297]
math.sinh(num):map .. [-3.62686, -2.37557, -1.50946, -0.888106, -0.410752, 0, 0.410752, 0.888106, 1.50946, 2.37557, 3.62686]
math.sqrt(num):map .. [1.41421j, 1.26491j, 1.09545j, 0.894427j, 0.632456j, 0, 0.632456, 0.894427, 1.09545, 1.26491, 1.41421]
math.tan(num):map:[deg] .. [2.18504, 34.2325, -2.57215, -1.02964, -0.422793, 0, 0.422793, 1.02964, 2.57215, -34.2325, -2.18504]
math.tanh(num):map .. [-0.964028, -0.921669, -0.833655, -0.664037, -0.379949, 0, 0.379949, 0.664037, 0.833655, 0.921669, 0.964028]
math.log(num):map .. [0, 0.693147, 1.09861, 1.38629, 1.60944, 1.79176, 1.94591, 2.07944, 2.19722, 2.30259]
math.log10(num):map .. [0, 0.30103, 0.477121, 0.60206, 0.69897, 0.778151, 0.845098, 0.90309, 0.954243, 1]

======== #35 ========

5 .. should be 5

======== #36 ========

a,b,c,d

======== #37 properties of argument instance ========

f(a:number, b, c, d[]:number):map
[1, 2, 3, [4, 5, 6]]

======== #38 ========

x is an even number, quit trailer
trailer
x is an even number, quit trailer
trailer

======== #39 nomap() test ========

1
2
3
[1, 2, 3]

======== #40 attribute after membered type ========

f(x:m.A:nil)

======== #41 :nonamed attribute ========

a => 3
a => 3
b => 2
c => 1

======== #42 :cut_extra_args attribute ========

f() a=1, b=2, c=3
g() a=1, b=2, c=3
expected error occurs: TypeError: too many arguments
g() a=1, b=2, c=3

======== #43 if items are lists, they would not be mapped implicitly ========

expected error occurs: TypeError: variable 'x' cannot take list value in 'x[]:number'

======== #44 type-cast while implicit map ========

<color:#ff0000,a:ff>
<color:#0000ff,a:ff>
<color:#008000,a:ff>

======== #45 default value and named argument ========

a = A, b = B
a = AA, b = B
a = AA, b = BB
a = AA, b = B
a = A, b = BB
a = AA, b = BB

======== #46 declaration of constructor ========

<class:A(a:number, b:string, c[]:boolean, d => 'hoge', dict%):map:[att1,att2,att3] {block?}>

======== #47 type check for list elements (casting) ========

ABCDEFG .. OK
A1CD4FG .. OK
1234567 .. OK

======== #48 type check for list elements (inherited values) ========

<A><A><A><A><A><A><A> .. OK
<A><B><A><A><A><A><A> .. OK
<B><B><B><B><B><B><B> .. OK

======== #49 check of element size ========

f([1]) .. TypeError: unmatched element size
f([1, 2]) .. TypeError: unmatched element size
f([1, 2, 3]) .. TypeError: unmatched element size
f([1, 2, 3, 4]) .. TypeError: unmatched element size
f([1, 2, 3, 4, 5]) .. OK
f([1, 2, 3, 4, 5, 6]) .. TypeError: unmatched element size
f([1, 2, 3, 4, 5, 6, 7]) .. TypeError: unmatched element size

======== #50 lack of closure attribute ========

f() .. ValueError: function f must have :closure attribute to return a function object

======== #51 unknown argument keys ========

f(1, 2, 3, d => 3) .. ArgumentError: unhandled argument key exists: d
f(1, 2, 3, d => 3, e => 2, f => 3) .. ArgumentError: unhandled argument key exists: d, e, f
