diff options
| author | 2015-01-13 23:25:04 -0500 | |
|---|---|---|
| committer | 2015-01-13 23:25:04 -0500 | |
| commit | 959cb5fd4f9586ec3bd265b452fe25fe1db82e3f (patch) | |
| tree | bdd8a2c52c2fe053ba3460614bde8542e5378dbe /test/cuchaz/enigma/TestTokensConstructors.java | |
| parent | got rid of gradle in favor of ivy+ssjb (diff) | |
| download | enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.tar.gz enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.tar.xz enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.zip | |
source format change
don't hate me too much if you were planning a big merge. =P
Diffstat (limited to 'test/cuchaz/enigma/TestTokensConstructors.java')
| -rw-r--r-- | test/cuchaz/enigma/TestTokensConstructors.java | 137 |
1 files changed, 62 insertions, 75 deletions
diff --git a/test/cuchaz/enigma/TestTokensConstructors.java b/test/cuchaz/enigma/TestTokensConstructors.java index 2409153..f805a65 100644 --- a/test/cuchaz/enigma/TestTokensConstructors.java +++ b/test/cuchaz/enigma/TestTokensConstructors.java | |||
| @@ -24,129 +24,116 @@ import org.junit.Test; | |||
| 24 | 24 | ||
| 25 | import cuchaz.enigma.mapping.BehaviorEntry; | 25 | import cuchaz.enigma.mapping.BehaviorEntry; |
| 26 | 26 | ||
| 27 | public class TestTokensConstructors extends TokenChecker | 27 | public class TestTokensConstructors extends TokenChecker { |
| 28 | { | 28 | |
| 29 | public TestTokensConstructors( ) | 29 | public TestTokensConstructors() throws Exception { |
| 30 | throws Exception | 30 | super(new File("build/libs/testConstructors.obf.jar")); |
| 31 | { | ||
| 32 | super( new File( "build/libs/testConstructors.obf.jar" ) ); | ||
| 33 | } | 31 | } |
| 34 | 32 | ||
| 35 | @Test | 33 | @Test |
| 36 | public void baseDeclarations( ) | 34 | public void baseDeclarations() { |
| 37 | { | 35 | assertThat(getDeclarationToken(newConstructor("none/a", "()V")), is("a")); |
| 38 | assertThat( getDeclarationToken( newConstructor( "none/a", "()V" ) ), is( "a" ) ); | 36 | assertThat(getDeclarationToken(newConstructor("none/a", "(I)V")), is("a")); |
| 39 | assertThat( getDeclarationToken( newConstructor( "none/a", "(I)V" ) ), is( "a" ) ); | ||
| 40 | } | 37 | } |
| 41 | 38 | ||
| 42 | @Test | 39 | @Test |
| 43 | public void subDeclarations( ) | 40 | public void subDeclarations() { |
| 44 | { | 41 | assertThat(getDeclarationToken(newConstructor("none/d", "()V")), is("d")); |
| 45 | assertThat( getDeclarationToken( newConstructor( "none/d", "()V" ) ), is( "d" ) ); | 42 | assertThat(getDeclarationToken(newConstructor("none/d", "(I)V")), is("d")); |
| 46 | assertThat( getDeclarationToken( newConstructor( "none/d", "(I)V" ) ), is( "d" ) ); | 43 | assertThat(getDeclarationToken(newConstructor("none/d", "(II)V")), is("d")); |
| 47 | assertThat( getDeclarationToken( newConstructor( "none/d", "(II)V" ) ), is( "d" ) ); | 44 | assertThat(getDeclarationToken(newConstructor("none/d", "(III)V")), is("d")); |
| 48 | assertThat( getDeclarationToken( newConstructor( "none/d", "(III)V" ) ), is( "d" ) ); | ||
| 49 | } | 45 | } |
| 50 | 46 | ||
| 51 | @Test | 47 | @Test |
| 52 | public void subsubDeclarations( ) | 48 | public void subsubDeclarations() { |
| 53 | { | 49 | assertThat(getDeclarationToken(newConstructor("none/e", "(I)V")), is("e")); |
| 54 | assertThat( getDeclarationToken( newConstructor( "none/e", "(I)V" ) ), is( "e" ) ); | ||
| 55 | } | 50 | } |
| 56 | 51 | ||
| 57 | @Test | 52 | @Test |
| 58 | public void defaultDeclarations( ) | 53 | public void defaultDeclarations() { |
| 59 | { | 54 | assertThat(getDeclarationToken(newConstructor("none/c", "()V")), nullValue()); |
| 60 | assertThat( getDeclarationToken( newConstructor( "none/c", "()V" ) ), nullValue() ); | ||
| 61 | } | 55 | } |
| 62 | 56 | ||
| 63 | @Test | 57 | @Test |
| 64 | public void baseDefaultReferences( ) | 58 | public void baseDefaultReferences() { |
| 65 | { | 59 | BehaviorEntry source = newConstructor("none/a", "()V"); |
| 66 | BehaviorEntry source = newConstructor( "none/a", "()V" ); | ||
| 67 | assertThat( | 60 | assertThat( |
| 68 | getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "a", "()V" ) ), | 61 | getReferenceTokens(newBehaviorReferenceByMethod(source, "none/b", "a", "()V")), |
| 69 | containsInAnyOrder( "a" ) | 62 | containsInAnyOrder("a") |
| 70 | ); | 63 | ); |
| 71 | assertThat( | 64 | assertThat( |
| 72 | getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/d", "()V" ) ), | 65 | getReferenceTokens(newBehaviorReferenceByConstructor(source, "none/d", "()V")), |
| 73 | containsInAnyOrder( "super" ) // implicit call, decompiled to "super" | 66 | containsInAnyOrder("super") // implicit call, decompiled to "super" |
| 74 | ); | 67 | ); |
| 75 | assertThat( | 68 | assertThat( |
| 76 | getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/d", "(III)V" ) ), | 69 | getReferenceTokens(newBehaviorReferenceByConstructor(source, "none/d", "(III)V")), |
| 77 | containsInAnyOrder( "super" ) // implicit call, decompiled to "super" | 70 | containsInAnyOrder("super") // implicit call, decompiled to "super" |
| 78 | ); | 71 | ); |
| 79 | } | 72 | } |
| 80 | 73 | ||
| 81 | @Test | 74 | @Test |
| 82 | public void baseIntReferences( ) | 75 | public void baseIntReferences() { |
| 83 | { | 76 | BehaviorEntry source = newConstructor("none/a", "(I)V"); |
| 84 | BehaviorEntry source = newConstructor( "none/a", "(I)V" ); | ||
| 85 | assertThat( | 77 | assertThat( |
| 86 | getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "b", "()V" ) ), | 78 | getReferenceTokens(newBehaviorReferenceByMethod(source, "none/b", "b", "()V")), |
| 87 | containsInAnyOrder( "a" ) | 79 | containsInAnyOrder("a") |
| 88 | ); | 80 | ); |
| 89 | } | 81 | } |
| 90 | 82 | ||
| 91 | @Test | 83 | @Test |
| 92 | public void subDefaultReferences( ) | 84 | public void subDefaultReferences() { |
| 93 | { | 85 | BehaviorEntry source = newConstructor("none/d", "()V"); |
| 94 | BehaviorEntry source = newConstructor( "none/d", "()V" ); | ||
| 95 | assertThat( | 86 | assertThat( |
| 96 | getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "c", "()V" ) ), | 87 | getReferenceTokens(newBehaviorReferenceByMethod(source, "none/b", "c", "()V")), |
| 97 | containsInAnyOrder( "d" ) | 88 | containsInAnyOrder("d") |
| 98 | ); | 89 | ); |
| 99 | assertThat( | 90 | assertThat( |
| 100 | getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/d", "(I)V" ) ), | 91 | getReferenceTokens(newBehaviorReferenceByConstructor(source, "none/d", "(I)V")), |
| 101 | containsInAnyOrder( "this" ) | 92 | containsInAnyOrder("this") |
| 102 | ); | 93 | ); |
| 103 | } | 94 | } |
| 104 | 95 | ||
| 105 | @Test | 96 | @Test |
| 106 | public void subIntReferences( ) | 97 | public void subIntReferences() { |
| 107 | { | 98 | BehaviorEntry source = newConstructor("none/d", "(I)V"); |
| 108 | BehaviorEntry source = newConstructor( "none/d", "(I)V" ); | 99 | assertThat(getReferenceTokens( |
| 109 | assertThat( | 100 | newBehaviorReferenceByMethod(source, "none/b", "d", "()V")), |
| 110 | getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "d", "()V" ) ), | 101 | containsInAnyOrder("d") |
| 111 | containsInAnyOrder( "d" ) | ||
| 112 | ); | 102 | ); |
| 113 | assertThat( | 103 | assertThat(getReferenceTokens( |
| 114 | getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/d", "(II)V" ) ), | 104 | newBehaviorReferenceByConstructor(source, "none/d", "(II)V")), |
| 115 | containsInAnyOrder( "this" ) | 105 | containsInAnyOrder("this") |
| 116 | ); | 106 | ); |
| 117 | assertThat( | 107 | assertThat(getReferenceTokens( |
| 118 | getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/e", "(I)V" ) ), | 108 | newBehaviorReferenceByConstructor(source, "none/e", "(I)V")), |
| 119 | containsInAnyOrder( "super" ) | 109 | containsInAnyOrder("super") |
| 120 | ); | 110 | ); |
| 121 | } | 111 | } |
| 122 | 112 | ||
| 123 | @Test | 113 | @Test |
| 124 | public void subIntIntReferences( ) | 114 | public void subIntIntReferences() { |
| 125 | { | 115 | BehaviorEntry source = newConstructor("none/d", "(II)V"); |
| 126 | BehaviorEntry source = newConstructor( "none/d", "(II)V" ); | ||
| 127 | assertThat( | 116 | assertThat( |
| 128 | getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "e", "()V" ) ), | 117 | getReferenceTokens(newBehaviorReferenceByMethod(source, "none/b", "e", "()V")), |
| 129 | containsInAnyOrder( "d" ) | 118 | containsInAnyOrder("d") |
| 130 | ); | 119 | ); |
| 131 | } | 120 | } |
| 132 | 121 | ||
| 133 | @Test | 122 | @Test |
| 134 | public void subsubIntReferences( ) | 123 | public void subsubIntReferences() { |
| 135 | { | 124 | BehaviorEntry source = newConstructor("none/e", "(I)V"); |
| 136 | BehaviorEntry source = newConstructor( "none/e", "(I)V" ); | ||
| 137 | assertThat( | 125 | assertThat( |
| 138 | getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "f", "()V" ) ), | 126 | getReferenceTokens(newBehaviorReferenceByMethod(source, "none/b", "f", "()V")), |
| 139 | containsInAnyOrder( "e" ) | 127 | containsInAnyOrder("e") |
| 140 | ); | 128 | ); |
| 141 | } | 129 | } |
| 142 | 130 | ||
| 143 | @Test | 131 | @Test |
| 144 | public void defaultConstructableReferences( ) | 132 | public void defaultConstructableReferences() { |
| 145 | { | 133 | BehaviorEntry source = newConstructor("none/c", "()V"); |
| 146 | BehaviorEntry source = newConstructor( "none/c", "()V" ); | ||
| 147 | assertThat( | 134 | assertThat( |
| 148 | getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "g", "()V" ) ), | 135 | getReferenceTokens(newBehaviorReferenceByMethod(source, "none/b", "g", "()V")), |
| 149 | containsInAnyOrder( "c" ) | 136 | containsInAnyOrder("c") |
| 150 | ); | 137 | ); |
| 151 | } | 138 | } |
| 152 | } | 139 | } |