-
Notifications
You must be signed in to change notification settings - Fork 138
/
imageio.t
79 lines (62 loc) · 1.68 KB
/
imageio.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
78
79
#!./parrot
# Copyright (C) 2010, Parrot Foundation.
# $Id$
=head1 NAME
t/pmc/imageio.t - test ImageIO PMC
=head1 SYNOPSIS
% prove t/pmc/imagio.t
=head1 DESCRIPTION
Tests the ImageIO PMC.
=cut
.sub main :main
.include 'test_more.pir'
plan(11)
.local pmc imageio
imageio = new ['ImageIO']
ok(1, 'instantiated ImageIO')
.local pmc test_pmc
test_pmc = 'get_test_simple'()
setref imageio, test_pmc
$S0 = imageio
ok($S0, 'frozen PMC is true (simple)')
$S1 = freeze test_pmc
is($S0, $S1, 'freeze gives same image as ImageIO (simple)')
imageio = new ['ImageIO']
imageio = $S0
$P0 = deref imageio
ok($P0, 'thawed PMC is true (simple)')
$P1 = thaw $S1
is($P0, $P1, 'thaw gives same PMC as ImageIO (simple)')
is($P0, test_pmc, 'round trip gives same PMC (simple)')
imageio = new ['ImageIO']
test_pmc = 'get_test_aggregate'()
setref imageio, test_pmc
$S0 = imageio
ok($S0, 'frozen PMC is true (aggregate)')
$S1 = freeze test_pmc
is($S0, $S1, 'freeze gives same image as ImageIO (aggregate)')
imageio = new ['ImageIO']
imageio = $S0
$P0 = deref imageio
ok($P0, 'thawed PMC is true (aggregate)')
$P1 = thaw $S1
is_deeply($P0, $P1, 'thaw gives same PMC as ImageIO (aggregate)')
is_deeply($P0, test_pmc, 'round trip gives same PMC (aggregate)')
.end
.sub get_test_simple
$P0 = new ['Integer']
$P0 = -99
.return ($P0)
.end
.sub get_test_aggregate
$P0 = new ['ResizableStringArray']
$P0[0] = 'parrot'
$P0[1] = '???'
$P0[2] = 'profit'
.return ($P0)
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: