j2k: flatten test cases and testData directory structure
Move j2k/test/tests -> j2k/tests, j2k/test/testData -> j2k/testData
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package foo; // we use package 'foo'
|
||||
|
||||
// imports:
|
||||
import java.util.ArrayList; // we need ArrayList
|
||||
|
||||
// let's declare a class:
|
||||
class A /* just a sample name*/ implements Runnable /* let's implement Runnable */ {
|
||||
void foo /* again a sample name */(int p /* parameter p */, char c /* parameter c */) {
|
||||
// let's print something:
|
||||
System.out.println("1"); // print 1
|
||||
System.out.println("2"); // print 2
|
||||
|
||||
System.out.println("3"); // print 3
|
||||
|
||||
// end of printing
|
||||
|
||||
if (p > 0) { // do this only when p > 0
|
||||
// we print 4 and return
|
||||
System.out.println("3");
|
||||
return; // do not continue
|
||||
}
|
||||
|
||||
// some code to be added
|
||||
}
|
||||
} // end of class A
|
||||
@@ -0,0 +1,29 @@
|
||||
// ERROR: Class 'A' must be declared abstract or implement abstract member public abstract fun run(): kotlin.Unit defined in java.lang.Runnable
|
||||
package foo
|
||||
|
||||
// we use package 'foo'
|
||||
|
||||
// imports:
|
||||
import java.util.ArrayList // we need ArrayList
|
||||
|
||||
// let's declare a class:
|
||||
class A /* just a sample name*/ : Runnable /* let's implement Runnable */ {
|
||||
fun foo/* again a sample name */(p: Int /* parameter p */, c: Char /* parameter c */) {
|
||||
// let's print something:
|
||||
System.out.println("1") // print 1
|
||||
System.out.println("2") // print 2
|
||||
|
||||
System.out.println("3") // print 3
|
||||
|
||||
// end of printing
|
||||
|
||||
if (p > 0) {
|
||||
// do this only when p > 0
|
||||
// we print 4 and return
|
||||
System.out.println("3")
|
||||
return // do not continue
|
||||
}
|
||||
|
||||
// some code to be added
|
||||
}
|
||||
} // end of class A
|
||||
@@ -0,0 +1,25 @@
|
||||
package foo // we use package 'foo'
|
||||
|
||||
// imports:
|
||||
import java.util.ArrayList // we need ArrayList
|
||||
|
||||
// let's declare a class:
|
||||
class A /* just a sample name*/() : Runnable /* let's implement Runnable */ {
|
||||
fun foo /* again a sample name */( p: Int /* parameter p */, c: Char /* parameter c */) {
|
||||
// let's print something:
|
||||
System.out.println("1") // print 1
|
||||
System.out.println("2") // print 2
|
||||
|
||||
System.out.println("3") // print 3
|
||||
|
||||
// end of printing
|
||||
|
||||
if (p > 0) { // do this only when p > 0
|
||||
// we print 4 and return
|
||||
System.out.println("3")
|
||||
return // do not continue
|
||||
}
|
||||
|
||||
// some code to be added
|
||||
}
|
||||
} // end of class A
|
||||
@@ -0,0 +1,19 @@
|
||||
package foo;
|
||||
|
||||
class A {
|
||||
void/* nothing to return */ foo(/* no parameters at all */) {
|
||||
// let declare a variable
|
||||
// with 2 comments before
|
||||
int/*int*/ a /* it's a */ = 2 /* it's 2 */ + 1 /* it's 1 */; // variable a declared
|
||||
} // end of foo
|
||||
|
||||
int/* we return int*/ foo(int/*int*/ p/* parameter p */) { /* body is empty */ }
|
||||
|
||||
private/*it's private*/ int field = 0;
|
||||
|
||||
public /*it's public*/ char foo(String s) { }
|
||||
|
||||
protected/*it's protected*/ void foo(char c) { }
|
||||
|
||||
public/*it's public*/ static/*and static*/ final/*and final*/ int C = 1;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// ERROR: A 'return' expression required in a function with a block body ('{...}')
|
||||
// ERROR: A 'return' expression required in a function with a block body ('{...}')
|
||||
package foo
|
||||
|
||||
class A {
|
||||
fun /* nothing to return */ foo(/* no parameters at all */) {
|
||||
// let declare a variable
|
||||
// with 2 comments before
|
||||
val /*int*/ a /* it's a */ = 2 /* it's 2 */ + 1 /* it's 1 */ // variable a declared
|
||||
} // end of foo
|
||||
|
||||
fun /* we return int*/ foo(/*int*/ p: Int/* parameter p */): Int {
|
||||
/* body is empty */
|
||||
}
|
||||
|
||||
private /*it's private*/ val field = 0
|
||||
|
||||
public /*it's public*/ fun foo(s: String): Char {
|
||||
}
|
||||
|
||||
protected /*it's protected*/ fun foo(c: Char) {
|
||||
}
|
||||
|
||||
class object {
|
||||
|
||||
public /*it's public*//*and static*//*and final*/ val C: Int = 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
class A {
|
||||
private int v;
|
||||
|
||||
// this is a primary constructor
|
||||
A(int p) {
|
||||
v = 1;
|
||||
} // end of primary constructor body
|
||||
|
||||
// this is a secondary constructor 1
|
||||
A() {
|
||||
this(1);
|
||||
} // end of secondary constructor 1 body
|
||||
|
||||
// this is a secondary constructor 2
|
||||
A(String s) {
|
||||
this(s.length());
|
||||
} // end of secondary constructor 2 body
|
||||
}
|
||||
|
||||
class B {
|
||||
private int x;
|
||||
|
||||
// this constructor will disappear
|
||||
B(int x) {
|
||||
this.x = x;
|
||||
} // end of constructor body
|
||||
|
||||
void foo(){}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// this is a secondary constructor 2
|
||||
fun A(s: String): A {
|
||||
return A(s.length())
|
||||
} // end of secondary constructor 2 body
|
||||
|
||||
class A// this is a primary constructor
|
||||
(p: Int = 1) {
|
||||
private val v: Int
|
||||
|
||||
{
|
||||
v = 1
|
||||
} // end of primary constructor body
|
||||
}// this is a secondary constructor 1
|
||||
// end of secondary constructor 1 body
|
||||
|
||||
class B// this constructor will disappear
|
||||
(private val x: Int) // end of constructor body
|
||||
{
|
||||
|
||||
fun foo() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
private boolean isOpen = true; // ideally should be atomic boolean
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
private val isOpen = true // ideally should be atomic boolean
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
class C {
|
||||
private final int p1; // field p1
|
||||
|
||||
/**
|
||||
* Field myP2
|
||||
*/
|
||||
private final int myP2;
|
||||
|
||||
/* Field p3 */ public int p3;
|
||||
|
||||
public C(int p1 /* parameter p1 */, int p2, int p3) {
|
||||
this.p1 = p1;
|
||||
myP2 = p2;
|
||||
this.p3 = p3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class C(private val p1: Int /* parameter p1 */ // field p1
|
||||
,
|
||||
/**
|
||||
* Field myP2
|
||||
*/
|
||||
private val myP2: Int, /* Field p3 */ public var p3: Int)
|
||||
Reference in New Issue
Block a user