PR target/27599
[official-gcc.git] / libjava / classpath / test / java.io / PrintWriterTest.java
blobd466f447ad0c7b076ffd838e2da27704065d9cf3
1 /*************************************************************************
2 /* PrintWriterTest.java -- Test of the PrintWriter 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 PrintWriterTest
27 public static void main(String[] argv) throws IOException
29 System.out.println("Started test of PrintWriter");
30 System.out.println("Test 1: Printing Test");
32 char[] carray = { 'h', 'i' };
33 char[] carray2 = { 'b', 'y', 'e' };
35 PrintWriter pw = new PrintWriter(new FileWriter("printwriter.out"));
36 pw.print(true);
37 pw.print('|');
38 pw.print(false);
39 pw.print('|');
40 pw.print('A');
41 pw.print('|');
42 pw.flush();
43 pw.print(0xFFFFF);
44 pw.print('|');
45 pw.print(0xFFFFFFFFFFL);
46 pw.print('|');
47 pw.print(3.141592);
48 pw.print('|');
49 pw.print((double)99999999999.9999);
50 pw.print('|');
51 pw.print(carray);
52 pw.print('|');
53 pw.print("This is a string");
54 pw.print('|');
55 pw.print(pw);
56 pw.println();
57 pw.println(true);
58 pw.println(false);
59 pw.println('A');
60 pw.flush();
61 pw.println(0xFFFFF);
62 pw.println(0xFFFFFFFFFFL);
63 pw.println(3.141592);
64 pw.println((double)99999999999.9999);
65 pw.println(carray);
66 pw.println("This is a string");
67 pw.println(pw);
68 pw.write('B');
69 pw.println();
70 pw.write(carray2, 0, carray2.length);
71 pw.println();
72 pw.close();
74 if (pw.checkError())
75 System.out.println("FAILED: Printing Test");
76 else
77 System.out.println("PASSED: Printing Test");
79 System.out.println("PASSED: Test of PrintWriter");
82 } // class PrintWriterTest