Added more tests for Java constructors. development
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 11 Apr 2013 15:00:07 +0200
branchdevelopment
changeset 2500 421f09749cb7
parent 2499 6153b854779a
child 2501 53d731454d43
Added more tests for Java constructors.
tests/libjava/src/stx/libjava/tests/lang/ConstructorTests.java
--- a/tests/libjava/src/stx/libjava/tests/lang/ConstructorTests.java	Thu Apr 11 14:58:46 2013 +0200
+++ b/tests/libjava/src/stx/libjava/tests/lang/ConstructorTests.java	Thu Apr 11 15:00:07 2013 +0200
@@ -8,7 +8,7 @@
 	
 	public static class A {
 		public int f;
-		
+			
 		public A(int i, int j) {
 			f = i + j;
 		}
@@ -20,6 +20,10 @@
 		public A() {
 			this(10);
 		}
+		
+		public A(Integer i) {
+			this(i.intValue());
+		}
 	}
 	
 	public static class B extends A {
@@ -33,8 +37,33 @@
 		
 		public B() {
 			this(10);
+		}		
+	}
+	
+	public static class C extends B {
+		public C(Integer i) {
+			super(new Integer(i.intValue() + 1000));
 		}
-		
+	}
+	
+	
+	public static class X {
+		public int f = -1;
+		public X() {
+			f = 1;
+		}
+	}
+	
+	public static class Y extends X {
+	}
+	
+	public static class Z extends Y {
+		public Z() {
+			super();
+		}
+	}
+	
+	public static class W extends X {
 	}
 
 	@Test
@@ -49,4 +78,22 @@
 		assertEquals(0, b.f);
 	}
 
+	@Test
+	public void test_03() {
+		C c = new C(new Integer(10));
+		assertEquals(1020, c.f);
+	}
+	
+	@Test
+	public void test_04() {
+		Z z = new Z();
+		assertEquals(1, z.f);
+		
+		Y y = new Y();
+		assertEquals(1, y.f);
+		
+		W w = new W();
+		assertEquals(1, w.f);
+
+	}
 }