Added tests
This commit is contained in:
parent
63c312589a
commit
5a1d4b8e8d
4 changed files with 42 additions and 1 deletions
|
@ -4,7 +4,6 @@
|
|||
<contentEntry url="file://$MODULE_DIR$">
|
||||
<testFolder url="file://$MODULE_DIR$/src/test/java"/>
|
||||
<testFolder url="file://$MODULE_DIR$/src/test/res"/>
|
||||
<excludeFolder url="file://$MODULE_DIR$/src/main/java/temporal"/>
|
||||
<excludeFolder url="file://$MODULE_DIR$/target"/>
|
||||
</contentEntry>
|
||||
<lib name="Maven: junit:junit:3.8.1" scope="TEST"/>
|
||||
|
|
11
src/test/res/mytest/BasicIf.java
Normal file
11
src/test/res/mytest/BasicIf.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
public class BasicIf {
|
||||
public static void main(String[] args) {
|
||||
boolean isMoving = false;
|
||||
int currentSpeed = 10;
|
||||
if (isMoving) {
|
||||
currentSpeed--;
|
||||
} else {
|
||||
System.err.println("The bicycle has already stopped!");
|
||||
}
|
||||
}
|
||||
}
|
19
src/test/res/mytest/BasicIfElse.java
Normal file
19
src/test/res/mytest/BasicIfElse.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
public class BasicIfElse {
|
||||
public static void main(String[] args) {
|
||||
int testscore = 76;
|
||||
char grade;
|
||||
|
||||
if (testscore >= 90) {
|
||||
grade = 'A';
|
||||
} else if (testscore >= 80) {
|
||||
grade = 'B';
|
||||
} else if (testscore >= 70) {
|
||||
grade = 'C';
|
||||
} else if (testscore >= 60) {
|
||||
grade = 'D';
|
||||
} else {
|
||||
grade = 'F';
|
||||
}
|
||||
System.out.println("Grade = " + grade);
|
||||
}
|
||||
}
|
12
src/test/res/mytest/ReturnTest.java
Normal file
12
src/test/res/mytest/ReturnTest.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
public class ReturnTest {
|
||||
public static void main(String[] args) {
|
||||
int i = Integer.valueOf(args[0]);
|
||||
if (i == 0) {
|
||||
System.out.println("true");
|
||||
return;
|
||||
} else {
|
||||
System.out.println("false");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue