From 19a90068371ffcdc1ee845123be6880143009f3a Mon Sep 17 00:00:00 2001 From: Brian Pellin Date: Sun, 22 Feb 2009 14:38:49 -0600 Subject: [PATCH] Add tests project --- .gitignore | 1 + .project | 7 + bin/.gitignore | 1 + build.xml | 313 ++++++++++++++++++ libs/.gitignore | 1 + tests/.classpath | 8 + tests/.gitignore | 1 + tests/.project | 33 ++ tests/AndroidManifest.xml | 11 + tests/bin/.gitignore | 1 + tests/res/drawable/icon.png | Bin 0 -> 3180 bytes tests/res/layout/main.xml | 12 + tests/res/values/strings.xml | 5 + .../src/com/android/keepass/tests/.gitignore | 1 + .../com/android/keepass/tests/AllTests.java | 53 +++ .../com/android/keepass/tests/TypesTest.java | 34 ++ 16 files changed, 482 insertions(+) create mode 100644 .gitignore create mode 100644 bin/.gitignore create mode 100644 build.xml create mode 100644 libs/.gitignore create mode 100644 tests/.classpath create mode 100644 tests/.gitignore create mode 100644 tests/.project create mode 100644 tests/AndroidManifest.xml create mode 100644 tests/bin/.gitignore create mode 100644 tests/res/drawable/icon.png create mode 100644 tests/res/layout/main.xml create mode 100644 tests/res/values/strings.xml create mode 100644 tests/src/com/android/keepass/tests/.gitignore create mode 100644 tests/src/com/android/keepass/tests/AllTests.java create mode 100644 tests/src/com/android/keepass/tests/TypesTest.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..56fb545fa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build.properties diff --git a/.project b/.project index 00d97a63a..7c0afa57a 100644 --- a/.project +++ b/.project @@ -30,4 +30,11 @@ com.android.ide.eclipse.adt.AndroidNature org.eclipse.jdt.core.javanature + + + build.xml + 1 + /home/bpellin/src/workspace/KeePassDroid/build.xml + + diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 000000000..edfcb72f1 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1 @@ +[^.] diff --git a/build.xml b/build.xml new file mode 100644 index 000000000..ba4bbe329 --- /dev/null +++ b/build.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Creating output directories if needed... + + + + + + + Generating R.java / Manifest.java from the resources... + + + + + + + + + + + + + + + + + Compiling aidl files into Java classes... + + + + + + + + + + + + + + + + + + + + + Converting compiled files and external libraries into ${outdir}/${dex-file}... + + + + + + + + + + + Packaging resources and assets... + + + + + + + + + + + + + + + + + + + Packaging resources... + + + + + + + + + + + + + + + + + + + + + + + + + + Packaging ${out-debug-package}, and signing it with a debug key... + + + + + + + + + + + + + + + + + + Packaging ${out-unsigned-package} for release... + + + + + + + + + + + + + + + It will need to be signed with jarsigner before being published. + + + + + Installing ${out-debug-package} onto default emulator... + + + + + + + + + Installing ${out-debug-package} onto default emulator... + + + + + + + + + + + Uninstalling ${application-package} from the default emulator... + + + + + + + + + Building and installing tests.. + + + + + + + + + + + + diff --git a/libs/.gitignore b/libs/.gitignore new file mode 100644 index 000000000..edfcb72f1 --- /dev/null +++ b/libs/.gitignore @@ -0,0 +1 @@ +[^.] diff --git a/tests/.classpath b/tests/.classpath new file mode 100644 index 000000000..f7a656193 --- /dev/null +++ b/tests/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 000000000..56fb545fa --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +build.properties diff --git a/tests/.project b/tests/.project new file mode 100644 index 000000000..bed5ba0be --- /dev/null +++ b/tests/.project @@ -0,0 +1,33 @@ + + + KeePassDroidTests + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml new file mode 100644 index 000000000..64d795e07 --- /dev/null +++ b/tests/AndroidManifest.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/tests/bin/.gitignore b/tests/bin/.gitignore new file mode 100644 index 000000000..edfcb72f1 --- /dev/null +++ b/tests/bin/.gitignore @@ -0,0 +1 @@ +[^.] diff --git a/tests/res/drawable/icon.png b/tests/res/drawable/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..75024841d327c4fbaefef7c8e9c8d0e892895f93 GIT binary patch literal 3180 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4mJh`hH$2z?FV#2CbnOEiitV~+c6}DFE)<35y0+T;*@LurPQt#w6 zXWBILn+ZL#$35Rz)Y+F^fB&YcylS8E_jBj^t|!z9IK1lZdw=Hc%$uL*ex7@LZg1i& zwc3g8?fV`){?B0dI`KvG@A^NJCnQSre@bjv+MoPbnJ{RU^^L zlDay(4I4I0C}d=2Y$%&%tn-lB|KHZX#jFp0ipOz%tO?X-IB?~O$Y~W{Ki^A-{y1&> zeTawmz_|h;?!(FcTi^26hcV2mw3A%5Zqe-Wdm7!39}An986Ny>!OO?XJ>%ue%vp1` zFznpBq~_?oMJrhQ7}m{iJ@3m{_F*OS{I2IUK7uuxPuItKU(A?tDDm`!g#jJg>PolE zxGy&BIy?B>%@fz+XlL80Y~Cx@uI&{Q7k_%#`u(2Ec6=;MN(^m==Jx)@#h)K7wb17OV9|dp ziAN=kF=>6GkDt#eo!8!+%P+^+ow3;ce&%xiZMAFILl#_W-DjtzufMomuByY$&22^h zd1-0smm81E2|t~ae0NtV6Pxjpee0%u`t<3|`NF-dT4~MQ$A!Obe7bfgDEBf;lwe{b0s#oto= z=ijrtyYnU=^-%GWFR9ZguB+R}`)t|lyh+8j3|w8#nMeBAo_?EA{h|C~npx17AFD$) ze@{;_x~kwkH}=b^FFc}RqK0qP!o-iva%yxi44pFlw9>O(w{*p>KYylih|BTZw=WlT zKHJ#W>x!;9JALP(MNT_z-?{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???V+*!6lYyMaKoL|Xrzvq2qT;=pskMbVve{B<=*1mUVhGdi|UnE%{h8|^{4p;o7g^1FE?qkAbk8IA&bPO>2Zx7WpC5X7>Yi2mudFx8TIKv<(#ccl z5mUBLQr!33DSoaWE?g7Nd%&HSZDYG={*&b`(}g;}t>xtn+;!@4 dJrfVZ&8teM@_#i + + + diff --git a/tests/res/values/strings.xml b/tests/res/values/strings.xml new file mode 100644 index 000000000..f03d01b2f --- /dev/null +++ b/tests/res/values/strings.xml @@ -0,0 +1,5 @@ + + + Hello World, Dummy + Dummy + diff --git a/tests/src/com/android/keepass/tests/.gitignore b/tests/src/com/android/keepass/tests/.gitignore new file mode 100644 index 000000000..48c029696 --- /dev/null +++ b/tests/src/com/android/keepass/tests/.gitignore @@ -0,0 +1 @@ +R.java diff --git a/tests/src/com/android/keepass/tests/AllTests.java b/tests/src/com/android/keepass/tests/AllTests.java new file mode 100644 index 000000000..90f475019 --- /dev/null +++ b/tests/src/com/android/keepass/tests/AllTests.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * 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 com.android.keepass.tests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import android.test.suitebuilder.TestSuiteBuilder; + +/** + * A test suite containing all tests for ApiDemos. + * + * To run all suites found in this apk: + * $ adb shell am instrument -w \ + * com.example.android.apis.tests/android.test.InstrumentationTestRunner + * + * To run just this suite from the command line: + * $ adb shell am instrument -w \ + * -e class com.example.android.apis.AllTests \ + * com.example.android.apis.tests/android.test.InstrumentationTestRunner + * + * To run an individual test case, e.g. {@link com.example.android.apis.os.MorseCodeConverterTest}: + * $ adb shell am instrument -w \ + * -e class com.example.android.apis.os.MorseCodeConverterTest \ + * com.example.android.apis.tests/android.test.InstrumentationTestRunner + * + * To run an individual test, e.g. {@link com.example.android.apis.os.MorseCodeConverterTest#testCharacterS()}: + * $ adb shell am instrument -w \ + * -e class com.example.android.apis.os.MorseCodeConverterTest#testCharacterS \ + * com.example.android.apis.tests/android.test.InstrumentationTestRunner + */ +public class AllTests extends TestSuite { + + public static Test suite() { + return new TestSuiteBuilder(AllTests.class) + .includeAllPackagesUnderHere() + .build(); + } +} diff --git a/tests/src/com/android/keepass/tests/TypesTest.java b/tests/src/com/android/keepass/tests/TypesTest.java new file mode 100644 index 000000000..f01224209 --- /dev/null +++ b/tests/src/com/android/keepass/tests/TypesTest.java @@ -0,0 +1,34 @@ +package com.android.keepass.tests; + +import junit.framework.TestCase; +import org.phoneid.keepassj2me.Types; +import static org.junit.Assert.*; + +public class TypesTest extends TestCase { + + public void testReadWriteInt() { + byte[] orig = new byte[8]; + byte[] dest = new byte[8]; + + for (int i = 0; i < 4; i++ ) { + orig[i] = 0; + } + + for (int i = 4; i < 8; i++ ) { + orig[4] = Byte.MAX_VALUE; + + } + + int one = Types.readInt(orig, 0); + int two = Types.readInt(orig, 4); + + Types.writeInt(one, dest, 0); + Types.writeInt(two, dest, 4); + + assertArrayEquals(orig, dest); + + } + + +} + \ No newline at end of file