blob: 6cacdac39cc36cbd5048f1f1e190aea3c803143e (
plain)
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
|
#-*- perl -*-
#
# Copyright (C) 2001,2002 Ken'ichi Fukamachi
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
# $FML: array_map.pl,v 1.6 2002/04/01 23:41:14 fukachan Exp $
#
use Carp;
use strict;
use FML::Test::Utils;
my $tool = new FML::Test::Utils;
$tool->set_title("array read");
my $map = ['a', 'b', 'c'];
use IO::Adapter;
my $obj = new IO::Adapter $map;
$obj->open || $tool->error("cannot open $map");
if ($obj->error) { $tool->error( $obj->error );}
my $x;
my @recipients = ();
while ($x = $obj->get_next_key) { push(@recipients, $x); }
$obj->close;
my $ok = 0;
my $i = 0;
for my $c (@$map) {
$c eq $recipients[ $i ] && $ok++;
$i++;
}
if ($ok == $i) {
$tool->print_ok();
}
else {
$tool->error();
}
exit 0;
|