fix codetest failure - ASSERT_ARGS does not have a ; after and
[parrot.git] / t / library / archive_zip.t
blobd2816a93309b57b064543c0163c7e9906da62817
1 #!./parrot
2 # Copyright (C) 2010, Parrot Foundation.
3 # $Id$
5 =head1 NAME
7 t/library/archive_zip.t
9 =head1 DESCRIPTION
11 Test the Archive/Zip library
13 =head1 SYNOPSIS
15     % prove t/library/archive_zip.t
17 =cut
19 .sub 'main' :main
20     .include 'test_more.pir'
22     load_bytecode 'Archive/Zip.pir'
24     plan(14)
25     test_new()
26     test_pack()
27 .end
29 .sub 'test_new'
30     $P0 = new ['Archive';'Zip']
31     $I0 = isa $P0, ['Archive';'Zip']
32     ok($I0, "new ['Archive';'Zip']")
33     $I0 = isa $P0, ['Archive';'Zip';'Base']
34     ok($I0, "is a ['Archive';'Zip';'Base']")
35     $P0 = new ['Archive';'Zip';'Member']
36     $I0 = isa $P0, ['Archive';'Zip';'Member']
37     ok($I0, "new ['Archive';'Zip';'Member']")
38     $I0 = isa $P0, ['Archive';'Zip';'Base']
39     ok($I0, "is a ['Archive';'Zip';'Base']")
40     $P0 = new ['Archive';'Zip';'FileMember']
41     $I0 = isa $P0, ['Archive';'Zip';'FileMember']
42     ok($I0, "new ['Archive';'Zip';'FileMember']")
43     $I0 = isa $P0, ['Archive';'Zip';'Member']
44     ok($I0, "is a ['Archive';'Zip';'Member']")
45     $P0 = new ['Archive';'Zip';'NewFileMember']
46     $I0 = isa $P0, ['Archive';'Zip';'NewFileMember']
47     ok($I0, "new ['Archive';'Zip';'NewFileMember']")
48     $I0 = isa $P0, ['Archive';'Zip';'FileMember']
49     ok($I0, "is a ['Archive';'Zip';'FileMember']")
50 .end
52 .sub 'test_pack'
53     $P0 = new ['Archive';'Zip']
54     $S0 = $P0.'pack_C'(0x12)
55     is( $S0, "\x12", "pack C (unsigned char)" )
56     $I0 = length $S0
57     is( $I0, 1 )
58     $S0 = $P0.'pack_v'(0x1234)
59     is( $S0, "\x34\x12", "pack v (16bits litle endian)" )
60     $I0 = length $S0
61     is( $I0, 2 )
62     $S0 = $P0.'pack_V'(0x12345678)
63     is( $S0, "\x78\x56\x34\x12", "pack V (32bits litle endian)" )
64     $I0 = length $S0
65     is( $I0, 4 )
66 .end
68 # Local Variables:
69 #   mode: pir
70 #   fill-column: 100
71 # End:
72 # vim: expandtab shiftwidth=4 ft=pir: