/
complexmatrix2d.t
78 lines (61 loc) · 1.45 KB
/
complexmatrix2d.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!parrot
.HLL 'ComplexMatrix2D_SUBCLASS_TEST'
.sub test
$P0 = get_class 'Complex'
$P1 = subclass $P0, 'TestComplex'
$P2 = getinterp
$P2.'hll_map'($P0, $P1)
$P0 = get_class 'Integer'
$P1 = subclass $P0, 'TestInteger'
$P2.'hll_map'($P0, $P1)
$P3 = box 0
set_hll_global ['Test'], '_count', $P3
say "1..5"
test_get_pmc_keyed()
#test_get_pmc_keyed_int()
test_get_attr_str()
.end
.sub is_TestComplex
.param pmc arg
$S0 = typeof arg
if $S0 == 'TestComplex' goto are_equal
print "not "
are_equal:
print "ok "
$P0 = get_hll_global ['Test'], '_count'
inc $P0
say $P0
.end
.sub is_TestInteger
.param pmc arg
$S0 = typeof arg
if $S0 == 'TestInteger' goto are_equal
print "not "
are_equal:
print "ok "
$P0 = get_hll_global ['Test'], '_count'
inc $P0
say $P0
.end
.sub test_get_pmc_keyed
$P0 = new ['ComplexMatrix2D']
$P0.'initialize_from_args'(2, 2, 1, 2, 3, 4)
$P1 = $P0[0;0]
is_TestComplex($P1)
.end
.sub test_get_pmc_keyed_int
$P0 = new ['ComplexMatrix2D']
$P0.'initialize_from_args'(2, 2, 1, 2, 3, 4)
$P1 = $P0[0]
is_TestComplex($P1)
.end
.sub test_get_attr_str
$P0 = new ['NumMatrix2D']
$P0.'initialize_from_args'(2, 2, 1, 2, 3, 4)
$P1 = getattribute $P0, 'rows'
is_TestInteger($P1)
$P1 = getattribute $P0, 'cols'
is_TestInteger($P1)
$P1 = getattribute $P0, 'size'
is_TestInteger($P1)
.end