Skip to content

Commit

Permalink
Move tests to graderPrivate
Browse files Browse the repository at this point in the history
  • Loading branch information
zentox committed Dec 9, 2023
1 parent 6d1d669 commit 68deedf
Show file tree
Hide file tree
Showing 55 changed files with 2,732 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ out/
gradle-app.setting
!gradle-wrapper.jar
.gradletasknamecache

### Jagr ###
jagr.conf
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
algoutils = "0.7.0-SNAPSHOT"
algoutils = "0.7.2"

[plugins]
style = { id = "org.sourcegrade.style", version = "2.1.0" }
jagr-gradle = { id = "org.sourcegrade.jagr-gradle", version = "0.10.1" }
jagr-gradle = { id = "org.sourcegrade.jagr-gradle", version = "0.10.2" }

[libraries]
annotations = "org.jetbrains:annotations:23.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import h06.world.DirectionVector;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest;
import org.junitpioneer.jupiter.json.JsonClasspathSource;
import org.junitpioneer.jupiter.json.Property;
Expand All @@ -18,6 +21,7 @@
import spoon.reflect.declaration.CtElement;

import java.util.List;
import java.util.concurrent.TimeUnit;

import static h06.TutorUtils.getMethodLink;
import static h06.TutorUtils.getTypeLink;
Expand All @@ -32,7 +36,13 @@
* @author Nhan Huynh
*/
@DisplayName("H1 | DirectionVector")
@TestMethodOrder(MethodOrderer.DisplayName.class)
@TestForSubmission
@Timeout(
value = TestConstants.TEST_TIMEOUT_IN_SECONDS,
unit = TimeUnit.SECONDS,
threadMode = Timeout.ThreadMode.SEPARATE_THREAD
)
public class H1_DirectionVectorTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import h06.world.DirectionVector;
import h06.world.World;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest;
import org.junitpioneer.jupiter.json.JsonClasspathSource;
import org.junitpioneer.jupiter.json.Property;
Expand All @@ -13,6 +16,7 @@
import org.tudalgo.algoutils.tutor.general.reflections.MethodLink;

import java.awt.Point;
import java.util.concurrent.TimeUnit;

import static h06.TutorUtils.buildWorldContext;
import static h06.TutorUtils.getMethodLink;
Expand All @@ -25,7 +29,13 @@
* @see H1_DirectionVectorTest
*/
@DisplayName("H2 | World")
@TestMethodOrder(MethodOrderer.DisplayName.class)
@TestForSubmission
@Timeout(
value = TestConstants.TEST_TIMEOUT_IN_SECONDS,
unit = TimeUnit.SECONDS,
threadMode = Timeout.ThreadMode.SEPARATE_THREAD
)
public class H2_WorldTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
import h06.world.DirectionVector;
import h06.world.World;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest;
import org.junitpioneer.jupiter.json.JsonClasspathSource;
import org.junitpioneer.jupiter.json.Property;
Expand All @@ -30,6 +33,7 @@
import java.awt.Point;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

Expand All @@ -49,6 +53,12 @@
*/
@DisplayName("H3 | MazeSolverRecursive")
@TestForSubmission
@TestMethodOrder(MethodOrderer.DisplayName.class)
@Timeout(
value = TestConstants.TEST_TIMEOUT_IN_SECONDS,
unit = TimeUnit.SECONDS,
threadMode = Timeout.ThreadMode.SEPARATE_THREAD
)
public class H3_MazeSolverRecursiveTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest;
import org.junitpioneer.jupiter.json.JsonClasspathSource;
import org.junitpioneer.jupiter.json.Property;
Expand All @@ -27,6 +28,7 @@
import java.awt.Point;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

