diff options
Diffstat (limited to 'enigma/src/test')
9 files changed, 0 insertions, 182 deletions
diff --git a/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestComments.java b/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestComments.java deleted file mode 100644 index 15ec44e..0000000 --- a/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestComments.java +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | package cuchaz.enigma.translation.mapping; | ||
| 2 | |||
| 3 | import java.io.IOException; | ||
| 4 | import java.net.URISyntaxException; | ||
| 5 | import java.nio.file.Path; | ||
| 6 | import java.nio.file.Paths; | ||
| 7 | |||
| 8 | import org.junit.Test; | ||
| 9 | |||
| 10 | import cuchaz.enigma.ProgressListener; | ||
| 11 | import cuchaz.enigma.translation.mapping.serde.MappingFileNameFormat; | ||
| 12 | import cuchaz.enigma.translation.mapping.serde.MappingParseException; | ||
| 13 | import cuchaz.enigma.translation.mapping.serde.MappingSaveParameters; | ||
| 14 | import cuchaz.enigma.translation.mapping.serde.enigma.EnigmaMappingsReader; | ||
| 15 | import cuchaz.enigma.translation.mapping.serde.tinyv2.TinyV2Writer; | ||
| 16 | import cuchaz.enigma.translation.mapping.tree.EntryTree; | ||
| 17 | |||
| 18 | public class TestComments { | ||
| 19 | private static Path DIRECTORY; | ||
| 20 | |||
| 21 | static { | ||
| 22 | try { | ||
| 23 | DIRECTORY = Paths.get(TestTinyV2InnerClasses.class.getResource("/comments/").toURI()); | ||
| 24 | } catch (URISyntaxException e) { | ||
| 25 | throw new RuntimeException(e); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | |||
| 29 | @Test | ||
| 30 | public void testParseAndWrite() throws IOException, MappingParseException { | ||
| 31 | ProgressListener progressListener = ProgressListener.none(); | ||
| 32 | MappingSaveParameters params = new MappingSaveParameters(MappingFileNameFormat.BY_DEOBF); | ||
| 33 | EntryTree<EntryMapping> mappings = EnigmaMappingsReader.DIRECTORY.read(DIRECTORY, progressListener, params); | ||
| 34 | |||
| 35 | new TinyV2Writer("intermediary", "named").write(mappings, DIRECTORY.resolve("convertedtiny.tiny"), progressListener, params); | ||
| 36 | } | ||
| 37 | } | ||
diff --git a/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestReadWriteCycle.java b/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestReadWriteCycle.java index 25f11fb..f665c36 100644 --- a/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestReadWriteCycle.java +++ b/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestReadWriteCycle.java | |||
| @@ -104,11 +104,6 @@ public class TestReadWriteCycle { | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | @Test | 106 | @Test |
| 107 | public void testEnigmaZip() throws IOException, MappingParseException { | ||
| 108 | testReadWriteCycle(MappingFormat.ENIGMA_ZIP, true, ".zip"); | ||
| 109 | } | ||
| 110 | |||
| 111 | @Test | ||
| 112 | public void testTinyFile() throws IOException, MappingParseException { | 107 | public void testTinyFile() throws IOException, MappingParseException { |
| 113 | testReadWriteCycle(MappingFormat.TINY_FILE, false, ".tiny"); | 108 | testReadWriteCycle(MappingFormat.TINY_FILE, false, ".tiny"); |
| 114 | } | 109 | } |
diff --git a/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestTinyV2InnerClasses.java b/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestTinyV2InnerClasses.java deleted file mode 100644 index 9164abe..0000000 --- a/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestTinyV2InnerClasses.java +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * <p>Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.translation.mapping; | ||
| 13 | |||
| 14 | import java.nio.file.Path; | ||
| 15 | import java.nio.file.Paths; | ||
| 16 | import java.util.List; | ||
| 17 | |||
| 18 | import cuchaz.enigma.Enigma; | ||
| 19 | import cuchaz.enigma.EnigmaProject; | ||
| 20 | import cuchaz.enigma.ProgressListener; | ||
| 21 | import cuchaz.enigma.translation.mapping.serde.enigma.EnigmaMappingsReader; | ||
| 22 | |||
| 23 | public final class TestTinyV2InnerClasses { | ||
| 24 | private Path jar; | ||
| 25 | private Path mappings; | ||
| 26 | |||
| 27 | public TestTinyV2InnerClasses() throws Exception { | ||
| 28 | jar = Paths.get("build/test-obf/innerClasses.jar"); | ||
| 29 | mappings = Paths.get(TestTinyV2InnerClasses.class.getResource("/tinyV2InnerClasses/").toURI()); | ||
| 30 | } | ||
| 31 | |||
| 32 | // @Test | ||
| 33 | public void testMappings() throws Exception { | ||
| 34 | EnigmaProject project = Enigma.create().openJar(jar, List.of(), ProgressListener.none()); | ||
| 35 | project.setMappings(EnigmaMappingsReader.DIRECTORY.read(mappings, ProgressListener.none(), project.getEnigma().getProfile().getMappingSaveParameters())); | ||
| 36 | } | ||
| 37 | } | ||
diff --git a/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestV2Main.java b/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestV2Main.java deleted file mode 100644 index cc08b85..0000000 --- a/enigma/src/test/java/cuchaz/enigma/translation/mapping/TestV2Main.java +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | package cuchaz.enigma.translation.mapping; | ||
| 2 | |||
| 3 | import java.nio.file.Path; | ||
| 4 | import java.nio.file.Paths; | ||
| 5 | |||
| 6 | import cuchaz.enigma.ProgressListener; | ||
| 7 | import cuchaz.enigma.translation.mapping.serde.MappingFileNameFormat; | ||
| 8 | import cuchaz.enigma.translation.mapping.serde.MappingSaveParameters; | ||
| 9 | import cuchaz.enigma.translation.mapping.serde.enigma.EnigmaMappingsReader; | ||
| 10 | import cuchaz.enigma.translation.mapping.serde.tinyv2.TinyV2Writer; | ||
| 11 | import cuchaz.enigma.translation.mapping.tree.EntryTree; | ||
| 12 | |||
| 13 | public final class TestV2Main { | ||
| 14 | public static void main(String... args) throws Exception { | ||
| 15 | Path path = Paths.get(TestV2Main.class.getResource("/tinyV2InnerClasses/").toURI()); | ||
| 16 | |||
| 17 | MappingSaveParameters parameters = new MappingSaveParameters(MappingFileNameFormat.BY_DEOBF); | ||
| 18 | |||
| 19 | EntryTree<EntryMapping> tree = EnigmaMappingsReader.DIRECTORY.read(path, ProgressListener.none(), parameters); | ||
| 20 | |||
| 21 | new TinyV2Writer("obf", "deobf").write(tree, Paths.get("currentYarn.tiny"), ProgressListener.none(), parameters); | ||
| 22 | } | ||
| 23 | } | ||
diff --git a/enigma/src/test/java/cuchaz/enigma/translation/mapping/serde/recaf/TestRecaf.java b/enigma/src/test/java/cuchaz/enigma/translation/mapping/serde/recaf/TestRecaf.java deleted file mode 100644 index 5f3e47c..0000000 --- a/enigma/src/test/java/cuchaz/enigma/translation/mapping/serde/recaf/TestRecaf.java +++ /dev/null | |||
| @@ -1,45 +0,0 @@ | |||
| 1 | package cuchaz.enigma.translation.mapping.serde.recaf; | ||
| 2 | |||
| 3 | import static org.junit.Assert.assertEquals; | ||
| 4 | |||
| 5 | import java.io.InputStream; | ||
| 6 | import java.nio.charset.StandardCharsets; | ||
| 7 | import java.nio.file.FileSystem; | ||
| 8 | import java.nio.file.Files; | ||
| 9 | import java.nio.file.Path; | ||
| 10 | import java.util.HashSet; | ||
| 11 | import java.util.Set; | ||
| 12 | |||
| 13 | import com.google.common.jimfs.Jimfs; | ||
| 14 | import org.junit.Test; | ||
| 15 | |||
| 16 | import cuchaz.enigma.ProgressListener; | ||
| 17 | import cuchaz.enigma.translation.mapping.EntryMapping; | ||
| 18 | import cuchaz.enigma.translation.mapping.tree.EntryTree; | ||
| 19 | |||
| 20 | public class TestRecaf { | ||
| 21 | @Test | ||
| 22 | public void testIntegrity() throws Exception { | ||
| 23 | Set<String> contents; | ||
| 24 | |||
| 25 | try (InputStream in = getClass().getResourceAsStream("/recaf.mappings")) { | ||
| 26 | contents = Set.of(new String(in.readAllBytes(), StandardCharsets.UTF_8).split("\\R")); | ||
| 27 | } | ||
| 28 | |||
| 29 | try (FileSystem fs = Jimfs.newFileSystem()) { | ||
| 30 | Path path = fs.getPath("recaf.mappings"); | ||
| 31 | Files.writeString(path, String.join("\n", contents)); | ||
| 32 | |||
| 33 | RecafMappingsWriter writer = RecafMappingsWriter.INSTANCE; | ||
| 34 | RecafMappingsReader reader = RecafMappingsReader.INSTANCE; | ||
| 35 | |||
| 36 | EntryTree<EntryMapping> mappings = reader.read(path, ProgressListener.none(), null); | ||
| 37 | writer.write(mappings, path, ProgressListener.none(), null); | ||
| 38 | |||
| 39 | reader.read(path, ProgressListener.none(), null); | ||
| 40 | Set<String> newContents = new HashSet<>(Files.readAllLines(path)); | ||
| 41 | |||
| 42 | assertEquals(contents, newContents); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | } | ||
diff --git a/enigma/src/test/resources/comments/test.mapping b/enigma/src/test/resources/comments/test.mapping deleted file mode 100644 index d134558..0000000 --- a/enigma/src/test/resources/comments/test.mapping +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | CLASS net/minecraft/class_1158 net/minecraft/util/math/Quaternion | ||
| 2 | COMMENT it circel | ||
| 3 | COMMENT next line | ||
| 4 | FIELD field_21493 IDENTITY Lnet/minecraft/class_1158; | ||
| 5 | COMMENT moar comment thing | ||
| 6 | COMMENT near field | ||
| 7 | METHOD foo bar (FFFF)V | ||
| 8 | COMMENT method comment | ||
| 9 | COMMENT second line | ||
| 10 | COMMENT third line | ||
| 11 | ARG 1 b | ||
| 12 | COMMENT arg comment | ||
| 13 | CLASS old new | ||
| 14 | COMMENT inner comment | ||
| 15 | FIELD field_19263 iterator Lnet/minecraft/class_3980; | ||
| 16 | METHOD tryAdvance (Ljava/util/function/Consumer;)Z | ||
| 17 | ARG 1 consumer | ||
| 18 | COMMENT very inner comment \ No newline at end of file | ||
diff --git a/enigma/src/test/resources/recaf.mappings b/enigma/src/test/resources/recaf.mappings deleted file mode 100644 index 479099e..0000000 --- a/enigma/src/test/resources/recaf.mappings +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | a testClass | ||
| 2 | a.a Z testField | ||
| 3 | a.a()V testMethod0 | ||
| 4 | a.a(Z)V testMethod1 | ||
| 5 | a.b()V testMethod2 | ||
| 6 | a/a testInnerClass | ||
| 7 | a/a.a Z testInnerField | ||
| 8 | a/a.a()V testInnerMethod0 | ||
| 9 | a/a.a(Z)V testInnerMethod1 | ||
| 10 | a/a.b()V testInnerMethod2 | ||
diff --git a/enigma/src/test/resources/tinyV2InnerClasses/c.mapping b/enigma/src/test/resources/tinyV2InnerClasses/c.mapping deleted file mode 100644 index f9b0442..0000000 --- a/enigma/src/test/resources/tinyV2InnerClasses/c.mapping +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | CLASS c | ||
| 2 | CLASS a Kid | ||
diff --git a/enigma/src/test/resources/tinyV2InnerClasses/cuchaz/enigma/Dad.mapping b/enigma/src/test/resources/tinyV2InnerClasses/cuchaz/enigma/Dad.mapping deleted file mode 100644 index 8d43ba9..0000000 --- a/enigma/src/test/resources/tinyV2InnerClasses/cuchaz/enigma/Dad.mapping +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | CLASS f cuchaz/enigma/Dad | ||
| 2 | CLASS a One | ||
| 3 | CLASS a Two | ||
| 4 | CLASS a | ||
| 5 | FIELD a value I | ||