root/NetAddr-IP-Find/trunk/t/00_find.t

Revision 270 (checked in by miyagawa, 19 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 use strict;
2 use Test;
3 BEGIN { plan tests => 3 }
4
5 use NetAddr::IP::Find;
6
7 my $text = join '', <DATA>;
8 my $origtext = $text;
9
10 my @how_many;
11 my $how_many = find_ipaddrs($text, sub {
12                                 my($ipaddr, $orig) = @_;
13                                 push @how_many, $ipaddr;
14                                 return $orig;
15                             });
16
17 ok(@how_many == $how_many);
18 ok((grep { $_->isa('NetAddr::IP') } @how_many) == $how_many);
19 ok($text, $origtext);
20
21 __DATA__
22 133.145.228.11 - - [09/Jul/2001:00:00:05 +0900] "GET /rss/rdf.cgi?Linux24 HTTP/1.0" 200 2671 "-" "libwww-perl/5.53"
23 211.128.52.139 - - [09/Jul/2001:00:00:15 +0900] "GET /go.cgi?id=83369 HTTP/1.1" 302 311 "http://bulknews.net/" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
24 202.247.6.8 - - [09/Jul/2001:00:00:45 +0900] "GET /rss/rdf.cgi?Launch HTTP/1.0" 200 2725 "-" "Java1.3.0_02"
25 210.170.147.68 - - [09/Jul/2001:00:06:50 +0900] "GET /lib/doc-ja/exegesis2.ja.html HTTP/1.1" 200 34581 "http://silver.fureai.or.jp/diary/diary.200105.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2+) Gecko/20010630"
26 194.109.233.175 - - [09/Jul/2001:00:07:52 +0900] "GET /lib/archives/CGI-Upload-0.01.readme HTTP/1.1" 404 310 "http://www.google.com/search?q=cgi+upload+example&hl=en&safe=off&start=10&sa=N" "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"
27 202.247.6.8 - - [09/Jul/2001:00:12:42 +0900] "GET /rss/rdf.cgi?KtaiWatch HTTP/1.0" 200 2729 "-" "Java1.3.0_02"
Note: See TracBrowser for help on using the browser.