Skip to content

Commit

Permalink
Add tests for cases with a lot of strings and with long strings
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelRocks committed Jun 12, 2018
1 parent 01ee3d6 commit cacb1eb
Show file tree
Hide file tree
Showing 16 changed files with 58,693 additions and 0 deletions.
38 changes: 38 additions & 0 deletions processor-tests/all-chars-string/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
buildscript {
dependencies {
classpath "io.michaelrocks:paranoid-gradle-plugin:$version"
}
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.michaelrocks.paranoid'

android {
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion

defaultConfig {
applicationId "io.michaelrocks.paranoid.processor.allcharsstring"
minSdkVersion androidMinSdkVersion
targetSdkVersion androidTargetSdkVersion
versionCode 1
versionName version

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
}
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

androidTestImplementation "com.android.support.test:runner:$runnerVersion"
androidTestImplementation "com.android.support.test:rules:$runnerVersion"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espressoVersion"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2018 Michael Rozumyanskiy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.michaelrocks.paranoid.processor.allcharsstring;

import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class AllCharsStringTest {
@Test
public void testAllCharsString() {
final String string = AllCharString.INSTANCE.getString();
assertTrue(string.length() == 0x10000);

for (int i = 0; i < string.length(); ++i) {
assertEquals(i, string.charAt(i));
}
}
}
17 changes: 17 additions & 0 deletions processor-tests/all-chars-string/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="io.michaelrocks.paranoid.processor.allcharsstring">

<application>

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>

</manifest>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2018 Michael Rozumyanskiy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.michaelrocks.paranoid.processor.allcharsstring

import android.app.Activity

class MainActivity : Activity()
38 changes: 38 additions & 0 deletions processor-tests/loads-of-strings/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
buildscript {
dependencies {
classpath "io.michaelrocks:paranoid-gradle-plugin:$version"
}
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.michaelrocks.paranoid'

android {
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion

defaultConfig {
applicationId "io.michaelrocks.paranoid.processor.loadsofstrings"
minSdkVersion androidMinSdkVersion
targetSdkVersion androidTargetSdkVersion
versionCode 1
versionName version

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
}
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

androidTestImplementation "com.android.support.test:runner:$runnerVersion"
androidTestImplementation "com.android.support.test:rules:$runnerVersion"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espressoVersion"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright 2018 Michael Rozumyanskiy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.michaelrocks.paranoid.processor.loadsofstrings;

import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;


import static org.junit.Assert.assertFalse;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class LoadsOfStringsTest {
@Test
public void testLoadsOfStrings() {
assertFalse(LoadsOfStrings.A.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.B.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.C.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.D.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.E.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.F.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.G.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.H.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.I.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.J.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.K.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.L.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.M.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.N.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.O.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.P.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.Q.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.R.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.S1.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.S2.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.T.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.U.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.V.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.W.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.X.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.Y.INSTANCE.getStrings().length == 0);
assertFalse(LoadsOfStrings.Z.INSTANCE.getStrings().length == 0);
}
}
17 changes: 17 additions & 0 deletions processor-tests/loads-of-strings/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="io.michaelrocks.paranoid.processor.loadsofstrings">

<application>

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>

</manifest>
Loading

0 comments on commit cacb1eb

Please sign in to comment.