Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 65 lines (57 sloc) 1.095 kB
ba85b2c @kthakore Added todo tests for remaining components of SDL. Removed WM build in…
kthakore authored
1 #!/usr/bin/perl -w
2 use strict;
3 use SDL;
4 use Test::More;
0f35edd @kthakore Cleanup. Added RWops xs,pm, and pod. Added tests to 00-load
kthakore authored
5 use SDL::RWOps;
26de90e @kthakore Added tests for RWOps. can figure some stuff out
kthakore authored
6 my @done = qw/
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');
ba85b2c @kthakore Added todo tests for remaining components of SDL. Removed WM build in…
kthakore authored
19
26de90e @kthakore Added tests for RWOps. can figure some stuff out
kthakore authored
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');
14767ad @kthakore Skip crashing test
kthakore authored
29 SKIP:
26de90e @kthakore Added tests for RWOps. can figure some stuff out
kthakore authored
30 {
14767ad @kthakore Skip crashing test
kthakore authored
31 skip 1, 'Crashing';
26de90e @kthakore Added tests for RWOps. can figure some stuff out
kthakore authored
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';
ba85b2c @kthakore Added todo tests for remaining components of SDL. Removed WM build in…
kthakore authored
38 my @left = qw/
26de90e @kthakore Added tests for RWOps. can figure some stuff out
kthakore authored
39 from_fp
40 from_mem
41 from_const_mem
42 alloc
43 free
44 tell
45 read
46 write
ba85b2c @kthakore Added todo tests for remaining components of SDL. Removed WM build in…
kthakore authored
47 /;
48
49 my $why
50 = '[Percentage Completion] '
51 . int( 100 * ( $#done + 1 ) / ( $#done + $#left + 2 ) )
52 . "\% implementation. "
53 . ( $#done + 1 ) . " / "
54 . ( $#done + $#left + 2 );
55
56 TODO:
57 {
58 local $TODO = $why;
59 fail "Not Implmented $_" foreach(@left)
60
61 }
62 diag $why;
63
64 done_testing;
Something went wrong with that request. Please try again.