Sfoglia il codice sorgente

Add test case for tiny basecode.

Timur Sağlam 4 anni fa
parent
commit
300e1e989e

+ 5 - 0
jplag/src/test/java/de/jplag/BaseCodeTest.java

@@ -13,6 +13,11 @@ public class BaseCodeTest extends TestBase {
         JPlagResult result = runJPlag("basecode", it -> it.setBaseCodeSubmissionName("base"));
         verifyResults(result);
     }
+    
+    @Test(expected = ExitException.class)
+    public void testTinyBasecode() throws ExitException {
+        runJPlag("TinyBasecode", it -> it.setBaseCodeSubmissionName("base"));
+    }
 
     @Test
     public void testEmptySubmission() throws ExitException {

+ 27 - 0
jplag/src/test/resources/de/jplag/samples/TinyBasecode/A/TerrainType.java

@@ -0,0 +1,27 @@
+package carcassonne.model.terrain;
+
+import java.util.List;
+
+/**
+ * Enumeration for the terrain type. Is used to specify the terrain of a tile on its different positions.
+ * @author Timur Saglam
+ */
+public enum TerrainType {
+    CASTLE,
+    ROAD,
+    MONASTERY,
+    FIELDS,
+    OTHER;
+
+    /**
+     * Generates a list of the basic terrain types, which is every terrain except {@link Other}.
+     * @return a list of CASTLE, ROAD, MONASTERY, FIELDS.
+     */
+    public static List<TerrainType> basicTerrain() {
+        return List.of(CASTLE, ROAD, MONASTERY, FIELDS);
+    }
+
+    public String toReadableString() {
+        return toString().charAt(0) + toString().substring(1).toLowerCase();
+    }
+}

+ 30 - 0
jplag/src/test/resources/de/jplag/samples/TinyBasecode/B/TerrainType.java

@@ -0,0 +1,30 @@
+package carcassonne.model.terrain;
+
+import java.util.List;
+
+/**
+ * Enumeration for the terrain type. Is used to specify the terrain of a tile on its different positions.
+ * @author Mean Plagiarizer
+ */
+public enum TerrainType {
+    CASTLE,
+    ROAD,
+    MONASTERY,
+    FIELDS,
+    OTHER;
+
+    private static final int CONST_0 = 0;
+    private static final int CONST_1 = 1;
+
+    /**
+     * Generates a list of the basic terrain types, which is every terrain except {@link Other}.
+     * @return a list of CASTLE, ROAD, MONASTERY, FIELDS.
+     */
+    public static List<TerrainType> basicTerrain() {
+        return List.of(CASTLE, ROAD, MONASTERY, FIELDS);
+    }
+
+    public String toReadableString() {
+        return toString().charAt(CONST_0) + toString().substring(CONST_1).toLowerCase();
+    }
+}

+ 7 - 0
jplag/src/test/resources/de/jplag/samples/TinyBasecode/base/TerrainType.java

@@ -0,0 +1,7 @@
+package carcassonne.model.terrain;
+
+/**
+ * Enumeration for the terrain type. Is used to specify the terrain of a tile on its different positions.
+ */
+public enum TerrainType {
+}