Skip to content

Commit aedb793

Browse files
hansonrhansonr
authored andcommitted
tests
1 parent 2ff8235 commit aedb793

File tree

3 files changed

+66
-3
lines changed

3 files changed

+66
-3
lines changed

sources/net.sf.j2s.java.core/src/test/Test_Event.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.awt.DefaultKeyboardFocusManager;
88
import java.awt.Dimension;
99
import java.awt.KeyboardFocusManager;
10+
import java.awt.Toolkit;
1011
import java.awt.event.ActionEvent;
1112
import java.awt.event.ActionListener;
1213
import java.awt.event.FocusEvent;
@@ -42,6 +43,7 @@ public class Test_Event extends JFrame {
4243

4344
static {
4445
System.out.println("os:"+ System.getProperty("os.name"));
46+
System.out.println("dpr:" + Toolkit.getDefaultToolkit().getScreenResolution());
4547
}
4648

4749
String test = " 34567890\n1234567890\n 345\n ";

sources/net.sf.j2s.java.core/src/test/Test_JSON.java

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
import java.io.BufferedReader;
55
import java.io.IOException;
66
import java.io.InputStream;
7-
import java.io.InputStreamReader;
7+
import java.math.BigDecimal;
8+
import java.math.BigInteger;
89
import java.net.HttpURLConnection;
910
import java.net.MalformedURLException;
1011
import java.net.URL;
1112
import java.util.ArrayList;
12-
import java.util.Collection;
1313
import java.util.Iterator;
1414
import java.util.List;
1515
import java.util.Map;
@@ -22,6 +22,18 @@ public class Test_JSON extends Test_ {
2222
@SuppressWarnings("unused")
2323
public static void main(String[] args) {
2424
try {
25+
//
26+
// System.out.println(Double.valueOf(Double.MIN_NORMAL + "1"));
27+
// System.out.println(Long.valueOf(Long.MAX_VALUE+"1"));
28+
// BigInteger bi = new BigInteger(Long.MAX_VALUE+"");
29+
// System.out.println(bi.longValue());
30+
// BigDecimal bd = new BigDecimal(Double.MAX_VALUE + "1");
31+
// System.out.println(bi.doubleValue());
32+
33+
34+
org.json.JSONObject o = new org.json.JSONObject(new Test_JSON());
35+
System.out.println(o.toString());
36+
2537
URL url = new URL("http://www.ebi.ac.uk/pdbe/api/pdb/entry/summary/1cbs");
2638

2739
JSUtil.setAjax(url);
@@ -88,12 +100,51 @@ public static void main(String[] args) {
88100
// for (int i = 0; i < list.size(); i++)
89101
// dumpVal(list.get(i));
90102
}
103+
91104
System.out.println("Test_JSON OK");
92105
} catch (MalformedURLException e) {
93106
} catch (IOException e) {
94107
}
95108
}
96109

110+
public int getValue() {
111+
return 3;
112+
}
113+
114+
public double getValueD() {
115+
return 3;
116+
}
117+
118+
public boolean getValueBtrue() {
119+
return true;
120+
}
121+
122+
public boolean getValueBfalse() {
123+
return false;
124+
}
125+
126+
public String getValueS() {
127+
return "s";
128+
}
129+
130+
131+
public char[] getValueCA() {
132+
return new char[] {'o','k'};
133+
}
134+
135+
public BigInteger getValueBI() {
136+
return new BigInteger("123456789012345678901234567890");
137+
}
138+
139+
public BigDecimal getValueBD() {
140+
return new BigDecimal("123456789012345.678901234567890E456");
141+
}
142+
143+
public BigDecimal getValueLD() {
144+
return new BigDecimal("123456789012345.678901234567890E-1456");
145+
}
146+
147+
97148
private static void dumpVal(Object object) {
98149
if (object instanceof Map) {
99150
Map<String, Object> m = (Map<String, Object>) object;

sources/net.sf.j2s.java.core/src/test/Test_Static.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ class Test_Static extends Test_ implements Test_int3, Test_int2, Test_int1 {
2323

2424
private static byte[] bytearray = {1,2,127};
2525

26+
private final static Integer iI = 11;
27+
private final static Integer iI1 = new Integer(13);
28+
private final static Float fF2 = 12f;
29+
private final static Float fF1 = new Float(12);
30+
31+
private final static String st = "testing";
32+
static {
33+
assert (iI == 11);
34+
}
35+
private static String st1 = st;
2636
private static boolean b = false;
2737
private static int y;
2838
private static char c = 'c';
@@ -86,7 +96,7 @@ public static void main(String[] args) {
8696
new Test_Static().test();
8797
new Test_Static().b ^= true;
8898
System.out.println(bytearray[2]);
89-
99+
90100
new Test_Static().bytearray[--y]++;
91101

92102

0 commit comments

Comments
 (0)