add boost cflags and libs
[gnash.git] / extensions / fileio / test.as
blobe4db955bc555dccd2518443a8ad852392f36832b
1 //
2 // Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
3 // Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "dejagnu.as"
22 file = new FileIO();
24 // test stdio first
26 buf = "Hello World!\n";
28 if (file.fopen("/tmp/x", "w+")) {
29 pass("FileIO::open()");
30 } else {
31 fail("FileIO::open()");
34 if (file.fputs(buf)) {
35 pass("FileIO::fputs()");
36 } else {
37 fail("FileIO::fputs()");
40 file.fwrite(buf, 12);
42 xxx = file.ftell();
43 if (file.fseek(0) == 0) {
44 pass("FileIO::fseek()");
45 } else {
46 fail("FileIO::fseek()");
49 if (file.fflush() == 0) {
50 pass("FileIO::fflush()");
51 } else {
52 fail("FileIO::fflush()");
55 if ((xxx > 0) && (file.ftell() == 0)) {
56 pass("FileIO::ftell()");
57 } else {
58 fail("FileIO::ftell()");
61 x = file.fgetc();
62 if (x == "H") {
63 pass("FileIO::fgetc()");
64 } else {
65 fail("FileIO::fgetc()");
67 //trace(x);
69 y = file.fgets();
70 if (y == "ello World!\n") {
71 pass("FileIO::fgets()");
72 } else {
73 fail("FileIO::fgets()");
76 file.close();
77 //trace(y);
79 //file.read(buf, count);
81 // These tests use standard I/O
82 if (file.putchar('X')) {
83 pass("FileIO::putchar()");
84 } else {
85 fail("FileIO::putchar()");
88 if (file.puts(buf)) {
89 pass("FileIO::puts()");
90 } else {
91 fail("FileIO::puts()");
95 // We can't test thigns automatically if we need user input, so thes
96 // are commented out.
98 // a = file.getchar();
99 // if (a) {
100 // pass("FileIO::getchar()");
101 // } else {
102 // fail("FileIO::getchar()");
103 // }
104 // trace(a);
106 // b = file.gets();
107 // if (b) {
108 // pass("FileIO::gets()");
109 // } else {
110 // fail("FileIO::gets()");
111 // }
112 //trace(b);
115 totals();