Permalink
Newer
Older
100644 66 lines (58 sloc) 1.09 KB
1
#!/usr/bin/perl -w
2
use strict;
3
use SDL;
4
use Test::More;
@jtpalmer
Jul 31, 2010
7
new_file
8
seek
9
close
10
/;
11
can_ok( 'SDL::RWOps', @done );
12
13
open FH, '>', '.rwops';
14
print FH 'rwops';
15
close FH;
16
17
my $file = SDL::RWOps->new_file( '.rwops', 'rw' );
18
isa_ok( $file, 'SDL::RWOps', '[from_file] returns RWOps' );
20
#0 SEEK_SET
21
#1 SEEK_CUR
22
#2 SEEK_END
23
my $len = $file->seek( 0, 0 );
24
is( $len, 0, '[seek] gets seek_end' );
25
$len = $file->seek( 0, 1 );
26
is( $len, 0, '[seek] gets seek_start' );
27
$len = $file->seek( 0, 2 );
28
is( $len, 5, '[seek] gets seek_cur' );
@kthakore
Nov 20, 2009
29
SKIP:
@jtpalmer
Jul 31, 2010
31
skip( 'crashing', 1 );
32
my $char;
33
my $blocks = $file->read( $char, 16, 1 );
34
is( $blocks, 5, '[read] got ' . $char );
35
}
36
$file->close();
37
unlink '.rwops';
@jtpalmer
Jul 31, 2010
39
from_fp
40
from_mem
41
from_const_mem
42
alloc
43
free
44
tell
45
read
46
write
47
/;
@jtpalmer
Jul 31, 2010
50
'[Percentage Completion] '
51
. int( 100 * ( $#done + 1 ) / ( $#done + $#left + 2 ) )
52
. "\% implementation. "
53
. ( $#done + 1 ) . " / "
54
. ( $#done + $#left + 2 );
@jtpalmer
Jul 31, 2010
58
local $TODO = $why;
59
fail "Not Implmented $_" foreach (@left)
62
print "$why\n";
@m4gnet
Dec 2, 2009
65
sleep(2);