PR target/27599
[official-gcc.git] / libjava / classpath / test / java.io / PrintStreamTest.java
blobbd4dde54de9b51e6ba6de2d2ac1bffdf2ae88505
1 /*************************************************************************
2 /* PrintStreamTest.java -- Test of the PrintStream class
3 /*
4 /* Copyright (c) 1998 Free Software Foundation, Inc.
5 /* Written by Aaron M. Renn (arenn@urbanophile.com)
6 /*
7 /* This program is free software; you can redistribute it and/or modify
8 /* it under the terms of the GNU General Public License as published
9 /* by the Free Software Foundation, either version 2 of the License, or
10 /* (at your option) any later version.
12 /* This program is distributed in the hope that it will be useful, but
13 /* WITHOUT ANY WARRANTY; without even the implied warranty of
14 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 /* GNU General Public License for more details.
17 /* You should have received a copy of the GNU General Public License
18 /* along with this program; if not, write to the Free Software Foundation
19 /* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 /*************************************************************************/
22 import java.io.*;
24 public class PrintStreamTest
27 public static void main(String[] argv) throws IOException
29 System.out.println("Started test of PrintStream");
30 System.out.println("Test 1: Printing Test");
32 char[] carray = { 'h', 'i' };
33 byte[] barray = { 'b', 'y', 'e' };
35 PrintStream ps = new PrintStream(new FileOutputStream("printstream.out"));
36 ps.print(true);
37 ps.print('|');
38 ps.print(false);
39 ps.print('|');
40 ps.print('A');
41 ps.print('|');
42 ps.flush();
43 ps.print(0xFFFFF);
44 ps.print('|');
45 ps.print(0xFFFFFFFFFFL);
46 ps.print('|');
47 ps.print(3.141592);
48 ps.print('|');
49 ps.print((double)99999999999.9999);
50 ps.print('|');
51 ps.print(carray);
52 ps.print('|');
53 ps.print("This is a string");
54 ps.print('|');
55 ps.print(ps);
56 ps.println();
57 ps.println(true);
58 ps.println(false);
59 ps.println('A');
60 ps.flush();
61 ps.println(0xFFFFF);
62 ps.println(0xFFFFFFFFFFL);
63 ps.println(3.141592);
64 ps.println((double)99999999999.9999);
65 ps.println(carray);
66 ps.println("This is a string");
67 ps.println(ps);
68 ps.write('B');
69 ps.println();
70 ps.write(barray, 0, barray.length);
71 ps.println();
72 ps.close();
74 if (ps.checkError())
75 System.out.println("FAILED: Printing Test");
76 else
77 System.out.println("PASSED: Printing Test");
79 System.out.println("PASSED: Test of PrintStream");
82 } // class PrintStreamTest