1# Before `make install' is performed this script should be runnable with 2# `make test'. After `make install' it should work as `perl test.pl' 3 4######################### We start with some black magic to print on failure. 5 6# Change 1..1 below to 1..last_test_to_print . 7# (It may become useful if the test is moved to ./t subdirectory.) 8 9BEGIN { $| = 1; print "1..12\n"; } 10END {print "not ok 1\n" unless $loaded;} 11use Ogg::Vorbis; 12$loaded = 1; 13print "ok 1\n"; 14 15######################### End of black magic. 16 17# Test general information functions 18$current_section = -1; 19$buffer = 'x' x 4096; 20#eval { $endian = Ogg::Vorbis::host_is_big_endian() }; 21#if ($@) { die "not ok 2\n";} else { print "ok 2\n"; } 22print "ok 2\n"; 23 24# Test object creation 25eval { $ogg = Ogg::Vorbis->new }; 26if ($@) { die "not ok 3\n";} else { print "ok 3\n"; } 27 28# Test stream opening 29open(INPUT, "test.ogg") || die "Couldn't open input file\n"; 30if ($ogg->open(INPUT) <0) { 31 die "not ok 4\n"; 32} else { 33 print "ok 4\n" 34} 35 36# Test stream specific info 37eval { $ogg->streams() }; 38if ($@) { die "not ok 5\n";} else { print "ok 5\n"; } 39 40eval { $ogg->time_total() }; 41if ($@) { die "not ok 6\n";} else { print "ok 6\n"; } 42 43# Test Ogg::Vorbis::Info 44eval { $info = $ogg->info() }; 45if ($@) { die "not ok 7\n";} else { print "ok 7\n"; } 46 47eval { $info->channels() }; 48if ($@) { die "not ok 8\n";} else { print "ok 8\n"; } 49 50# Test the comments 51eval { %comments = %{$ogg->comment()} }; 52if ($@) { die "not ok 9\n";} else { print "ok 9\n"; } 53eval { keys %comments }; 54if ($@) { die "not ok 10\n";} else { print "ok 10\n"; } 55 56# Test read 57eval { $ogg->read($buffer, 4096, $endian, 2, 1, $current_section) }; 58if ($@) { die "not ok 11\n";} else { print "ok 11\n"; } 59 60# Test clear 61eval { $ogg->clear() }; 62if ($@) { die "not ok 12\n";} else { print "ok 12\n"; } 63 64close(INPUT); 65