-
Notifications
You must be signed in to change notification settings - Fork 1
/
oplib.t
70 lines (57 loc) · 1.27 KB
/
oplib.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
#!./parrot
# Copyright (C) 2001-2010, Parrot Foundation.
# $Id$
=head1 NAME
t/pmc/oplib.t - OpLib PMC
=head1 SYNOPSIS
% prove t/pmc/oplib.t
=cut
.sub main :main
.include 'test_more.pir'
plan(5)
new_oplib()
get_end()
get_no_opcode()
family_end()
family_no_opcode()
.end
.sub new_oplib
$P0 = new ['OpLib']
$I0 = isnull $P0
nok($I0, "new OpLib")
.end
.sub get_end
$P0 = new ['OpLib']
# Assumption: we'll always have an end opcode.
$I1 = $P0['end']
$I0 = isne $I1, -1
ok($I0, "got end opcode")
.end
.sub get_no_opcode
$P0 = new ['OpLib']
$I1 = $P0['hopeweneverhaveopcodesnamedlikethis']
$I0 = iseq $I1, -1
ok($I0, "get non existent opcode fails")
.end
.sub family_end
$P0 = new ['OpLib']
# Assumption: we'll always have an end opcode.
$P1 = $P0.'op_family'('end')
$I0 = isnull $P1
dec $I0
unless $I0 goto done
$I0 = elements $P1
done:
is($I0, 1, "'end' family is not null and has 1 element")
.end
.sub family_no_opcode
$P0 = new ['OpLib']
$P1 = $P0.'op_family'('hopeweneverhaveopcodesnamedlikethis')
$I0 = isnull $P1
ok($I0, "non existent opcode family is null")
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: