head	1.7;
access;
symbols
	bg2_23:1.7
	bg2_22:1.7
	bg2_21:1.7
	bg2_20:1.7
	bg2_16:1.7
	bg2_15:1.7
	bg2_12:1.7
	bg2_07:1.7
	isorc2008_submission:1.6
	handbook_alpha_edition:1.6
	jtres2007_submission:1.6
	bg1_07:1.6
	bg1_06:1.6
	bg1_05:1.6
	TAL_101:1.1;
locks; strict;
comment	@# @;


1.7
date	2008.02.24.19.28.02;	author martin;	state Exp;
branches;
next	1.6;
commitid	515f47c1c53d4567;

1.6
date	2006.11.02.17.12.39;	author nelkamp;	state Exp;
branches;
next	1.5;
commitid	3bf9454a27034567;

1.5
date	2006.10.31.19.33.08;	author nelkamp;	state Exp;
branches;
next	1.4;
commitid	5e1f4547a4f34567;

1.4
date	2006.10.31.14.14.19;	author nelkamp;	state Exp;
branches;
next	1.3;
commitid	3ff245475a394567;

1.3
date	2006.10.31.12.58.22;	author nelkamp;	state Exp;
branches;
next	1.2;
commitid	7ef44547486b4567;

1.2
date	2006.10.30.19.17.44;	author nelkamp;	state Exp;
branches;
next	1.1;
commitid	69a945464fd74567;

1.1
date	2006.10.26.00.52.59;	author martin;	state Exp;
branches;
next	;
commitid	cd6454006ea4567;


desc
@@


1.7
log
@JOP goes GPL
@
text
@/*
  This file is part of JOP, the Java Optimized Processor
    see <http://www.jopdesign.com/>

  Copyright (C) 2007, Alberto Andreotti

  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 3 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, see <http://www.gnu.org/licenses/>.
*/

package jdk;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.*;

public class TestJdk {

	public static void main(String args[]) {

		System.out.println("current time: " + System.currentTimeMillis());
		System.out.println("current time: " + System.currentTimeMillis());
		System.out.println("current time: " + System.currentTimeMillis());

		
		// test Hashtable
		System.out.println("Hashtable test");
		Hashtable vc = new Hashtable();
		Integer i = new Integer(1);
		vc.put("one", i);
		vc.put("two", new Integer(2));
		vc.put("three", new Integer(3));
		System.out.println("Hashtable.toString():");
		System.out.println(vc.toString());
		System.out.println(vc.toString());

		if (vc.containsKey("two")) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}
		if (vc.contains(i)) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}

		if (!vc.containsKey(new Object())) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}

		if (!vc.isEmpty()) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}

		Enumeration hashenum;

		// TODO: JOP says readMem: wrong address

		// hashenum = vc.elements();
		// System.out.println("Hashtable value Enumeration:");
		// while (hashenum.hasMoreElements()) {
		// // System.out.println(hashenum.nextElement().toString());
		// }
		//
		// hashenum = vc.keys();
		// System.out.println("Hashtable key Enumeration:");
		// while (hashenum.hasMoreElements()) {
		// System.out.println(hashenum.nextElement().toString());
		// }

		if (vc.get("one").equals(i)) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}
		if (vc.size() == 3) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}
		if (i.equals(vc.remove("one"))) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}
		if (!(vc.size() == 3)) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}
		if (vc.size() == 2) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}

		System.out.println("Hashtable.toString():");
		System.out.println(vc.toString());

		vc.clear();
		if (vc.isEmpty()) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Hashtable");
		}

		System.out.println("Hashtable test END");

		
		// MARTIN: uncomment this test for the Vector class
		// 

		// test Vector.java
		System.out.println("Vector test");
		Vector vec = new Vector();
		if (vec.size() == 0) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Vector");
		}
		vec.addElement(new Integer(1));
		vec.addElement(new Integer(2));
		vec.addElement(new Integer(3));
		vec.addElement("nelson");
		vec.addElement("nelson1");
		vec.addElement("nelson2");

		if ((vec.size() == 6)) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Vector");
		}
		System.out.println("Vector.toString():");
		System.out.println(vec.toString());
		System.out.println(vec.toString());

		if (vec.contains("nelson")) {
			System.out.println("OK");
		} else {
			System.out.println("ERROR Vector");
		}
// uncomment until here
		
