Skip to content

Commit

Permalink
flesh out the nummatrix2d subclass tests. This appears to cover all V…
Browse files Browse the repository at this point in the history
…TABLEs that use mapped types
  • Loading branch information
Whiteknight committed Sep 8, 2010
1 parent 297a02f commit 2c8ae58
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion t/pir-subclass/nummatrix2d.t
Expand Up @@ -9,11 +9,17 @@
$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..1"
say "1..5"
test_get_pmc_keyed()
test_get_pmc_keyed_int()
test_get_attr_str()
.end

.sub is_TestFloat
Expand All @@ -29,11 +35,44 @@
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 ['NumMatrix2D']
$P0.'initialize_from_args'(2, 2, 1, 2, 3, 4)
$P1 = $P0[0;0]
is_TestFloat($P1)
.end

.sub test_get_pmc_keyed_int
$P0 = new ['NumMatrix2D']
$P0.'initialize_from_args'(2, 2, 1, 2, 3, 4)
$P1 = $P0[0]
is_TestFloat($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

0 comments on commit 2c8ae58

Please sign in to comment.