From 879e2d7ce8bb9ce6758665901738e99b30c26d95 Mon Sep 17 00:00:00 2001 From: "Aaron M. Renn" Date: Sun, 2 Aug 1998 02:54:13 +0000 Subject: Initial checkin --- test/java.io/ChangeLog | 67 +++++++++++++++++++++++++ test/java.io/UTF8EncodingTest.java | 100 +++++++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 test/java.io/UTF8EncodingTest.java (limited to 'test') diff --git a/test/java.io/ChangeLog b/test/java.io/ChangeLog index e5dbab97c..b95391c4f 100644 --- a/test/java.io/ChangeLog +++ b/test/java.io/ChangeLog @@ -1,3 +1,70 @@ +Sat Aug 1 22:02:47 1998 arenn's Development Account + + * UTF8EncodingTest.java: Wrote this class, got a clean compile, + and tested the UTF8 encoding scheme. + +Fri Jul 31 21:03:16 1998 arenn's Development Account + + * PrintWriterTest.java: Wrote this class, got a clean compile, + and tested PrintWriter. + + * FileWriterTest.java: Wrote this class, got a clean compile, + and tested FileWriter and OutputStreamWriter. + + * BufferedCharWriterTest.java: Wrote this class, got a clean + compile, and tested BufferedWriter and CharArrayWriter. + + * PipedReaderWriterTest.java: Wrote this class, got a clean + compile, and tested PipedReader and PipedWriter. + + * FileReaderTest.java: Wrote this class, got a clean compile, and + tested FileReader and InputStreamReader + +Wed Jul 29 20:00:20 1998 arenn's Development Account + + * LineNumberReaderTest.java: Wrote this class, got a clean compile, + and tested LineNumberReader. + + * PushbackReaderTest.java: Wrote this class, got a clean compile, + and tested PushbackReader. + + * BufferedReaderTest.java: Wrote this class, got a clean compile, + and tested BufferedReader and StringReader. + + * CharArrayReaderTest.java: Wrote this class, got a clean compile, + and tested CharArrayReader. + +Sat Jul 18 16:45:07 1998 arenn's Development Account + + * PrintStreamTest.java: Wrote this class, got a clean compile, + and tested PrintStream + +Fri Jul 17 23:22:23 1998 arenn's Development Account + + * RandomAccessFileTest.java: Wrote this class, got a clean compile, + and tested RandomAccessFile + +Thu Jul 16 21:00:47 1998 arenn's Development Account + + * FileOutputStreamTest.java: Wrote this class, got a clean compile, + and tested FileOutputStream. + + * FileInputStreamTest.java: Wrote this class and got a clean compile + and tested FileInputStream. + + * FileTest.java: Wrote this class, got a clean compile, and + tested File. + +Fri Jun 26 20:50:29 1998 arenn's Development Account + + * BufferedByteOutputStreamTest.java: Wrote these classes and + tested BufferedOutputStream and ByteOutputStream.s + +Tue Jun 23 19:02:27 1998 arenn's Development Account + + * DataInputOutputTest.java: Modified to read in both the JCL + produced output and the JDK reference output. + Tue Jun 16 20:09:50 1998 arenn's Development Account * DataInputOutputTest.java: Finished this class and initial debug diff --git a/test/java.io/UTF8EncodingTest.java b/test/java.io/UTF8EncodingTest.java new file mode 100644 index 000000000..62634ebf7 --- /dev/null +++ b/test/java.io/UTF8EncodingTest.java @@ -0,0 +1,100 @@ +/************************************************************************* +/* UTF8EncodingTest.java -- A quick test of the UTF8 encoding +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This program is free software; you can redistribute it and/or modify +/* it under the terms of the GNU General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later version. +/* +/* This program is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU General Public License for more details. +/* +/* You should have received a copy of the GNU General Public License +/* along with this program; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +import java.io.*; + +public class UTF8EncodingTest +{ + +public static void main(String[] argv) +{ + System.out.println("Started test of UTF8 encoding handling"); + + String str1 = "This is the first line of text\n"; + String str2 = "This has some \u01FF\uA000\u6666\u0200 weird characters\n"; + + System.out.println("Test 1: Write test"); + try + { + FileOutputStream fos = new FileOutputStream("utf8test.out"); + OutputStreamWriter osr = new OutputStreamWriter(fos, "UTF8"); + osr.write(str1); + osr.write(str2); + osr.close(); + + System.out.println("PASSED: Write test (conditionally)"); + } + catch(IOException e) + { + System.out.println("FAILED: Write Test: " + e); + } + + System.out.println("Test 2: Read JDK file test"); + try + { + FileInputStream fis = new FileInputStream("utf8test-jdk.out"); + InputStreamReader isr = new InputStreamReader(fis, "UTF8"); + char[] buf = new char[255]; + + int chars_read = isr.read(buf, 0, str1.length()); + String str3 = new String(buf, 0, chars_read); + + chars_read = isr.read(buf, 0, str2.length()); + String str4 = new String(buf, 0, chars_read); + + if (!str1.equals(str3) || !str2.equals(str4)) + System.out.println("FAILED: Read JDK file test"); + else + System.out.println("PASSED: Read JDK file test"); + } + catch(IOException e) + { + System.out.println("FAILED: Read JDK file test: " + e); + } + + System.out.println("Test 3: Read classpath file test"); + try + { + FileInputStream fis = new FileInputStream("utf8test.out"); + InputStreamReader isr = new InputStreamReader(fis, "UTF8"); + char[] buf = new char[255]; + + int chars_read = isr.read(buf, 0, str1.length()); + String str3 = new String(buf, 0, chars_read); + + chars_read = isr.read(buf, 0, str2.length()); + String str4 = new String(buf, 0, chars_read); + + if (!str1.equals(str3) || !str2.equals(str4)) + System.out.println("FAILED: Read classpath file test"); + else + System.out.println("PASSED: Read classpath file test"); + } + catch(IOException e) + { + System.out.println("FAILED: Read classpath file test: " + e); + } + + System.out.println("Finished test of UTF8 encoding handling"); +} + +} // class UTF8EncodingTest + -- cgit v1.2.1