OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [test/] [java.io/] [PrintWriterTest.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/*************************************************************************
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.
11
/*
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.
16
/*
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
/*************************************************************************/
21
 
22
import java.io.*;
23
 
24
public class PrintWriterTest
25
{
26
 
27
public static void main(String[] argv) throws IOException
28
{
29
  System.out.println("Started test of PrintWriter");
30
  System.out.println("Test 1: Printing Test");
31
 
32
  char[] carray = { 'h', 'i' };
33
  char[] carray2 = { 'b', 'y', 'e' };
34
 
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();
73
 
74
  if (pw.checkError())
75
    System.out.println("FAILED: Printing Test");
76
  else
77
    System.out.println("PASSED: Printing Test");
78
 
79
  System.out.println("PASSED: Test of PrintWriter");
80
}
81
 
82
} // class PrintWriterTest
83
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.