import static h06.TutorUtils.assertIterative;
import static h06.TutorUtils.buildWorldContext;
Expand All @@ -42,6 +44,11 @@
@DisplayName("H4 | MazeSolverIterative")
@TestMethodOrder(MethodOrderer.DisplayName.class)
@TestForSubmission
@Timeout(
value = TestConstants.TEST_TIMEOUT_IN_SECONDS,
unit = TimeUnit.SECONDS,
threadMode = Timeout.ThreadMode.SEPARATE_THREAD
)
public class H4_MazeSolverIterativeTest {

/**
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions src/graderPrivate/java/h06/TestConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package h06;

/**
* Constants for testing.
*/
public class TestConstants {

/**
* The timeout for each test in seconds.
*/
public static final int TEST_TIMEOUT_IN_SECONDS = 2;
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"input": "DOWN",
"expected": "RIGHT"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"input": "LEFT",
"expected": "DOWN"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"input": "RIGHT",
"expected": "UP"
}
4 changes: 4 additions & 0 deletions src/graderPrivate/resources/DirectionVector/rotate270/up.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"input": "UP",
"expected": "LEFT"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"input": "DOWN",
"expected": "LEFT"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"input": "LEFT",
"expected": "UP"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"input": "RIGHT",
"expected": "DOWN"
}
4 changes: 4 additions & 0 deletions src/graderPrivate/resources/DirectionVector/rotate90/up.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"input": "UP",
"expected": "RIGHT"
}
28 changes: 28 additions & 0 deletions src/graderPrivate/resources/MazeSolver/nextStep/down.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"properties": {
"height": 3,
"width": 3,
"horizontal": [
{
"x": 1,
"y": 1
}
],
"vertical": [
{
"x": 0,
"y": 1
},
{
"x": 1,
"y": 1
}
]
},
"p": {
"x": 1,
"y": 1
},
"d": "LEFT",
"expected": "DOWN"
}
24 changes: 24 additions & 0 deletions src/graderPrivate/resources/MazeSolver/nextStep/down_complex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"properties": {
"height": 3,
"width": 3,
"horizontal": [
{
"x": 1,
"y": 1
}
],
"vertical": [
{
"x": 1,
"y": 1
}
]
},
"p": {
"x": 1,
"y": 1
},
"d": "RIGHT",
"expected": "DOWN"
}
28 changes: 28 additions & 0 deletions src/graderPrivate/resources/MazeSolver/nextStep/left.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"properties": {
"height": 3,
"width": 3,
"horizontal": [
{
"x": 1,
"y": 0
},
{
"x": 1,
"y": 1
}
],
"vertical": [
{
"x": 1,
"y": 1
}
]
},
"p": {
"x": 1,
"y": 1
},
"d": "UP",
"expected": "LEFT"
}
24 changes: 24 additions & 0 deletions src/graderPrivate/resources/MazeSolver/nextStep/left_complex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"properties": {
"height": 3,
"width": 3,
"horizontal": [
{
"x": 1,
"y": 0
}
],
"vertical": [
{
"x": 1,
"y": 1
}
]
},
"p": {
"x": 1,
"y": 1
},
"d": "DOWN",
"expected": "LEFT"
}
28 changes: 28 additions & 0 deletions src/graderPrivate/resources/MazeSolver/nextStep/right.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"properties": {
"height": 3,
"width": 3,
"horizontal": [
{
"x": 1,
"y": 0
},
{
"x": 1,
"y": 1
}
],
"vertical": [
{
"x": 0,
"y": 1
}
]
},
"p": {
"x": 1,
"y": 1
},
"d": "DOWN",
"expected": "RIGHT"
}
24 changes: 24 additions & 0 deletions src/graderPrivate/resources/MazeSolver/nextStep/right_complex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"properties": {
"height": 3,
"width": 3,
"horizontal": [
{
"x": 1,
"y": 1
}
],
"vertical": [
{
"x": 0,
"y": 1
}
]
},
"p": {
"x": 1,
"y": 1
},
"d": "UP",
"expected": "RIGHT"
}
28 changes: 28 additions & 0 deletions src/graderPrivate/resources/MazeSolver/nextStep/up.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"properties": {
"height": 3,
"width": 3,
"horizontal": [
{
"x": 1,
"y": 0
}
],
"vertical": [
{
"x": 0,
"y": 1
},
{
"x": 1,
"y": 1
}
]
},
"p": {
"x": 1,
"y": 1
},
"d": "RIGHT",
"expected": "UP"
}
Loading

0 comments on commit 68deedf

Please sign in to comment.