PageRenderTime 28ms CodeModel.GetById 12ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/t/basic/01intarray.t

http://github.com/NotFound/winxed
Unknown | 37 lines | 28 code | 9 blank | 0 comment | 0 complexity | e06b08aafebdf12c283594e98159d8c2 MD5 | raw file
 1#! winxed
 2
 3//  Basic tests for int array
 4
 5using extern Test.More plan, is, ok;
 6
 7function main()
 8{
 9    plan(14);
10
11    int noinit [];
12    ok(noinit instanceof "ResizableIntegerArray", "type of non initialized");
13    is(elements(noinit), 0, "size of non initialized");
14
15    int a []= [ 7, 42 ];
16    ok(a instanceof "ResizableIntegerArray", "type of initialized");
17    is(elements(a), 2, "size of initialized");
18    is(a[0], 7, "first value");
19    is(a[1], 42, "second value");
20
21    int b [2];
22    ok(b instanceof "FixedIntegerArray", "type of non initialized with size");
23    is(elements(b), 2, "size of non initialized with size");
24
25    int c [2] = [ 7, 42 ];
26    ok(c instanceof "FixedIntegerArray", "type of initialized with size");
27    is(elements(c), 2, "size of initialized with size");
28    is(c[0], 7, "first value");
29    is(c[1], 42, "second value");
30
31    int size= 4;
32    int d[size];
33    ok(c instanceof "FixedIntegerArray", "type of non initialized with size non constant");
34    is(elements(d), size, "size of non initialized with size non constant");
35}
36
37// End