Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding tests for ::Generator->_files, ...->total_size, and ..->_count…

…_files
  • Loading branch information...
commit cd4f5566b804817d4a5671766afaac9df8866d12 1 parent 3aca9ed
@sanko authored
Showing with 24 additions and 1 deletion.
  1. +24 −1 t/10000_by_class/Net/BitTorrent/Torrent/Generator.t
View
25 t/10000_by_class/Net/BitTorrent/Torrent/Generator.t
@@ -33,7 +33,7 @@ package t::10000_by_class::Net::BitTorrent::Torrent::Generator;
explain 'Metadata now looks like...', $s->{'torrent'};
}
- sub _001_comment : Test( 4 ) {
+ sub api_comment : Test( 4 ) {
my $s = shift;
is $s->{'torrent'}->comment, undef, 'default comment is undef';
ok !$s->{'torrent'}->_has_comment, '_has_comment is false';
@@ -42,6 +42,29 @@ package t::10000_by_class::Net::BitTorrent::Torrent::Generator;
is $s->{'torrent'}->comment, 'See credit.txt for attributions.',
'comment is correct';
}
+ {
+
+ sub _files {
+ ['./t/90000_data/96000_data/96020_miniswarm_seed/1291672777_30adc6a421_o.jpg',
+ './t/90000_data/96000_data/96020_miniswarm_seed/2183742557_5c9a91727d_m.jpg',
+ './t/90000_data/96000_data/96020_miniswarm_seed/credit.txt'
+ ];
+ }
+
+ sub api___files : Test( 3 ) {
+ my $s = shift;
+ is_deeply $s->{'torrent'}->files, $s->_files,
+ 'list of files is correct';
+ is $s->{'torrent'}->_count_files, scalar(@{$s->_files}),
+ '_count_files is correct';
+ {
+ my $expected;
+ for my $file (@{$s->_files}) { $expected += -s $file }
+ is $s->{'torrent'}->total_size, $expected,
+ 'total_size is correct'
+ }
+ }
+ }
#
#$ENV{'TEST_VERBOSE'}++;
Please sign in to comment.
Something went wrong with that request. Please try again.