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/] [PrintStreamTest.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/*************************************************************************
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.
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 PrintStreamTest
25
{
26
 
27
public static void main(String[] argv) throws IOException
28
{
29
  System.out.println("Started test of PrintStream");
30
  System.out.println("Test 1: Printing Test");
31
 
32
  char[] carray = { 'h', 'i' };
33
  byte[] barray = { 'b', 'y', 'e' };
34
 
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();
73
 
74
  if (ps.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 PrintStream");
80
}
81
 
82
} // class PrintStreamTest
83
 

powered by: WebSVN 2.1.0

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