//		if (!vec.contains("nelsonafasf")) {
//			System.out.println("OK");
//		} else {
//			System.out.println("ERROR Vector");
//		}
//
//		System.out.println("testing Vector.copyInto(Array)");
//		Object[] objarray = new Object[6];
//		vec.copyInto(objarray);
//		for (int ix = 0; ix < 6; ix++) {
//
//			System.out.println(objarray[ix].toString());
//		}

//		if ("nelson1".equals(vec.elementAt(4))) {
//			System.out.println("OK");
//		} else {
//			System.out.println("ERROR Vector");
//		}
//
//		// vec.elementAt(10);
//
//		if (vec.indexOf("nelson2") == 5) {
//			System.out.println("OK");
//		} else {
//			System.out.println("ERROR Vector");
//		}
//
//		vec.addElement(new Integer(1));
//		
//		if (vec.indexOf("nelson2",1) == 6) {
//			System.out.println("OK");
//		} else {
//			System.out.println("ERROR Vector");
//		}
//
//		String five = new String("five");

//		System.out.println("Vector test END");

		// test Stack.java
		/*
		 * Stack stack = new Stack(); stack.push("first1");
		 * stack.push("first2"); stack.push("first3"); stack.push("first4");
		 * System.out.println(stack.toString());
		 * System.out.println(stack.peek().toString());
		 * 
		 * System.out.println(stack.pop().toString());
		 * System.out.println(stack.pop().toString());
		 * System.out.println(stack.pop().toString());
		 * System.out.println(stack.pop().toString());
		 * System.out.println(stack.pop().toString());
		 * 
		 */

		

		// test lang.Character
		/*
		 * Character ch1 = new Character('2');
		 * System.out.println(ch1.toString()); Integer i = new
		 * Integer((int)'2'); System.out.println(i.toString()); int inttmp =
		 * Character.digit('a', 10); Integer i2 = new Integer(inttmp);
		 * System.out.println(i2.toString()); if(Character.isLowerCase('A')){
		 * System.out.println("true"); }else{ System.out.println("false"); }
		 * 
		 * String teststr = new String("1123abcdABCD=)("); teststr =
		 * teststr.toLowerCase(); System.out.println(teststr); teststr =
		 * teststr.toUpperCase(); System.out.println(teststr);
		 */

		Byte b = new Byte((byte) 34);
		System.out.println(b.toString());
		byte b1 = Byte.parseByte("34");
		Byte b2 = new Byte(b1);
		System.out.println(b2.toString());
		if (b.equals(new Integer(2))) {
			System.out.println("true");
		} else {
			System.out.println("false");

		}

		OutputStreamWriter osw = new OutputStreamWriter(
				(OutputStream) System.out);
		try {
			osw.write(new char[] { '2', '\r', '\n' });
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		DataOutputStream dos = new DataOutputStream((OutputStream) System.out);
		try {
			dos.writeChars("test das");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.print("test");

	}

}
@


1.6
log
@*** empty log message ***
@
text
@d1 20
@


1.5
log
@more test cases
@
text
@a6 1
import java.io.UnsupportedEncodingException;
d13 5
d106 1
a106 4
		System.out.println("current time: " + System.currentTimeMillis());
		System.out.println("current time: " + System.currentTimeMillis());
		System.out.println("current time: " + System.currentTimeMillis());

d179 1
a179 1
		System.out.println("Vector test END");
d196 1
a196 68
		// test String and Co
		/*
		 * String str1 = new String(); String str2 = new String(); str2 = "ames
		 * cole"; str1 = "james cole"; System.out.println(str1);
		 * System.out.println(str2); int i = 0; i = str1.compareTo(str2);
		 * System.out.println(i); String tmp = str1.concat(str2);
		 * System.out.println(tmp); if(tmp.endsWith("Cole")){
		 * System.out.println("true"); } else { System.out.println("false"); }
		 * if(str1.equals(str1)){ System.out.println("true equality"); } else {
		 * System.out.println("false equalitiy"); }
		 * 
		 * byte[] sb = str1.getBytes(); try { byte[] sb1 =
		 * str1.getBytes("ISO_8859_1"); } catch (UnsupportedEncodingException e) { //
		 * TODO Auto-generated catch block e.printStackTrace(); }
		 * 
		 * int hashcode = str1.hashCode(); System.out.print(hashcode);
		 * 
		 * int indexof = 0; indexof = str1.indexOf(99);
		 * System.out.print("indexof:"); System.out.print(indexof); indexof =
		 * str1.indexOf("e",7); System.out.print("indexof:");
		 * System.out.print(indexof); indexof = str1.lastIndexOf(97,7);
		 * System.out.print("indexof:"); System.out.print(indexof); tmp =
		 * str1.replace('a', 'b'); System.out.print(tmp);
		 * System.out.print("substring:\n");
		 * 
		 * tmp = str1.substring(3, 7); System.out.print(tmp);
		 * //str1.toLowerCase();
		 * 
		 * String str3 = new String(" bloody mary "); tmp = str3.trim();
		 * System.out.print(tmp);
		 * 
		 * 
		 * //System.out.println(sb.toString());
		 * 
		 */

		// Long lon = new Long(System.currentTimeMillis());
		// System.out.println(lon.toString());
		// test String Buffer
		/*
		 * StringBuffer sb = new StringBuffer("dfmasafasa");
		 * 
		 * System.out.println(sb.toString()); sb.append(true);
		 * System.out.println(sb.toString()); sb.append("hgfjz");// TODO: FIXXME :
		 * STACK OVERFLOW System.out.println(sb.toString()); sb.append(1);
		 * System.out.println(sb.toString()); char[] tmp = new char[10]; tmp[0] =
		 * '0'; tmp[1] = '1'; tmp[2] = '2'; tmp[3] = '3'; sb.append(tmp,1,5);
		 * System.out.println(sb.toString()); sb.deleteCharAt(5);
		 * System.out.println(sb.toString()); sb.insert(3, true);
		 * System.out.println(sb.toString());
		 * System.out.println(sb.reverse().toString()); sb.append(new
		 * Integer(2)); System.out.println(sb.toString());
		 * 
		 */
		/*
		 * Short sho= new Short((short)2); System.out.println(sho.toString());
		 * 
		 * Long lo = new Long(234); System.out.println(lo.toString()); String
		 * tmplong = new String("-123234234546"); long lo1 =
		 * Long.parseLong(tmplong); Long lo2 = new Long(lo1);
		 * System.out.println(lo2.toString());
		 */

		/*
		 * Integer i1 = new Integer(1); System.out.println(i1.toString()); int
		 * i2 = Integer.parseInt("123"); Integer i3 = new Integer(i2);
		 * System.out.println(i3.toString());
		 */
@


1.4
log
@just testing cvs
@
text
@a13 1
		// test cvs1
d15 1
a15 3

		System.out.println(Integer.toString(10, 10));
		
d21 1
a21 1
	
d23 73
a95 9
	
		System.out.println("current time: "+System.currentTimeMillis());
		System.out.println("current time: "+System.currentTimeMillis());
		System.out.println("current time: "+System.currentTimeMillis());
		
		
		
		if (vc.contains("two")) {
			System.out.println("true");
d97 1
a97 2
			System.out.println("false");
			System.out.println(vc.toString());
d100 9
d110 69
a179 18
		/*
		 * Vector vec = new Vector(); System.out.println("size:" + vec.size());
		 * //vec.addElement(new Integer(1)); //vec.addElement(new Integer(2));
		 * //vec.addElement(new Integer(3)); vec.addElement("nelson");
		 * vec.addElement("nelson1"); vec.addElement("nelson2"); String five =
		 * new String("five"); System.out.println("size:" + vec.size());
		 * vec.insertElementAt("nelson4", 2); System.out.println("size:" +
		 * vec.size()); vec.insertElementAt(five, 2); System.out.println("after
		 * five insertion"+vec.toString()); if(vec.isEmpty()){
		 * System.out.println("is empty:true"); // compiler error }else{
		 * System.out.println("is empty:false"); // compiler error }
		 * vec.removeElement(five); System.out.println(vec.toString());
		 * System.out.println("size:" + vec.size()); vec.removeAllElements();
		 * System.out.println("size:" + vec.size()); if(vec.isEmpty()){
		 * System.out.println("is empty:true"); // compiler error }else{
		 * System.out.println("is empty:false"); // compiler error }
		 * 
		 */
a232 1

@


1.3
log
@*** empty log message ***
@
text
@d14 1
a14 1
		// test cvs
@


1.2
log
@added test cases
@
text
@d14 1
@


1.1
log
@merge with Nelsons JDK and split into three source directories
@
text
@d3 5
d13 5
d23 1
d25 7
d38 150
a188 1
	 
@

