diff options
author | Yohann Roussel <yroussel@google.com> | 2014-03-19 16:25:37 +0100 |
---|---|---|
committer | Yohann Roussel <yroussel@google.com> | 2014-03-20 15:13:33 +0100 |
commit | 4eceb95409e844fdc33c9c706e1dc307bfd40303 (patch) | |
tree | ee9f4f3fc79f757c79081c336bce4f1782c6ccd8 /jack-tests/tests/com/android/jack/opcodes | |
parent | 3d2402901b1a6462e2cf47a6fd09711f327961c3 (diff) | |
download | toolchain_jack-4eceb95409e844fdc33c9c706e1dc307bfd40303.zip toolchain_jack-4eceb95409e844fdc33c9c706e1dc307bfd40303.tar.gz toolchain_jack-4eceb95409e844fdc33c9c706e1dc307bfd40303.tar.bz2 |
Initial Jack import.
Change-Id: I953cf0a520195a7187d791b2885848ad0d5a9b43
Diffstat (limited to 'jack-tests/tests/com/android/jack/opcodes')
533 files changed, 24221 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/opcodes/add_double/Test_add_double.java b/jack-tests/tests/com/android/jack/opcodes/add_double/Test_add_double.java new file mode 100644 index 0000000..3362d0a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_double/Test_add_double.java @@ -0,0 +1,144 @@ +/* + * 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.jack.opcodes.add_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.add_double.jm.T_add_double_1; +import com.android.jack.opcodes.add_double.jm.T_add_double_3; +import com.android.jack.opcodes.add_double.jm.T_add_double_4; + + +public class Test_add_double extends DxTestCase { + + /** + * @title Arguments = 2.7d, 3.14d + */ + public void testN1() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(5.84d, t.run(2.7d, 3.14d)); + } + + /** + * @title Arguments = 0, -3.14d + */ + public void testN2() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(-3.14d, t.run(0, -3.14d)); + } + + /** + * @title Arguments = -3.14d, -2.7d + */ + public void testN3() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(-5.84d, t.run(-3.14d, -2.7d)); + } + + /** + * @title Arguments = -3.14d, -2.7d + */ + public void testN4() { + T_add_double_3 t = new T_add_double_3(); + assertEquals(-5.84d, t.run(-3.14d, -2.7d)); + } + + /** + * @title Arguments = -3.14d, -2.7d + */ + public void testN5() { + T_add_double_4 t = new T_add_double_4(); + assertEquals(-5.84d, t.run(-3.14d, -2.7d)); + } + + /** + * @title Arguments = Double.MAX_VALUE, Double.NaN + */ + public void testB1() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(Double.NaN, t.run(Double.MAX_VALUE, Double.NaN)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, + * Double.NEGATIVE_INFINITY + */ + public void testB2() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(Double.NaN, t.run(Double.POSITIVE_INFINITY, + Double.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, + * Double.POSITIVE_INFINITY + */ + public void testB3() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(Double.POSITIVE_INFINITY, t.run(Double.POSITIVE_INFINITY, + Double.POSITIVE_INFINITY)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, -2.7d + */ + public void testB4() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(Double.POSITIVE_INFINITY, t.run(Double.POSITIVE_INFINITY, + -2.7d)); + } + + /** + * @title Arguments = +0, -0 + */ + public void testB5() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(+0d, t.run(+0d, -0d)); + } + + /** + * @title Arguments = -0d, -0d + */ + public void testB6() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(-0d, t.run(-0d, -0d)); + } + + /** + * @title Arguments = -2.7d, 2.7d + */ + public void testB7() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(+0d, t.run(-2.7d, 2.7d)); + } + + /** + * @title Arguments = Double.MAX_VALUE, Double.MAX_VALUE + */ + public void testB8() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(Double.POSITIVE_INFINITY, t.run(Double.MAX_VALUE, + Double.MAX_VALUE)); + } + + /** + * @title Arguments = Double.MIN_VALUE, -4.9E-324 + */ + public void testB9() { + T_add_double_1 t = new T_add_double_1(); + assertEquals(0d, t.run(Double.MIN_VALUE, -4.9E-324)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_double/jm/T_add_double_1.java b/jack-tests/tests/com/android/jack/opcodes/add_double/jm/T_add_double_1.java new file mode 100644 index 0000000..3074e0d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_double/jm/T_add_double_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_double.jm; + +public class T_add_double_1 { + + public double run(double a, double b) { + return a+b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_double/jm/T_add_double_3.java b/jack-tests/tests/com/android/jack/opcodes/add_double/jm/T_add_double_3.java new file mode 100644 index 0000000..8592257 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_double/jm/T_add_double_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_double.jm; + +public class T_add_double_3 { + + public double run(double a, double b) { + return a+(double)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_double/jm/T_add_double_4.java b/jack-tests/tests/com/android/jack/opcodes/add_double/jm/T_add_double_4.java new file mode 100644 index 0000000..d55f4b6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_double/jm/T_add_double_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_double.jm; + +public class T_add_double_4 { + + public double run(double a, double b) { + return (double)a+b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_float/Test_add_float.java b/jack-tests/tests/com/android/jack/opcodes/add_float/Test_add_float.java new file mode 100644 index 0000000..6011775 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_float/Test_add_float.java @@ -0,0 +1,146 @@ +/* + * 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.jack.opcodes.add_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.add_float.jm.T_add_float_1; +import com.android.jack.opcodes.add_float.jm.T_add_float_3; +import com.android.jack.opcodes.add_float.jm.T_add_float_4; + + +public class Test_add_float extends DxTestCase { + + /** + * @title Arguments = 2.7f, 3.14f + */ + public void testN1() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(5.84f, t.run(2.7f, 3.14f)); + } + + /** + * @title Arguments = 0, -3.14f + */ + public void testN2() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(-3.14f, t.run(0, -3.14f)); + } + + /** + * @title Arguments = -3.14f, -2.7f + */ + public void testN3() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(-5.84f, t.run(-3.14f, -2.7f)); + } + + /** + * @title Arguments = -3.14f, -2.7f + */ + public void testN4() { + T_add_float_3 t = new T_add_float_3(); + assertEquals(-5.84f, t.run(-3.14f, -2.7f)); + } + + /** + * @title Arguments = -314l, -270f + */ + public void testN5() { + T_add_float_4 t = new T_add_float_4(); + assertEquals(-584f, t.run(-314l, -270f)); + } + + + + /** + * @title Arguments = Float.MAX_VALUE, Float.NaN + */ + public void testB1() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(3.3028235E38f, 0.11E38f)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, + * Float.NEGATIVE_INFINITY + */ + public void testB2() { + T_add_float_1 t = new T_add_float_1(); + assertTrue(Float.isNaN(t.run(Float.POSITIVE_INFINITY, + Float.NEGATIVE_INFINITY))); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, + * Float.POSITIVE_INFINITY + */ + public void testB3() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(Float.POSITIVE_INFINITY, + Float.POSITIVE_INFINITY)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, -2.7f + */ + public void testB4() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(Float.POSITIVE_INFINITY, + -2.7f)); + } + + /** + * @title Arguments = +0, -0f + */ + public void testB5() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(+0f, t.run(+0f, -0f)); + } + + /** + * @title Arguments = -0f, -0f + */ + public void testB6() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(-0f, t.run(-0f, -0f)); + } + + /** + * @title Arguments = -2.7f, 2.7f + */ + public void testB7() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(+0f, t.run(-2.7f, 2.7f)); + } + + /** + * @title Arguments = Float.MAX_VALUE, Float.MAX_VALUE + */ + public void testB8() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(Float.MAX_VALUE, + Float.MAX_VALUE)); + } + + /** + * @title Arguments = Float.MIN_VALUE, -1.4E-45f + */ + public void testB9() { + T_add_float_1 t = new T_add_float_1(); + assertEquals(0f, t.run(Float.MIN_VALUE, -1.4E-45f)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_float/jm/T_add_float_1.java b/jack-tests/tests/com/android/jack/opcodes/add_float/jm/T_add_float_1.java new file mode 100644 index 0000000..0e63bcb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_float/jm/T_add_float_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_float.jm; + +public class T_add_float_1 { + + public float run(float a, float b) { + return a+b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_float/jm/T_add_float_3.java b/jack-tests/tests/com/android/jack/opcodes/add_float/jm/T_add_float_3.java new file mode 100644 index 0000000..56938f1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_float/jm/T_add_float_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_float.jm; + +public class T_add_float_3 { + + public float run(float a, double b) { + return a+(float)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_float/jm/T_add_float_4.java b/jack-tests/tests/com/android/jack/opcodes/add_float/jm/T_add_float_4.java new file mode 100644 index 0000000..f247775 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_float/jm/T_add_float_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_float.jm; + +public class T_add_float_4 { + + public float run(long a, float b) { + return (float)a+b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/Test_add_int.java b/jack-tests/tests/com/android/jack/opcodes/add_int/Test_add_int.java new file mode 100644 index 0000000..0969c14 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/Test_add_int.java @@ -0,0 +1,224 @@ +/* + * 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.jack.opcodes.add_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.add_int.jm.T_add_int_1; +import com.android.jack.opcodes.add_int.jm.T_add_int_3; +import com.android.jack.opcodes.add_int.jm.T_add_int_4; +import com.android.jack.opcodes.add_int.jm.T_add_int_5; +import com.android.jack.opcodes.add_int.jm.T_add_int_6; +import com.android.jack.opcodes.add_int.jm.T_add_int_7; +import com.android.jack.opcodes.add_int.jm.T_add_int_8; +import com.android.jack.opcodes.add_int.jm.T_add_int_9; +import com.android.jack.opcodes.add_int.jm.T_add_int_10; + + +public class Test_add_int extends DxTestCase { + + /** + * @title Arguments = 8, 4 + */ + public void testN1() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(12, t.run(8, 4)); + } + + /** + * @title Arguments = 0, 255 + */ + public void testN2() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(255, t.run(0, 255)); + } + + /** + * @title Arguments = 0, -65536 + */ + public void testN3() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(-65536, t.run(0, -65536)); + } + + /** + * @title Arguments = 0, -2147483647 + */ + public void testN4() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(-2147483647, t.run(0, -2147483647)); + } + + /** + * @title Arguments = 0x7ffffffe, 2 + */ + public void testN5() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(-2147483648, t.run(0x7ffffffe, 2)); + } + + /** + * @title Arguments = -1, 1 + */ + public void testN6() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(0, t.run(-1, 1)); + } + + /** + * @title Arguments = -1, 1 + */ + public void testN7() { + T_add_int_3 t = new T_add_int_3(); + assertEquals(0, t.run(-1, 1)); + } + + /** + * @title Arguments = -1, 1 + */ + public void testN8() { + T_add_int_4 t = new T_add_int_4(); + assertEquals(0, t.run(-1, 1)); + } + + /** + * @title Arguments = 0, Integer.MAX_VALUE + */ + public void testB1() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(Integer.MAX_VALUE, t.run(0, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE + */ + public void testB2() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(-2, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, 1 + */ + public void testB3() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(Integer.MIN_VALUE, t.run(Integer.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, 1 + */ + public void testB4() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(-2147483647, t.run(Integer.MIN_VALUE, 1)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(0, t.run(0, 0)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE + */ + public void testB6() { + T_add_int_1 t = new T_add_int_1(); + assertEquals(0, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE)); + } + + /** + * @title Increment by 1 + */ + public void testN1Inc() { + T_add_int_5 t = new T_add_int_5(); + assertEquals(5, t.run(4)); + } + + /** + * @title Increment by -1 + */ + public void testN2Inc() { + T_add_int_6 t = new T_add_int_6(); + assertEquals(3, t.run(4)); + } + + /** + * @title Increment by 63 + */ + public void testN3Inc() { + T_add_int_7 t = new T_add_int_7(); + assertEquals(67, t.run(4)); + } + + /** + * @title Increment by 0 + */ + public void testB1Inc() { + T_add_int_8 t = new T_add_int_8(); + assertEquals(Integer.MAX_VALUE, t.run(Integer.MAX_VALUE)); + } + + /** + * @title Increment by 0 + */ + public void testB2Inc() { + T_add_int_8 t = new T_add_int_8(); + assertEquals(Integer.MIN_VALUE, t.run(Integer.MIN_VALUE)); + } + + /** + * @title Increment by 127 + */ + public void testB3Inc() { + T_add_int_9 t = new T_add_int_9(); + assertEquals(128, t.run(1)); + } + + /** + * @title Increment by 127 + */ + public void testB4Inc() { + T_add_int_9 t = new T_add_int_9(); + assertEquals(126, t.run(-1)); + } + + /** + * @title Increment by 127 + */ + public void testB5Inc() { + T_add_int_9 t = new T_add_int_9(); + assertEquals(-2147483521, t.run(Integer.MIN_VALUE)); + } + + /** + * @title Increment by -128 + */ + public void testB6Inc() { + T_add_int_10 t = new T_add_int_10(); + assertEquals(-127, t.run(1)); + } + + /** + * @title Increment by -128 + */ + public void testB7Inc() { + T_add_int_10 t = new T_add_int_10(); + assertEquals(-128, t.run(0)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_1.java b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_1.java new file mode 100644 index 0000000..ce53188 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_int.jm; + +public class T_add_int_1 { + + public int run(int a, int b) { + return a+b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_10.java b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_10.java new file mode 100644 index 0000000..e0a8784 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_10.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.add_int.jm; + +public class T_add_int_10 { + + public int run(int a) { + a += -128; + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_3.java b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_3.java new file mode 100644 index 0000000..5d73f0d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_int.jm; + +public class T_add_int_3 { + + public int run(int a, double b) { + return a+(int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_4.java b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_4.java new file mode 100644 index 0000000..3b8e09c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_int.jm; + +public class T_add_int_4 { + + public int run(long a, int b) { + return (int)a+b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_5.java b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_5.java new file mode 100644 index 0000000..8797a9f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_int.jm; + +public class T_add_int_5 { + + public int run(int a) { + return ++a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_6.java b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_6.java new file mode 100644 index 0000000..9387bcc --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_int.jm; + +public class T_add_int_6 { + + public int run(int a) { + return --a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_7.java b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_7.java new file mode 100644 index 0000000..e9d721b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_7.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.add_int.jm; + +public class T_add_int_7 { + + public int run(int a) { + a += 63; + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_8.java b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_8.java new file mode 100644 index 0000000..e183d67 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_8.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.add_int.jm; + +public class T_add_int_8 { + + public int run(int a) { + a += 0; + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_9.java b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_9.java new file mode 100644 index 0000000..85225d8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_int/jm/T_add_int_9.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.add_int.jm; + +public class T_add_int_9 { + + public int run(int a) { + a += 127; + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_long/Test_add_long.java b/jack-tests/tests/com/android/jack/opcodes/add_long/Test_add_long.java new file mode 100644 index 0000000..b9a603a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_long/Test_add_long.java @@ -0,0 +1,142 @@ +/* + * 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.jack.opcodes.add_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.add_long.jm.T_add_long_1; +import com.android.jack.opcodes.add_long.jm.T_add_long_3; +import com.android.jack.opcodes.add_long.jm.T_add_long_4; +import com.android.jack.opcodes.add_long.jm.T_add_long_5; + + +public class Test_add_long extends DxTestCase { + + /** + * @title Arguments = 12345678l, 87654321l + */ + public void testN1() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(99999999l, t.run(12345678l, 87654321l)); + } + + /** + * @title Arguments = 0l, 87654321l + */ + public void testN2() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(87654321l, t.run(0l, 87654321l)); + } + + /** + * @title Arguments = -12345678l, 0l + */ + public void testN3() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(-12345678l, t.run(-12345678l, 0l)); + } + + /** + * @title Arguments: 0 + Long.MAX_VALUE + */ + public void testB1() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(9223372036854775807L, t.run(0l, Long.MAX_VALUE)); + } + + /** + * @title Arguments: 0 + Long.MIN_VALUE + */ + public void testB2() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(-9223372036854775808L, t.run(0l, Long.MIN_VALUE)); + } + + /** + * @title Arguments: 0 + 0 + */ + public void testB3() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(0l, t.run(0l, 0l)); + } + + /** + * @title Arguments: Long.MAX_VALUE + Long.MAX_VALUE + */ + public void testB4() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(-2, t.run(Long.MAX_VALUE, Long.MAX_VALUE)); + } + + /** + * @title Arguments: Long.MAX_VALUE + Long.MIN_VALUE + */ + public void testB5() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(-1l, t.run(Long.MAX_VALUE, Long.MIN_VALUE)); + } + + /** + * @title Arguments: Long.MIN_VALUE + Long.MIN_VALUE + */ + public void testB6() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(0l, t.run(Long.MIN_VALUE, Long.MIN_VALUE)); + } + + /** + * @title Arguments: Long.MIN_VALUE + 1 + */ + public void testB7() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(-9223372036854775807l, t.run(Long.MIN_VALUE, 1l)); + } + + /** + * @title Arguments: Long.MAX_VALUE + 1 + */ + public void testB8() { + T_add_long_1 t = new T_add_long_1(); + assertEquals(-9223372036854775808l, t.run(Long.MAX_VALUE, 1l)); + } + + /** + * @title Arguments: Long.MAX_VALUE + 1 + */ + public void testB9() { + T_add_long_3 t = new T_add_long_3(); + assertEquals(9223372036854775807l, t.run(Long.MAX_VALUE, 1l)); + } + + + /** + * @title Arguments: Long.MAX_VALUE + 1 + */ + public void testB10() { + T_add_long_4 t = new T_add_long_4(); + assertEquals(-9223372036854775808l, t.run(Long.MAX_VALUE, 1)); + } + + + /** + * @title Arguments: Long.MAX_VALUE + 1 + */ + public void testB11() { + T_add_long_5 t = new T_add_long_5(); + assertEquals(9223372036854775807l, t.run(Long.MAX_VALUE, 1l)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_1.java b/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_1.java new file mode 100644 index 0000000..7f32339 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_long.jm; + +public class T_add_long_1 { + + public long run(long a, long b) { + return a+b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_3.java b/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_3.java new file mode 100644 index 0000000..32717aa --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_long.jm; + +public class T_add_long_3 { + + public long run(long a, double b) { + return (long)(a+b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_4.java b/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_4.java new file mode 100644 index 0000000..25a8f9f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_long.jm; + +public class T_add_long_4 { + + public long run(long a, int b) { + return a+b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_5.java b/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_5.java new file mode 100644 index 0000000..cfbfcbc --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/add_long/jm/T_add_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.add_long.jm; + +public class T_add_long_5 { + + public long run(long a, float b) { + return (long)(a+b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget/Test_aget.java b/jack-tests/tests/com/android/jack/opcodes/aget/Test_aget.java new file mode 100644 index 0000000..4d58b77 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget/Test_aget.java @@ -0,0 +1,191 @@ +/* + * 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.jack.opcodes.aget; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aget.jm.T_aget_1; +import com.android.jack.opcodes.aget.jm.T_aget_2; +import com.android.jack.opcodes.aget.jm.T_aget_3; +import com.android.jack.opcodes.aget.jm.T_aget_4; +import com.android.jack.opcodes.aget.jm.T_aget_5; +import com.android.jack.opcodes.aget.jm.T_aget_6; + + +public class Test_aget extends DxTestCase { + + /** + * @title normal test. Trying different indexes + */ + public void testN1() { + T_aget_1 t = new T_aget_1(); + float[] arr = new float[2]; + arr[1] = 3.1415f; + assertEquals(3.1415f, t.run(arr, 1)); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN2() { + T_aget_1 t = new T_aget_1(); + float[] arr = new float[2]; + arr[0] = 3.1415f; + assertEquals(3.1415f, t.run(arr, 0)); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN3() { + T_aget_2 t = new T_aget_2(); + float[] arr = new float[2]; + arr[0] = 3.1415f; + assertEquals(3.1415f, t.run(arr, 0)); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN4() { + T_aget_3 t = new T_aget_3(); + float[] arr = new float[2]; + arr[0] = 3.1415f; + assertEquals(3.1415f, t.run(arr, 0)); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aget_1 t = new T_aget_1(); + float[] arr = new float[2]; + try { + t.run(arr, 2); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aget_1 t = new T_aget_1(); + try { + t.run(null, 2); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aget_1 t = new T_aget_1(); + float[] arr = new float[2]; + try { + t.run(arr, -1); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title Normal test/. Trying different indexes + */ + public void testN1Int() { + T_aget_4 t = new T_aget_4(); + int[] arr = new int[2]; + arr[1] = 100000000; + assertEquals(100000000, t.run(arr, 1)); + } + + /** + * @title Normal test/. Trying different indexes + */ + public void testN2Int() { + T_aget_4 t = new T_aget_4(); + int[] arr = new int[2]; + arr[0] = 100000000; + assertEquals(100000000, t.run(arr, 0)); + } + + /** + * @title Normal test/. Trying different indexes + */ + public void testN3Int() { + T_aget_5 t = new T_aget_5(); + int[] arr = new int[2]; + arr[0] = 100000000; + assertEquals(100000000, t.run(arr, 0)); + } + + /** + * @title Normal test/. Trying different indexes + */ + public void testN4Int() { + T_aget_6 t = new T_aget_6(); + int[] arr = new int[2]; + arr[0] = 100000000; + assertEquals(100000000, t.run(arr, 0)); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1Int() { + T_aget_4 t = new T_aget_4(); + int[] arr = new int[2]; + try { + t.run(arr, 2); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2Int() { + T_aget_4 t = new T_aget_4(); + try { + t.run(null, 2); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3Int() { + T_aget_4 t = new T_aget_4(); + int[] arr = new int[2]; + try { + t.run(arr, -1); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_1.java b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_1.java new file mode 100644 index 0000000..b928a6f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aget.jm; + +public class T_aget_1 { + public float run(float[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_2.java b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_2.java new file mode 100644 index 0000000..757d32c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_2.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.aget.jm; + +public class T_aget_2 { + + public float run(float[] arr, double idx) { + return arr[(int)idx]; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_3.java b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_3.java new file mode 100644 index 0000000..57859d2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_3.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.aget.jm; + +public class T_aget_3 { + + public float run(float[] arr, long idx) { + return arr[(int)idx]; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_4.java b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_4.java new file mode 100644 index 0000000..bfbed18 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_4.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aget.jm; + +public class T_aget_4 { + public int run(int[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_5.java b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_5.java new file mode 100644 index 0000000..ab5a1c0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_5.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.aget.jm; + +public class T_aget_5 { + + public int run(int[] arr, double idx) { + return arr[(int)idx]; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_6.java b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_6.java new file mode 100644 index 0000000..1327e2e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget/jm/T_aget_6.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.aget.jm; + +public class T_aget_6 { + + public int run(int[] arr, long idx) { + return arr[(int)idx]; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_byte/Test_aget_byte.java b/jack-tests/tests/com/android/jack/opcodes/aget_byte/Test_aget_byte.java new file mode 100644 index 0000000..ea254c7 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_byte/Test_aget_byte.java @@ -0,0 +1,85 @@ +/* + * 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.jack.opcodes.aget_byte; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aget_byte.jm.T_aget_byte_1; + + +public class Test_aget_byte extends DxTestCase { + + /** + * @title normal test. Trying different indexes + */ + public void testN1() { + T_aget_byte_1 t = new T_aget_byte_1(); + byte[] arr = new byte[2]; + arr[1] = 100; + assertEquals(100, t.run(arr, 1)); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN2() { + T_aget_byte_1 t = new T_aget_byte_1(); + byte[] arr = new byte[2]; + arr[0] = 100; + assertEquals(100, t.run(arr, 0)); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aget_byte_1 t = new T_aget_byte_1(); + byte[] arr = new byte[2]; + try { + t.run(arr, 2); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aget_byte_1 t = new T_aget_byte_1(); + try { + t.run(null, 2); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aget_byte_1 t = new T_aget_byte_1(); + byte[] arr = new byte[2]; + try { + t.run(arr, -1); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_byte/jm/T_aget_byte_1.java b/jack-tests/tests/com/android/jack/opcodes/aget_byte/jm/T_aget_byte_1.java new file mode 100644 index 0000000..d586717 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_byte/jm/T_aget_byte_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aget_byte.jm; + +public class T_aget_byte_1 { + public byte run(byte[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_char/Test_aget_char.java b/jack-tests/tests/com/android/jack/opcodes/aget_char/Test_aget_char.java new file mode 100644 index 0000000..1f7e1b3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_char/Test_aget_char.java @@ -0,0 +1,86 @@ +/* + * 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.jack.opcodes.aget_char; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aget_char.jm.T_aget_char_1; + + +public class Test_aget_char extends DxTestCase { + + /** + * @title normal test. Trying different indexes + */ + public void testN1() { + T_aget_char_1 t = new T_aget_char_1(); + char[] arr = new char[2]; + arr[1] = 'g'; + assertEquals('g', t.run(arr, 1)); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN2() { + T_aget_char_1 t = new T_aget_char_1(); + char[] arr = new char[2]; + arr[0] = 'g'; + assertEquals('g', t.run(arr, 0)); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aget_char_1 t = new T_aget_char_1(); + char[] arr = new char[2]; + try { + t.run(arr, 2); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aget_char_1 t = new T_aget_char_1(); + try { + t.run(null, 2); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aget_char_1 t = new T_aget_char_1(); + char[] arr = new char[2]; + try { + t.run(arr, -1); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_char/jm/T_aget_char_1.java b/jack-tests/tests/com/android/jack/opcodes/aget_char/jm/T_aget_char_1.java new file mode 100644 index 0000000..3ab27fd --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_char/jm/T_aget_char_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aget_char.jm; + +public class T_aget_char_1 { + public char run(char[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_object/Test_aget_object.java b/jack-tests/tests/com/android/jack/opcodes/aget_object/Test_aget_object.java new file mode 100644 index 0000000..97838f0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_object/Test_aget_object.java @@ -0,0 +1,151 @@ +/* + * 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.jack.opcodes.aget_object; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aget_object.jm.T_aget_object_1; +import com.android.jack.opcodes.aget_object.jm.T_aget_object_4; +import com.android.jack.opcodes.aget_object.jm.T_aget_object_5; +import com.android.jack.opcodes.aget_object.jm.T_aget_object_6; +import com.android.jack.opcodes.aget_object.jm.T_aget_object_7; +import com.android.jack.opcodes.aget_object.jm.T_aget_object_8; +import com.android.jack.opcodes.aget_object.jm.T_aget_object_9; + + +public class Test_aget_object extends DxTestCase { + + /** + * @title Normal test. Trying different indexes + */ + public void testN1() { + T_aget_object_1 t = new T_aget_object_1(); + String[] arr = new String[] {"a", "b"}; + assertEquals("a", t.run(arr, 0)); + } + + /** + * @title Normal test. Trying different indexes + */ + public void testN2() { + T_aget_object_1 t = new T_aget_object_1(); + String[] arr = new String[] {"a", "b"}; + assertEquals("b", t.run(arr, 1)); + } + + /** + * @title ArrayIndexOutOfBoundsException expected + */ + public void testE1() { + T_aget_object_1 t = new T_aget_object_1(); + String[] arr = new String[] {"a", "b"}; + try { + t.run(arr, 2); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aioobe) { + // expected + } + } + + /** + * @title Negative index. ArrayIndexOutOfBoundsException expected + */ + public void testE2() { + T_aget_object_1 t = new T_aget_object_1(); + String[] arr = new String[] {"a", "b"}; + try { + t.run(arr, -1); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aioobe) { + // expected + } + } + + /** + * @title NullPointerException expected + */ + public void testE3() { + T_aget_object_1 t = new T_aget_object_1(); + String[] arr = null; + try { + t.run(arr, 0); + fail("expected NullPointerException"); + } catch (NullPointerException npe) { + // expected + } + } + + /** + * @constraint 4.8.2.1 + * @title types of arguments - array, double + */ + public void testN3() { + T_aget_object_4 t = new T_aget_object_4(); + String[] arr = new String[] {"a", "b"}; + assertEquals("a", t.run(arr, 0)); + } + + /** + * @constraint 4.8.2.1 + * @title types of arguments - array, long + */ + public void testN4() { + T_aget_object_5 t = new T_aget_object_5(); + String[] arr = new String[] {"a", "b"}; + assertEquals("a", t.run(arr, 0)); + } + + /** + * @constraint 4.8.2.1 + * @title types of arguments - Object, int + */ + public void testN5() { + T_aget_object_6 t = new T_aget_object_6(); + String[] arr = new String[] {"a", "b"}; + assertEquals("a", t.run(null, arr, 0)); + } + + /** + * @constraint 4.8.2.1 + * @title types of arguments - float[], int + */ + public void testN6() { + T_aget_object_7 t = new T_aget_object_7(); + String[] arr = new String[] {"a", "b"}; + assertEquals("a", t.run(null, arr, 0)); + } + + /** + * @constraint 4.8.2.1 + * @title types of arguments - long[], int + */ + public void testN7() { + T_aget_object_8 t = new T_aget_object_8(); + String[] arr = new String[] {"a", "b"}; + assertEquals("a", t.run(null, arr, 0)); + } + + /** + * @constraint 4.8.2.1 + * @title types of arguments - array, reference + */ + public void testN8() { + T_aget_object_9 t = new T_aget_object_9(); + String[] arr = new String[] {"a", "b"}; + assertEquals("a", t.run(arr, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_1.java b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_1.java new file mode 100644 index 0000000..e6427fb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_object.jm; + +public class T_aget_object_1 { + + public String run(String [] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_4.java b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_4.java new file mode 100644 index 0000000..ac6f160 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_object.jm; + +public class T_aget_object_4 { + + public String run(String [] arr, double idx) { + return arr[(int)idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_5.java b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_5.java new file mode 100644 index 0000000..d5f1a1d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_object.jm; + +public class T_aget_object_5 { + + public String run(String [] arr, long idx) { + return arr[(int)idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_6.java b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_6.java new file mode 100644 index 0000000..fd3c828 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_object.jm; + +public class T_aget_object_6 { + + public String run(Object a, String[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_7.java b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_7.java new file mode 100644 index 0000000..67fc345 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_7.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_object.jm; + +public class T_aget_object_7 { + + public String run(float[] a, String[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_8.java b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_8.java new file mode 100644 index 0000000..d93fa85 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_8.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_object.jm; + +public class T_aget_object_8 { + + public String run(long[] a, String[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_9.java b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_9.java new file mode 100644 index 0000000..caa1e71 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_9.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_object.jm; + +public class T_aget_object_9 { + + public String run(String [] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_short/Test_aget_short.java b/jack-tests/tests/com/android/jack/opcodes/aget_short/Test_aget_short.java new file mode 100644 index 0000000..f65533a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_short/Test_aget_short.java @@ -0,0 +1,107 @@ +/* + * 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.jack.opcodes.aget_short; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aget_short.jm.T_aget_short_1; +import com.android.jack.opcodes.aget_short.jm.T_aget_short_4; +import com.android.jack.opcodes.aget_short.jm.T_aget_short_5; + + +public class Test_aget_short extends DxTestCase { + + /** + * @title normal test. trying different indexes + */ + public void testN1() { + T_aget_short_1 t = new T_aget_short_1(); + short[] arr = new short[2]; + arr[1] = 10000; + assertEquals(10000, t.run(arr, 1)); + } + + /** + * @title normal test. trying different indexes + */ + public void testN2() { + T_aget_short_1 t = new T_aget_short_1(); + short[] arr = new short[2]; + arr[0] = 10000; + assertEquals(10000, t.run(arr, 0)); + } + + /** + * @title normal test. trying different indexes + */ + public void testN3() { + T_aget_short_4 t = new T_aget_short_4(); + short[] arr = new short[2]; + arr[0] = 10000; + assertEquals(10000, t.run(arr, 0)); + } + + /** + * @title normal test. trying different indexes + */ + public void testN4() { + T_aget_short_5 t = new T_aget_short_5(); + short[] arr = new short[2]; + arr[0] = 10000; + assertEquals(10000, t.run(arr, 0)); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aget_short_1 t = new T_aget_short_1(); + short[] arr = new short[2]; + try { + t.run(arr, 2); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aget_short_1 t = new T_aget_short_1(); + try { + t.run(null, 2); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aget_short_1 t = new T_aget_short_1(); + short[] arr = new short[2]; + try { + t.run(arr, -1); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_1.java b/jack-tests/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_1.java new file mode 100644 index 0000000..e63e17a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aget_short.jm; + +public class T_aget_short_1 { + public short run(short[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_4.java b/jack-tests/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_4.java new file mode 100644 index 0000000..f2d9148 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_4.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.aget_short.jm; + +public class T_aget_short_4 { + + public short run(short[] arr, double idx) { + return arr[(int)idx]; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_5.java b/jack-tests/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_5.java new file mode 100644 index 0000000..3e6d48d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_5.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.aget_short.jm; + +public class T_aget_short_5 { + + public short run(short[] arr, long idx) { + return arr[(int)idx]; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_wide/Test_aget_wide.java b/jack-tests/tests/com/android/jack/opcodes/aget_wide/Test_aget_wide.java new file mode 100644 index 0000000..1a8f89b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_wide/Test_aget_wide.java @@ -0,0 +1,180 @@ +/* + * 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.jack.opcodes.aget_wide; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aget_wide.jm.T_aget_wide_1; +import com.android.jack.opcodes.aget_wide.jm.T_aget_wide_2; +import com.android.jack.opcodes.aget_wide.jm.T_aget_wide_3; +import com.android.jack.opcodes.aget_wide.jm.T_aget_wide_4; +import com.android.jack.opcodes.aget_wide.jm.T_aget_wide_5; + + +public class Test_aget_wide extends DxTestCase { + + /** + * @title normal test. Trying different indexes + */ + public void testN1() { + T_aget_wide_1 t = new T_aget_wide_1(); + double[] arr = new double[2]; + arr[1] = 3.1415d; + assertEquals(3.1415d, t.run(arr, 1)); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN2() { + T_aget_wide_1 t = new T_aget_wide_1(); + double[] arr = new double[2]; + arr[0] = 3.1415d; + assertEquals(3.1415d, t.run(arr, 0)); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aget_wide_1 t = new T_aget_wide_1(); + double[] arr = new double[2]; + try { + t.run(arr, 2); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aget_wide_1 t = new T_aget_wide_1(); + try { + t.run(null, 2); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aget_wide_1 t = new T_aget_wide_1(); + double[] arr = new double[2]; + try { + t.run(arr, -1); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title normal test. trying different indexes + */ + public void testN1Long() { + T_aget_wide_2 t = new T_aget_wide_2(); + long[] arr = new long[2]; + arr[1] = 1000000000000000000l; + assertEquals(1000000000000000000l, t.run(arr, 1)); + } + + /** + * @title normal test. trying different indexes + */ + public void testN2Long() { + T_aget_wide_2 t = new T_aget_wide_2(); + long[] arr = new long[2]; + arr[0] = 1000000000000000000l; + assertEquals(1000000000000000000l, t.run(arr, 0)); + } + + /** + * @title normal test. trying different indexes + */ + public void testN3Long() { + T_aget_wide_3 t = new T_aget_wide_3(); + long[] arr = new long[2]; + arr[0] = 1000000000000000000l; + assertEquals(1000000000000000000l, t.run(arr, 0)); + } + + /** + * @title normal test. trying different indexes + */ + public void testN4Long() { + T_aget_wide_4 t = new T_aget_wide_4(); + long[] arr = new long[2]; + arr[0] = 1000000000000000000l; + assertEquals(1000000000000000000l, t.run(arr, 0)); + } + + /** + * @title normal test. trying different indexes + */ + public void testN5Long() { + T_aget_wide_5 t = new T_aget_wide_5(); + long[] arr = new long[2]; + arr[0] = 1000000000000000000l; + assertEquals(1000000000000000000l, t.run(arr, 0)); + } + + /** + * @title Exception - ArrayIndexOutOfBoundsException + */ + public void testE1Long() { + T_aget_wide_2 t = new T_aget_wide_2(); + long[] arr = new long[2]; + try { + t.run(arr, 2); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title Exception - NullPointerException + */ + public void testE2Long() { + T_aget_wide_2 t = new T_aget_wide_2(); + try { + t.run(null, 2); + fail("expected NullPointerException"); + } catch (NullPointerException np) { + // expected + } + } + + /** + * @title Exception - ArrayIndexOutOfBoundsException + */ + public void testE3Long() { + T_aget_wide_2 t = new T_aget_wide_2(); + long[] arr = new long[2]; + try { + t.run(arr, -1); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_1.java b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_1.java new file mode 100644 index 0000000..2dc1b73 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aget_wide.jm; + +public class T_aget_wide_1 { + public double run(double[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_2.java b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_2.java new file mode 100644 index 0000000..251cfe2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_wide.jm; + +public class T_aget_wide_2 { + + public long run(long[] arr, int idx) { + return arr[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_3.java b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_3.java new file mode 100644 index 0000000..acd8aa6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_wide.jm; + +public class T_aget_wide_3 { + + public long run(long[] arr, double idx) { + return arr[(int)idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_4.java b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_4.java new file mode 100644 index 0000000..db9344a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_wide.jm; + +public class T_aget_wide_4 { + + public long run(long[] arr, float idx) { + return arr[(int)idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_5.java b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_5.java new file mode 100644 index 0000000..357ee2a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aget_wide.jm; + +public class T_aget_wide_5 { + + public long run(long[] arr, long idx) { + return arr[(int)idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/and_int/Test_and_int.java b/jack-tests/tests/com/android/jack/opcodes/and_int/Test_and_int.java new file mode 100644 index 0000000..eaeb238 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/and_int/Test_and_int.java @@ -0,0 +1,83 @@ +/* + * 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.jack.opcodes.and_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.and_int.jm.T_and_int_1; +import com.android.jack.opcodes.and_int.jm.T_and_int_3; +import com.android.jack.opcodes.and_int.jm.T_and_int_4; + + +public class Test_and_int extends DxTestCase { + + /** + * @title Arguments = 15, 8 + */ + public void testN1() { + T_and_int_1 t = new T_and_int_1(); + assertEquals(8, t.run(15, 8)); + } + + /** + * @title Arguments = 0xfffffff8, 0xfffffff1 + */ + public void testN2() { + T_and_int_1 t = new T_and_int_1(); + assertEquals(0xfffffff0, t.run(0xfffffff8, 0xfffffff1)); + } + + /** + * @title Arguments = 0xcafe & -1 + */ + public void testN3() { + T_and_int_1 t = new T_and_int_1(); + assertEquals(0xcafe, t.run(0xcafe, -1)); + } + + /** + * @title Arguments = 0xcafe & -1 + */ + public void testN4() { + T_and_int_3 t = new T_and_int_3(); + assertEquals(0xcafe, t.run(0xcafe, -1)); + } + + /** + * @title Arguments = 0xcafe & -1 + */ + public void testN5() { + T_and_int_4 t = new T_and_int_4(); + assertEquals(0xcafe, t.run(0xcafe, -1)); + } + + /** + * @title Arguments = 0 & -1 + */ + public void testB1() { + T_and_int_1 t = new T_and_int_1(); + assertEquals(0, t.run(0, -1)); + } + + /** + * @title Arguments = Integer.MAX_VALUE & Integer.MIN_VALUE + */ + public void testB2() { + T_and_int_1 t = new T_and_int_1(); + assertEquals(0, t.run(Integer.MAX_VALUE, Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/and_int/jm/T_and_int_1.java b/jack-tests/tests/com/android/jack/opcodes/and_int/jm/T_and_int_1.java new file mode 100644 index 0000000..5dc5bf0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/and_int/jm/T_and_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.and_int.jm; + +public class T_and_int_1 { + + public int run(int a, int b) { + return a & b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/and_int/jm/T_and_int_3.java b/jack-tests/tests/com/android/jack/opcodes/and_int/jm/T_and_int_3.java new file mode 100644 index 0000000..63ca632 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/and_int/jm/T_and_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.and_int.jm; + +public class T_and_int_3 { + + public int run(double a, int b) { + return (int)a & b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/and_int/jm/T_and_int_4.java b/jack-tests/tests/com/android/jack/opcodes/and_int/jm/T_and_int_4.java new file mode 100644 index 0000000..b487ae0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/and_int/jm/T_and_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.and_int.jm; + +public class T_and_int_4 { + + public int run(int a, long b) { + return a & (int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/and_long/Test_and_long.java b/jack-tests/tests/com/android/jack/opcodes/and_long/Test_and_long.java new file mode 100644 index 0000000..a5df9b1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/and_long/Test_and_long.java @@ -0,0 +1,83 @@ +/* + * 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.jack.opcodes.and_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.and_long.jm.T_and_long_1; +import com.android.jack.opcodes.and_long.jm.T_and_long_3; +import com.android.jack.opcodes.and_long.jm.T_and_long_4; + + +public class Test_and_long extends DxTestCase { + + /** + * @title Arguments = 0xfffffff8aal, 0xfffffff1aal + */ + public void testN1() { + T_and_long_1 t = new T_and_long_1(); + assertEquals(0xfffffff0aal, t.run(0xfffffff8aal, 0xfffffff1aal)); + } + + /** + * @title Arguments = 987654321, 123456789 + */ + public void testN2() { + T_and_long_1 t = new T_and_long_1(); + assertEquals(39471121, t.run(987654321, 123456789)); + } + + /** + * @title Arguments = 0xABCDEF & -1 + */ + public void testN3() { + T_and_long_1 t = new T_and_long_1(); + assertEquals(0xABCDEF, t.run(0xABCDEF, -1)); + } + + /** + * @title Arguments = 0xABCDEF & -1 + */ + public void testN4() { + T_and_long_3 t = new T_and_long_3(); + assertEquals(0xABCDEF, t.run(0xABCDEF, -1)); + } + + /** + * @title Arguments = 0xABCDEF & -1 + */ + public void testN5() { + T_and_long_4 t = new T_and_long_4(); + assertEquals(0xABCDEF, t.run(0xABCDEF, -1)); + } + + /** + * @title Arguments = 0 & -1 + */ + public void testB1() { + T_and_long_1 t = new T_and_long_1(); + assertEquals(0, t.run(0, -1)); + } + + /** + * @title Arguments = Long.MAX_VALUE & Long.MIN_VALUE + */ + public void testB2() { + T_and_long_1 t = new T_and_long_1(); + assertEquals(0, t.run(Long.MAX_VALUE, Long.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/and_long/jm/T_and_long_1.java b/jack-tests/tests/com/android/jack/opcodes/and_long/jm/T_and_long_1.java new file mode 100644 index 0000000..14ed9be --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/and_long/jm/T_and_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.and_long.jm; + +public class T_and_long_1 { + + public long run(long a, long b) { + return a & b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/and_long/jm/T_and_long_3.java b/jack-tests/tests/com/android/jack/opcodes/and_long/jm/T_and_long_3.java new file mode 100644 index 0000000..7ddbce4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/and_long/jm/T_and_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.and_long.jm; + +public class T_and_long_3 { + + public long run(float a, long b) { + return (long)a & b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/and_long/jm/T_and_long_4.java b/jack-tests/tests/com/android/jack/opcodes/and_long/jm/T_and_long_4.java new file mode 100644 index 0000000..207d7fa --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/and_long/jm/T_and_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.and_long.jm; + +public class T_and_long_4 { + + public long run(int a, long b) { + return a & b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput/Test_aput.java b/jack-tests/tests/com/android/jack/opcodes/aput/Test_aput.java new file mode 100644 index 0000000..cbe7640 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput/Test_aput.java @@ -0,0 +1,191 @@ +/* + * 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.jack.opcodes.aput; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aput.jm.T_aput_1; +import com.android.jack.opcodes.aput.jm.T_aput_2; +import com.android.jack.opcodes.aput.jm.T_aput_3; +import com.android.jack.opcodes.aput.jm.T_aput_4; +import com.android.jack.opcodes.aput.jm.T_aput_5; +import com.android.jack.opcodes.aput.jm.T_aput_6; + + +public class Test_aput extends DxTestCase { + + /** + * @title normal test. Trying different indexes + */ + public void testN1() { + T_aput_1 t = new T_aput_1(); + float[] arr = new float[2]; + t.run(arr, 1, 2.7f); + assertEquals(2.7f, arr[1]); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN2() { + T_aput_1 t = new T_aput_1(); + float[] arr = new float[2]; + t.run(arr, 0, 2.7f); + assertEquals(2.7f, arr[0]); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN3() { + T_aput_2 t = new T_aput_2(); + float[] arr = new float[2]; + t.run(arr, 0, 2.7f); + assertEquals(2.7f, arr[0]); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN4() { + T_aput_3 t = new T_aput_3(); + float[] arr = new float[2]; + t.run(arr, 0, 2.7f); + assertEquals(2.7f, arr[0]); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aput_1 t = new T_aput_1(); + float[] arr = new float[2]; + try { + t.run(arr, 2, 2.7f); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aput_1 t = new T_aput_1(); + try { + t.run(null, 2, 2.7f); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aput_1 t = new T_aput_1(); + float[] arr = new float[2]; + try { + t.run(arr, -1, 2.7f); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title Normal test/. Trying different indexes + */ + public void testN1Int() { + T_aput_4 t = new T_aput_4(); + int[] arr = new int[2]; + t.run(arr, 1, 100000000); + assertEquals(100000000, arr[1]); + } + + /** + * @title Normal test/. Trying different indexes + */ + public void testN2Int() { + T_aput_4 t = new T_aput_4(); + int[] arr = new int[2]; + t.run(arr, 0, 100000000); + assertEquals(100000000, arr[0]); + } + + /** + * @title Normal test/. Trying different indexes + */ + public void testN3Int() { + T_aput_5 t = new T_aput_5(); + int[] arr = new int[2]; + t.run(arr, 0, 100000000); + assertEquals(100000000, arr[0]); + } + + /** + * @title Normal test/. Trying different indexes + */ + public void testN4Int() { + T_aput_6 t = new T_aput_6(); + int[] arr = new int[2]; + t.run(arr, 0, 100000000); + assertEquals(100000000, arr[0]); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1Int() { + T_aput_4 t = new T_aput_4(); + int[] arr = new int[2]; + try { + t.run(arr, 2, 100000000); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2Int() { + T_aput_4 t = new T_aput_4(); + try { + t.run(null, 2, 100000000); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3Int() { + T_aput_4 t = new T_aput_4(); + int[] arr = new int[2]; + try { + t.run(arr, -1, 100000000); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_1.java b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_1.java new file mode 100644 index 0000000..ee5e507 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aput.jm; + +public class T_aput_1 { + public void run(float[] arr, int idx, float value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_2.java b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_2.java new file mode 100644 index 0000000..86f0126 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput.jm; + +public class T_aput_2 { + + public void run(float[] arr, double idx, float value) { + arr[(int)idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_3.java b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_3.java new file mode 100644 index 0000000..009ef92 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput.jm; + +public class T_aput_3 { + + public void run(float[] arr, int idx, float value) { + arr[idx] = (float)value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_4.java b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_4.java new file mode 100644 index 0000000..9b10d93 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_4.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aput.jm; + +public class T_aput_4 { + public void run(int[] arr, int idx, int value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_5.java b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_5.java new file mode 100644 index 0000000..0d24828 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput.jm; + +public class T_aput_5 { + + public void run(int[] arr, double idx, int value) { + arr[(int)idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_6.java b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_6.java new file mode 100644 index 0000000..9e2276f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput/jm/T_aput_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput.jm; + +public class T_aput_6 { + + public void run(int[] arr, int idx, long value) { + arr[idx] = (int)value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_byte/Test_aput_byte.java b/jack-tests/tests/com/android/jack/opcodes/aput_byte/Test_aput_byte.java new file mode 100644 index 0000000..5cd64e1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_byte/Test_aput_byte.java @@ -0,0 +1,85 @@ +/* + * 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.jack.opcodes.aput_byte; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aput_byte.jm.T_aput_byte_1; + + +public class Test_aput_byte extends DxTestCase { + + /** + * @title normal test. Trying different indexes + */ + public void testN1() { + T_aput_byte_1 t = new T_aput_byte_1(); + byte[] arr = new byte[2]; + t.run(arr, 1, (byte) 100); + assertEquals(100, arr[1]); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN2() { + T_aput_byte_1 t = new T_aput_byte_1(); + byte[] arr = new byte[2]; + t.run(arr, 0, (byte) 100); + assertEquals(100, arr[0]); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aput_byte_1 t = new T_aput_byte_1(); + byte[] arr = new byte[2]; + try { + t.run(arr, 2, (byte) 100); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aput_byte_1 t = new T_aput_byte_1(); + try { + t.run(null, 2, (byte) 100); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aput_byte_1 t = new T_aput_byte_1(); + byte[] arr = new byte[2]; + try { + t.run(arr, -1, (byte) 100); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_byte/jm/T_aput_byte_1.java b/jack-tests/tests/com/android/jack/opcodes/aput_byte/jm/T_aput_byte_1.java new file mode 100644 index 0000000..729d723 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_byte/jm/T_aput_byte_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aput_byte.jm; + +public class T_aput_byte_1 { + public void run(byte[] arr, int idx, byte value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_char/Test_aput_char.java b/jack-tests/tests/com/android/jack/opcodes/aput_char/Test_aput_char.java new file mode 100644 index 0000000..c8dd3bb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_char/Test_aput_char.java @@ -0,0 +1,109 @@ +/* + * 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.jack.opcodes.aput_char; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aput_char.jm.T_aput_char_1; +import com.android.jack.opcodes.aput_char.jm.T_aput_char_4; +import com.android.jack.opcodes.aput_char.jm.T_aput_char_5; + + +public class Test_aput_char extends DxTestCase { + + /** + * @title normal test. Trying different indexes + */ + public void testN1() { + T_aput_char_1 t = new T_aput_char_1(); + char[] arr = new char[2]; + t.run(arr, 1, 'g'); + assertEquals('g', arr[1]); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN2() { + T_aput_char_1 t = new T_aput_char_1(); + char[] arr = new char[2]; + t.run(arr, 0, 'g'); + assertEquals('g', arr[0]); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN3() { + T_aput_char_4 t = new T_aput_char_4(); + char[] arr = new char[2]; + t.run(arr, 1, 'g'); + assertEquals('g', arr[1]); + } + + + /** + * @title normal test. Trying different indexes + */ + public void testN4() { + T_aput_char_5 t = new T_aput_char_5(); + char[] arr = new char[2]; + t.run(arr, 1, 'g'); + assertEquals('g', arr[1]); + } + + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aput_char_1 t = new T_aput_char_1(); + char[] arr = new char[2]; + try { + t.run(arr, 2, 'g'); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aput_char_1 t = new T_aput_char_1(); + try { + t.run(null, 2, 'g'); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aput_char_1 t = new T_aput_char_1(); + char[] arr = new char[2]; + try { + t.run(arr, -1, 'g'); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_1.java b/jack-tests/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_1.java new file mode 100644 index 0000000..eb7caef --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aput_char.jm; + +public class T_aput_char_1 { + public void run(char[] arr, int idx, char value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_4.java b/jack-tests/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_4.java new file mode 100644 index 0000000..7128b21 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput_char.jm; + +public class T_aput_char_4 { + + public void run(char[] arr, double idx, char value) { + arr[(int)idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_5.java b/jack-tests/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_5.java new file mode 100644 index 0000000..fdfb656 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput_char.jm; + +public class T_aput_char_5 { + + public void run(char[] arr, int idx, long value) { + arr[idx] = (char)value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_object/Test_aput_object.java b/jack-tests/tests/com/android/jack/opcodes/aput_object/Test_aput_object.java new file mode 100644 index 0000000..a417d10 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_object/Test_aput_object.java @@ -0,0 +1,101 @@ +/* + * 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.jack.opcodes.aput_object; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aput_object.jm.T_aput_object_1; +import com.android.jack.opcodes.aput_object.jm.T_aput_object_10; + + +public class Test_aput_object extends DxTestCase { + + /** + * @title Normal test. Trying different indexes + */ + public void testN1() { + T_aput_object_1 t = new T_aput_object_1(); + String[] arr = new String[2]; + t.run(arr, 0, "hello"); + assertEquals("hello", arr[0]); + } + + /** + * @title Normal test. Trying different indexes + */ + public void testN2() { + T_aput_object_1 t = new T_aput_object_1(); + String[] value = {"world", null, ""}; + String[] arr = new String[2]; + for (int i = 0; i < value.length; i++) { + t.run(arr, 1, value[i]); + assertEquals(value[i], arr[1]); + } + } + + /** + * @title Normal test. Trying different indexes + */ + public void testN3() { + T_aput_object_10 t = new T_aput_object_10(); + Integer[] arr = new Integer[2]; + Integer value = new Integer(12345); + t.run(arr, 0, value); + assertEquals(value, arr[0]); + } + + /** + * @title ArrayIndexOutOfBoundsException expected + */ + public void testE1() { + T_aput_object_1 t = new T_aput_object_1(); + String[] arr = new String[2]; + try { + t.run(arr, arr.length, "abc"); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE2() { + T_aput_object_1 t = new T_aput_object_1(); + String[] arr = new String[2]; + try { + t.run(arr, -1, "abc"); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE3() { + T_aput_object_1 t = new T_aput_object_1(); + String[] arr = null; + try { + t.run(arr, 0, "abc"); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_object/jm/T_aput_object_1.java b/jack-tests/tests/com/android/jack/opcodes/aput_object/jm/T_aput_object_1.java new file mode 100644 index 0000000..de0b456 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_object/jm/T_aput_object_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput_object.jm; + +public class T_aput_object_1 { + + public void run(String[] arr, int idx, String value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_object/jm/T_aput_object_10.java b/jack-tests/tests/com/android/jack/opcodes/aput_object/jm/T_aput_object_10.java new file mode 100644 index 0000000..6ba1468 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_object/jm/T_aput_object_10.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput_object.jm; + +public class T_aput_object_10 { + + public void run(Integer[] arr, int idx, Integer value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_short/Test_aput_short.java b/jack-tests/tests/com/android/jack/opcodes/aput_short/Test_aput_short.java new file mode 100644 index 0000000..1e64027 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_short/Test_aput_short.java @@ -0,0 +1,106 @@ +/* + * 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.jack.opcodes.aput_short; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aput_short.jm.T_aput_short_1; +import com.android.jack.opcodes.aput_short.jm.T_aput_short_4; +import com.android.jack.opcodes.aput_short.jm.T_aput_short_5; + + +public class Test_aput_short extends DxTestCase { + + /** + * @title normal test. trying different indexes + */ + public void testN1() { + T_aput_short_1 t = new T_aput_short_1(); + short[] arr = new short[2]; + t.run(arr, 1, (short) 10000); + assertEquals(10000, arr[1]); + } + + /** + * @title normal test. trying different indexes + */ + public void testN2() { + T_aput_short_1 t = new T_aput_short_1(); + short[] arr = new short[2]; + t.run(arr, 0, (short) 10000); + assertEquals(10000, arr[0]); + } + + /** + * @title normal test. trying different indexes + */ + public void testN3() { + T_aput_short_4 t = new T_aput_short_4(); + short[] arr = new short[2]; + t.run(arr, 0, (short) 10000); + assertEquals(10000, arr[0]); + } + + /** + * @title normal test. trying different indexes + */ + public void testN4() { + T_aput_short_5 t = new T_aput_short_5(); + short[] arr = new short[2]; + t.run(arr, 0, (short) 10000); + assertEquals(10000, arr[0]); + } + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aput_short_1 t = new T_aput_short_1(); + short[] arr = new short[2]; + try { + t.run(arr, 2, (short) 10000); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aput_short_1 t = new T_aput_short_1(); + try { + t.run(null, 2, (short) 10000); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aput_short_1 t = new T_aput_short_1(); + short[] arr = new short[2]; + try { + t.run(arr, -1, (short) 10000); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_1.java b/jack-tests/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_1.java new file mode 100644 index 0000000..f8784fc --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aput_short.jm; + +public class T_aput_short_1 { + public void run(short[] arr, int idx, short value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_4.java b/jack-tests/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_4.java new file mode 100644 index 0000000..7495433 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput_short.jm; + +public class T_aput_short_4 { + + public void run(short[] arr, double idx, short value) { + arr[(int)idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_5.java b/jack-tests/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_5.java new file mode 100644 index 0000000..dd9556a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput_short.jm; + +public class T_aput_short_5 { + + public void run(short[] arr, int idx, long value) { + arr[idx] = (short)value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_wide/Test_aput_wide.java b/jack-tests/tests/com/android/jack/opcodes/aput_wide/Test_aput_wide.java new file mode 100644 index 0000000..90d8f34 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_wide/Test_aput_wide.java @@ -0,0 +1,168 @@ +/* + * 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.jack.opcodes.aput_wide; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.aput_wide.jm.T_aput_wide_1; +import com.android.jack.opcodes.aput_wide.jm.T_aput_wide_2; +import com.android.jack.opcodes.aput_wide.jm.T_aput_wide_3; +import com.android.jack.opcodes.aput_wide.jm.T_aput_wide_4; + + +public class Test_aput_wide extends DxTestCase { + + /** + * @title normal test. Trying different indexes + */ + public void testN1() { + T_aput_wide_1 t = new T_aput_wide_1(); + double[] arr = new double[2]; + t.run(arr, 1, 2.7d); + assertEquals(2.7d, arr[1]); + } + + /** + * @title normal test. Trying different indexes + */ + public void testN2() { + T_aput_wide_1 t = new T_aput_wide_1(); + double[] arr = new double[2]; + t.run(arr, 0, 2.7d); + assertEquals(2.7d, arr[0]); + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE1() { + T_aput_wide_1 t = new T_aput_wide_1(); + double[] arr = new double[2]; + try { + t.run(arr, 2, 2.7d); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title expected NullPointerException + */ + public void testE2() { + T_aput_wide_1 t = new T_aput_wide_1(); + try { + t.run(null, 2, 2.7d); + fail("expected NullPointerException"); + } catch (NullPointerException aie) { + // expected + } + } + + /** + * @title expected ArrayIndexOutOfBoundsException + */ + public void testE3() { + T_aput_wide_1 t = new T_aput_wide_1(); + double[] arr = new double[2]; + try { + t.run(arr, -1, 2.7d); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title normal test. trying different indexes + */ + public void testN1Long() { + T_aput_wide_2 t = new T_aput_wide_2(); + long[] arr = new long[2]; + t.run(arr, 1, 100000000000l); + assertEquals(100000000000l, arr[1]); + } + + /** + * @title normal test. trying different indexes + */ + public void testN2Long() { + T_aput_wide_2 t = new T_aput_wide_2(); + long[] arr = new long[2]; + t.run(arr, 0, 100000000000l); + assertEquals(100000000000l, arr[0]); + } + + /** + * @title normal test. trying different indexes + */ + public void testN3Long() { + T_aput_wide_3 t = new T_aput_wide_3(); + long[] arr = new long[2]; + t.run(arr, 0, 100000000000l); + assertEquals(100000000000l, arr[0]); + } + + /** + * @title normal test. trying different indexes + */ + public void testN4Long() { + T_aput_wide_4 t = new T_aput_wide_4(); + long[] arr = new long[2]; + t.run(arr, 0, 1000); + assertEquals(1000, arr[0]); + } + /** + * @title Exception - ArrayIndexOutOfBoundsException + */ + public void testE1Long() { + T_aput_wide_2 t = new T_aput_wide_2(); + long[] arr = new long[2]; + try { + t.run(arr, 2, 100000000000l); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } + + /** + * @title Exception - NullPointerException + */ + public void testE2Long() { + T_aput_wide_2 t = new T_aput_wide_2(); + try { + t.run(null, 1, 100000000000l); + fail("expected NullPointerException"); + } catch (NullPointerException np) { + // expected + } + } + + /** + * @title Exception - ArrayIndexOutOfBoundsException + */ + public void testE3Long() { + T_aput_wide_2 t = new T_aput_wide_2(); + long[] arr = new long[2]; + try { + t.run(arr, -1, 100000000000l); + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException aie) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_1.java b/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_1.java new file mode 100644 index 0000000..7fc2f3e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_1.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.aput_wide.jm; + +public class T_aput_wide_1 { + public void run(double[] arr, int idx, double value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_2.java b/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_2.java new file mode 100644 index 0000000..4f63137 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput_wide.jm; + +public class T_aput_wide_2 { + + public void run(long[] arr, int idx, long value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_3.java b/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_3.java new file mode 100644 index 0000000..4e372d5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput_wide.jm; + +public class T_aput_wide_3 { + + public void run(long[] arr, double idx, long value) { + arr[(int)idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_4.java b/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_4.java new file mode 100644 index 0000000..0e50f6f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.aput_wide.jm; + +public class T_aput_wide_4 { + + public void run(long[] arr, int idx, int value) { + arr[idx] = value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/array_length/Test_array_length.java b/jack-tests/tests/com/android/jack/opcodes/array_length/Test_array_length.java new file mode 100644 index 0000000..79540dc --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/array_length/Test_array_length.java @@ -0,0 +1,60 @@ +/* + * 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.jack.opcodes.array_length; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.array_length.jm.T_array_length_1; +import com.android.jack.opcodes.array_length.jm.T_array_length_2; + + +public class Test_array_length extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_array_length_1 t = new T_array_length_1(); + String[] a = new String[5]; + assertEquals(5, t.run(a)); + } + + /** + * @title NullPointerException expected + */ + public void testNPE1() { + T_array_length_1 t = new T_array_length_1(); + try { + t.run(null); + fail("NPE expected"); + } catch (NullPointerException npe) { + // expected + } + } + + /** + * @title NullPointerException expected + */ + public void testNPE2() { + T_array_length_2 t = new T_array_length_2(); + try { + t.run(); + fail("NPE expected"); + } catch (NullPointerException npe) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/array_length/jm/T_array_length_1.java b/jack-tests/tests/com/android/jack/opcodes/array_length/jm/T_array_length_1.java new file mode 100644 index 0000000..7632d15 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/array_length/jm/T_array_length_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.array_length.jm; + +public class T_array_length_1 { + + public int run(Object[] arr) { + return arr.length; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/array_length/jm/T_array_length_2.java b/jack-tests/tests/com/android/jack/opcodes/array_length/jm/T_array_length_2.java new file mode 100644 index 0000000..a029ac0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/array_length/jm/T_array_length_2.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.array_length.jm; + +public class T_array_length_2 { + + public int run() { + byte[] ba = null; + return ba.length; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/check_cast/Test_check_cast.java b/jack-tests/tests/com/android/jack/opcodes/check_cast/Test_check_cast.java new file mode 100644 index 0000000..60b4c1c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/check_cast/Test_check_cast.java @@ -0,0 +1,54 @@ +/* + * 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.jack.opcodes.check_cast; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.check_cast.jm.T_check_cast_1; + + +public class Test_check_cast extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_check_cast_1 t = new T_check_cast_1(); + String s = ""; + assertEquals(s, t.run(s)); + } + + /** + * @title check null value + */ + public void testN2() { + T_check_cast_1 t = new T_check_cast_1(); + assertNull(t.run(null)); + } + + /** + * @title expected ClassCastException + */ + public void testE1() { + T_check_cast_1 t = new T_check_cast_1(); + try { + t.run(this); + fail("expected ClassCastException"); + } catch (ClassCastException iae) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/check_cast/jm/T_check_cast_1.java b/jack-tests/tests/com/android/jack/opcodes/check_cast/jm/T_check_cast_1.java new file mode 100644 index 0000000..ff46b2b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/check_cast/jm/T_check_cast_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.check_cast.jm; + +public class T_check_cast_1 { + + public String run(Object o) { + return (String)o; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmp_long/Test_cmp_long.java b/jack-tests/tests/com/android/jack/opcodes/cmp_long/Test_cmp_long.java new file mode 100644 index 0000000..ceba8a9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmp_long/Test_cmp_long.java @@ -0,0 +1,124 @@ +/* + * 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.jack.opcodes.cmp_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.cmp_long.jm.T_cmp_long_1; +import com.android.jack.opcodes.cmp_long.jm.T_cmp_long_3; +import com.android.jack.opcodes.cmp_long.jm.T_cmp_long_4; +import com.android.jack.opcodes.cmp_long.jm.T_cmp_long_5; + + +public class Test_cmp_long extends DxTestCase { + + /** + * @title Arguments = 111234567891l > 111234567890l + */ + public void testN1() { + T_cmp_long_1 t = new T_cmp_long_1(); + assertEquals(1, t.run(111234567891l, 111234567890l)); + } + + /** + * @title Arguments = 112234567890 == 112234567890 + */ + public void testN2() { + T_cmp_long_1 t = new T_cmp_long_1(); + assertEquals(0, t.run(112234567890l, 112234567890l)); + } + + /** + * @title Arguments = 112234567890 < 998876543210 + */ + public void testN3() { + T_cmp_long_1 t = new T_cmp_long_1(); + assertEquals(-1, t.run(112234567890l, 998876543210l)); + } + + /** + * @title Arguments = 112234567890 < 998876543210 + */ + public void testN4() { + T_cmp_long_3 t = new T_cmp_long_3(); + assertEquals(false, t.run(112234567890l, 998876543210l)); + } + + /** + * @title Arguments = 112234567890 < 998876543210 + */ + public void testN5() { + T_cmp_long_4 t = new T_cmp_long_4(); + assertEquals(false, t.run(112234567890l, 998876543210l)); + } + + /** + * @title Arguments = 11223 < 998876543210 + */ + public void testN6() { + T_cmp_long_5 t = new T_cmp_long_5(); + assertEquals(false, t.run(11223, 998876543210l)); + } + + /** + * @title Arguments = Long.MAX_VALUE > Long.MIN_VALUE + */ + public void testB1() { + T_cmp_long_1 t = new T_cmp_long_1(); + assertEquals(1, t.run(Long.MAX_VALUE, Long.MIN_VALUE)); + } + + /** + * @title Arguments = Long.MIN_VALUE < Long.MAX_VALUE + */ + public void testB2() { + T_cmp_long_1 t = new T_cmp_long_1(); + assertEquals(-1, t.run(Long.MIN_VALUE, Long.MAX_VALUE)); + } + + /** + * @title Arguments = 1 > 0 + */ + public void testB3() { + T_cmp_long_1 t = new T_cmp_long_1(); + assertEquals(1, t.run(1l, 0l)); + } + + /** + * @title Arguments = 0 > -1 + */ + public void testB4() { + T_cmp_long_1 t = new T_cmp_long_1(); + assertEquals(1, t.run(0l, -1l)); + } + + /** + * @title Arguments = -1 < 0 + */ + public void testB5() { + T_cmp_long_1 t = new T_cmp_long_1(); + assertEquals(-1, t.run(-1l, 0l)); + } + + /** + * @title Arguments = 0 = 0 + */ + public void testB6() { + T_cmp_long_1 t = new T_cmp_long_1(); + assertEquals(0, t.run(0l, 0l)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_1.java b/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_1.java new file mode 100644 index 0000000..48d8bb7 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_1.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.cmp_long.jm; + +public class T_cmp_long_1 { + + public int run(long a, long b) { + if (a > b) return 1; + if (a == b) return 0; + return -1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_3.java b/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_3.java new file mode 100644 index 0000000..66bc92a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.cmp_long.jm; + +public class T_cmp_long_3 { + + public boolean run(long a, double b) { + return a > b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_4.java b/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_4.java new file mode 100644 index 0000000..c802853 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.cmp_long.jm; + +public class T_cmp_long_4 { + + public boolean run(float a, long b) { + return a > b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_5.java b/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_5.java new file mode 100644 index 0000000..c685846 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.cmp_long.jm; + +public class T_cmp_long_5 { + + public boolean run(int a, long b) { + return a > b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpg_double/Test_cmpg_double.java b/jack-tests/tests/com/android/jack/opcodes/cmpg_double/Test_cmpg_double.java new file mode 100644 index 0000000..8f3e154 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpg_double/Test_cmpg_double.java @@ -0,0 +1,99 @@ +/* + * 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.jack.opcodes.cmpg_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.cmpg_double.jm.T_cmpg_double_1; +import com.android.jack.opcodes.cmpg_double.jm.T_cmpg_double_2; + + +public class Test_cmpg_double extends DxTestCase { + + /** + * @title Arguments = 3.14d, 2.7d + */ + public void testN1() { + T_cmpg_double_1 t = new T_cmpg_double_1(); + assertEquals(1, t.run(3.14d, 2.7d)); + } + + /** + * @title Arguments = -3.14d, 2.7d + */ + public void testN2() { + T_cmpg_double_1 t = new T_cmpg_double_1(); + assertEquals(-1, t.run(-3.14d, 2.7d)); + } + + /** + * @title Arguments = 3.14, 3.14 + */ + public void testN3() { + T_cmpg_double_1 t = new T_cmpg_double_1(); + assertEquals(0, t.run(3.14d, 3.14d)); + } + + /** + * @title Arguments = 3.14, 3.14 + */ + public void testN4() { + T_cmpg_double_2 t = new T_cmpg_double_2(); + assertEquals(false, t.run(3.14d, 3.14d)); + } + +// /** +// * @title Arguments = Double.NaN, Double.MAX_VALUE +// */ +// public void testB1() { +// T_cmpg_double_1 t = new T_cmpg_double_1(); +// assertEquals(1, t.run(Double.NaN, Double.MAX_VALUE)); +// } + + /** + * @title Arguments = +0, -0 + */ + public void testB2() { + T_cmpg_double_1 t = new T_cmpg_double_1(); + assertEquals(0, t.run(+0f, -0f)); + } + + /** + * @title Arguments = Double.NEGATIVE_INFINITY, Double.MIN_VALUE + */ + public void testB3() { + T_cmpg_double_1 t = new T_cmpg_double_1(); + assertEquals(-1, t.run(Double.NEGATIVE_INFINITY, Double.MIN_VALUE)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, Double.MAX_VALUE + */ + public void testB4() { + T_cmpg_double_1 t = new T_cmpg_double_1(); + assertEquals(1, t.run(Double.POSITIVE_INFINITY, Double.MAX_VALUE)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, + * Double.NEGATIVE_INFINITY + */ + public void testB5() { + T_cmpg_double_1 t = new T_cmpg_double_1(); + assertEquals(1, t.run(Double.POSITIVE_INFINITY, + Double.NEGATIVE_INFINITY)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpg_double/jm/T_cmpg_double_1.java b/jack-tests/tests/com/android/jack/opcodes/cmpg_double/jm/T_cmpg_double_1.java new file mode 100644 index 0000000..2256452 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpg_double/jm/T_cmpg_double_1.java @@ -0,0 +1,28 @@ +/* + * 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.jack.opcodes.cmpg_double.jm; + +public class T_cmpg_double_1 { + + public int run(double a, double b) { + if(a > b) + return 1; + if(a == b) + return 0; + return -1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpg_double/jm/T_cmpg_double_2.java b/jack-tests/tests/com/android/jack/opcodes/cmpg_double/jm/T_cmpg_double_2.java new file mode 100644 index 0000000..0d76b00 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpg_double/jm/T_cmpg_double_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.cmpg_double.jm; + +public class T_cmpg_double_2 { + + public boolean run(double a, double b) { + return a > b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpg_float/Test_cmpg_float.java b/jack-tests/tests/com/android/jack/opcodes/cmpg_float/Test_cmpg_float.java new file mode 100644 index 0000000..04bc6c9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpg_float/Test_cmpg_float.java @@ -0,0 +1,90 @@ +/* + * 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.jack.opcodes.cmpg_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.cmpg_float.jm.T_cmpg_float_1; +import com.android.jack.opcodes.cmpg_float.jm.T_cmpg_float_2; + + +public class Test_cmpg_float extends DxTestCase { + + /** + * @title Arguments = 3.14f, 2.7f + */ + public void testN1() { + T_cmpg_float_1 t = new T_cmpg_float_1(); + assertEquals(1, t.run(3.14f, 2.7f)); + } + + /** + * @title Arguments = -3.14f, 2.7f + */ + public void testN2() { + T_cmpg_float_1 t = new T_cmpg_float_1(); + assertEquals(-1, t.run(-3.14f, 2.7f)); + } + + /** + * @title Arguments = 3.14, 3.14 + */ + public void testN3() { + T_cmpg_float_1 t = new T_cmpg_float_1(); + assertEquals(0, t.run(3.14f, 3.14f)); + } + + /** + * @title Arguments = 3.14, 3.14 + */ + public void testN4() { + T_cmpg_float_2 t = new T_cmpg_float_2(); + assertEquals(false, t.run(3.14f, 3.14f)); + } + + /** + * @title Arguments = +0, -0 + */ + public void testB2() { + T_cmpg_float_1 t = new T_cmpg_float_1(); + assertEquals(0, t.run(+0f, -0f)); + } + + /** + * @title Arguments = Float.NEGATIVE_INFINITY, Float.MIN_VALUE + */ + public void testB3() { + T_cmpg_float_1 t = new T_cmpg_float_1(); + assertEquals(-1, t.run(Float.NEGATIVE_INFINITY, Float.MIN_VALUE)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, Float.MAX_VALUE + */ + public void testB4() { + T_cmpg_float_1 t = new T_cmpg_float_1(); + assertEquals(1, t.run(Float.POSITIVE_INFINITY, Float.MAX_VALUE)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, + * Float.NEGATIVE_INFINITY + */ + public void testB5() { + T_cmpg_float_1 t = new T_cmpg_float_1(); + assertEquals(1, t.run(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpg_float/jm/T_cmpg_float_1.java b/jack-tests/tests/com/android/jack/opcodes/cmpg_float/jm/T_cmpg_float_1.java new file mode 100644 index 0000000..b6e8c8c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpg_float/jm/T_cmpg_float_1.java @@ -0,0 +1,28 @@ +/* + * 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.jack.opcodes.cmpg_float.jm; + +public class T_cmpg_float_1 { + + public int run(float a, float b) { + if(a > b) + return 1; + if(a == b) + return 0; + return -1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpg_float/jm/T_cmpg_float_2.java b/jack-tests/tests/com/android/jack/opcodes/cmpg_float/jm/T_cmpg_float_2.java new file mode 100644 index 0000000..a6eee61 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpg_float/jm/T_cmpg_float_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.cmpg_float.jm; + +public class T_cmpg_float_2 { + + public boolean run(float a, float b) { + return a > b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpl_double/Test_cmpl_double.java b/jack-tests/tests/com/android/jack/opcodes/cmpl_double/Test_cmpl_double.java new file mode 100644 index 0000000..0dbfe1e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpl_double/Test_cmpl_double.java @@ -0,0 +1,32 @@ +/* + * 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.jack.opcodes.cmpl_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.cmpl_double.jm.T_cmpl_double_1; + + +public class Test_cmpl_double extends DxTestCase { + + /** + * @title Arguments = Double.NaN, Double.MAX_VALUE + */ + public void testB1() { + T_cmpl_double_1 t = new T_cmpl_double_1(); + assertEquals(-1, t.run(Double.NaN, Double.MAX_VALUE)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpl_double/jm/T_cmpl_double_1.java b/jack-tests/tests/com/android/jack/opcodes/cmpl_double/jm/T_cmpl_double_1.java new file mode 100644 index 0000000..ea8b756 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpl_double/jm/T_cmpl_double_1.java @@ -0,0 +1,28 @@ +/* + * 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.jack.opcodes.cmpl_double.jm; + +public class T_cmpl_double_1 { + + public int run(double a, double b) { + if(a > b) + return 1; + if(a == b) + return 0; + return -1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpl_float/Test_cmpl_float.java b/jack-tests/tests/com/android/jack/opcodes/cmpl_float/Test_cmpl_float.java new file mode 100644 index 0000000..e4cd500 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpl_float/Test_cmpl_float.java @@ -0,0 +1,98 @@ +/* + * 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.jack.opcodes.cmpl_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.cmpl_float.jm.T_cmpl_float_1; +import com.android.jack.opcodes.cmpl_float.jm.T_cmpl_float_2; + + +public class Test_cmpl_float extends DxTestCase { + + /** + * @title Arguments = 3.14f, 2.7f + */ + public void testN1() { + T_cmpl_float_1 t = new T_cmpl_float_1(); + assertEquals(1, t.run(3.14f, 2.7f)); + } + + /** + * @title Arguments = -3.14f, 2.7f + */ + public void testN2() { + T_cmpl_float_1 t = new T_cmpl_float_1(); + assertEquals(-1, t.run(-3.14f, 2.7f)); + } + + /** + * @title Arguments = 3.14, 3.14 + */ + public void testN3() { + T_cmpl_float_1 t = new T_cmpl_float_1(); + assertEquals(0, t.run(3.14f, 3.14f)); + } + + /** + * @title Arguments = 3.14, 3.14 + */ + public void testN4() { + T_cmpl_float_2 t = new T_cmpl_float_2(); + assertEquals(false, t.run(3.14f, 3.14f)); + } + + /** + * @title Arguments = Float.NaN, Float.MAX_VALUE + */ + public void testB1() { + T_cmpl_float_1 t = new T_cmpl_float_1(); + assertEquals(-1, t.run(Float.NaN, Float.MAX_VALUE)); + } + + /** + * @title Arguments = +0, -0 + */ + public void testB2() { + T_cmpl_float_1 t = new T_cmpl_float_1(); + assertEquals(0, t.run(+0f, -0f)); + } + + /** + * @title Arguments = Float.NEGATIVE_INFINITY, Float.MIN_VALUE + */ + public void testB3() { + T_cmpl_float_1 t = new T_cmpl_float_1(); + assertEquals(-1, t.run(Float.NEGATIVE_INFINITY, Float.MIN_VALUE)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, Float.MAX_VALUE + */ + public void testB4() { + T_cmpl_float_1 t = new T_cmpl_float_1(); + assertEquals(1, t.run(Float.POSITIVE_INFINITY, Float.MAX_VALUE)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, + * Float.NEGATIVE_INFINITY + */ + public void testB5() { + T_cmpl_float_1 t = new T_cmpl_float_1(); + assertEquals(1, t.run(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpl_float/jm/T_cmpl_float_1.java b/jack-tests/tests/com/android/jack/opcodes/cmpl_float/jm/T_cmpl_float_1.java new file mode 100644 index 0000000..87ba296 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpl_float/jm/T_cmpl_float_1.java @@ -0,0 +1,28 @@ +/* + * 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.jack.opcodes.cmpl_float.jm; + +public class T_cmpl_float_1 { + + public int run(float a, float b) { + if(a > b) + return 1; + if(a == b) + return 0; + return -1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/cmpl_float/jm/T_cmpl_float_2.java b/jack-tests/tests/com/android/jack/opcodes/cmpl_float/jm/T_cmpl_float_2.java new file mode 100644 index 0000000..80288b3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/cmpl_float/jm/T_cmpl_float_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.cmpl_float.jm; + +public class T_cmpl_float_2 { + + public boolean run(float a, float b) { + return a > b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/Test_const4_16.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/Test_const4_16.java new file mode 100644 index 0000000..eb5180a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/Test_const4_16.java @@ -0,0 +1,206 @@ +/* + * 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.jack.opcodes.const4_16; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_1; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_10; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_11; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_12; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_13; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_14; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_15; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_16; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_2; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_3; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_4; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_5; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_6; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_7; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_8; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_9; +import com.android.jack.opcodes.const4_16.jm.T_const4_16_17; + + +public class Test_const4_16 extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_const4_16_1 t = new T_const4_16_1(); + assertEquals(100, t.run()); + } + + /** + * @title normal test + */ + public void testB1() { + T_const4_16_2 t = new T_const4_16_2(); + assertEquals(0, t.run()); + } + + /** + * @title normal test + */ + public void testB2() { + T_const4_16_3 t = new T_const4_16_3(); + assertEquals(-1, t.run()); + } + + /** + * @title normal test + */ + public void testB3() { + T_const4_16_4 t = new T_const4_16_4(); + assertEquals(1, t.run()); + } + + /** + * @title const/16 -13570 + */ + public void testN2() { + T_const4_16_5 t = new T_const4_16_5(); + assertEquals(-13570, t.run()); + } + + /** + * @title const/4 0 + */ + public void testB4() { + T_const4_16_6 t = new T_const4_16_6(); + assertEquals(0, t.run()); + } + + /** + * @title const/4 - 1 + */ + public void testB5() { + T_const4_16_7 t = new T_const4_16_7(); + assertEquals(-1, t.run()); + } + + /** + * @title normal test + */ + public void testN3() { + T_const4_16_8 t = new T_const4_16_8(); + int b = 1234; + int c = 1234; + int d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title normal test + */ + public void testN4() { + T_const4_16_9 t = new T_const4_16_9(); + int b = 1235; + int c = 1234; + int d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title normal test + */ + public void testN5() { + T_const4_16_10 t = new T_const4_16_10(); + int b = 1236; + int c = 1234; + int d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title normal test + */ + public void testN6() { + T_const4_16_11 t = new T_const4_16_11(); + int b = 1237; + int c = 1234; + int d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title normal test + */ + public void testN7() { + T_const4_16_12 t = new T_const4_16_12(); + int b = 1238; + int c = 1234; + int d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title normal test + */ + public void testN8() { + T_const4_16_13 t = new T_const4_16_13(); + int b = 1239; + int c = 1234; + int d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title normal test + */ + public void testN9() { + T_const4_16_14 t = new T_const4_16_14(); + int b = 1233; + int c = 1234; + int d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title normal test + */ + public void testN1Float_0() { + T_const4_16_15 t = new T_const4_16_15(); + float b = 1234f; + float c = 1234f; + float d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title normal test + */ + public void testN1Float_1() { + T_const4_16_16 t = new T_const4_16_16(); + float b = 1235f; + float c = 1234f; + float d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title normal test + */ + public void testN1Float_2() { + T_const4_16_17 t = new T_const4_16_17(); + float b = 1236f; + float c = 1234f; + float d = b - c; + assertEquals(d, t.run()); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_1.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_1.java new file mode 100644 index 0000000..89028dd --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_1 { + + public byte run() { + return (byte)100; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_10.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_10.java new file mode 100644 index 0000000..623ecb5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_10.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_10 { + + public int run() { + return 2; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_11.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_11.java new file mode 100644 index 0000000..0acde01 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_11.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_11 { + + public int run() { + return 3; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_12.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_12.java new file mode 100644 index 0000000..89dedda --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_12.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_12 { + + public int run() { + return 4; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_13.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_13.java new file mode 100644 index 0000000..d3bfa59 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_13.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_13 { + + public int run() { + return 5; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_14.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_14.java new file mode 100644 index 0000000..2007bab --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_14.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_14 { + + public int run() { + return -1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_15.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_15.java new file mode 100644 index 0000000..67cf654 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_15.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_15 { + + public float run() { + return 0f; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_16.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_16.java new file mode 100644 index 0000000..856e141 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_16.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_16 { + + public float run() { + return 1f; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_17.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_17.java new file mode 100644 index 0000000..87e08a3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_17.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_17 { + + public float run() { + return 2f; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_2.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_2.java new file mode 100644 index 0000000..26d6a72 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_2 { + + public byte run() { + return 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_3.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_3.java new file mode 100644 index 0000000..c5b38d1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_3 { + + public byte run() { + return -1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_4.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_4.java new file mode 100644 index 0000000..cb6a3b0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_4 { + + public byte run() { + return 1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_5.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_5.java new file mode 100644 index 0000000..648d4c3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_5 { + + public short run() { + return (short)0xcafe; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_6.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_6.java new file mode 100644 index 0000000..0aa7072 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_6 { + + public short run() { + return 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_7.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_7.java new file mode 100644 index 0000000..17a78b7 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_7.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_7 { + + public short run() { + return -1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_8.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_8.java new file mode 100644 index 0000000..ea6b262 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_8.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_8 { + + public int run() { + return 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_9.java b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_9.java new file mode 100644 index 0000000..d159f53 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_9.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const4_16.jm; + +public class T_const4_16_9 { + + public int run() { + return 1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_string/Test_const_string.java b/jack-tests/tests/com/android/jack/opcodes/const_string/Test_const_string.java new file mode 100644 index 0000000..ee1170f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_string/Test_const_string.java @@ -0,0 +1,36 @@ +/* + * 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.jack.opcodes.const_string; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.const_string.jm.T_const_string_1; + + +public class Test_const_string extends DxTestCase { + + /** + * @title push string into stack + */ + public void testN1() { + T_const_string_1 t = new T_const_string_1(); + // lcd is hard to test isolated + String res = t.run(); + assertEquals(5, res.length()); + assertEquals('h', res.charAt(0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_string/jm/T_const_string_1.java b/jack-tests/tests/com/android/jack/opcodes/const_string/jm/T_const_string_1.java new file mode 100644 index 0000000..0d83b27 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_string/jm/T_const_string_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const_string.jm; + +public class T_const_string_1 { + + public String run() { + return "hello"; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_wide/Test_const_wide.java b/jack-tests/tests/com/android/jack/opcodes/const_wide/Test_const_wide.java new file mode 100644 index 0000000..e9b7f6f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_wide/Test_const_wide.java @@ -0,0 +1,92 @@ +/* + * 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.jack.opcodes.const_wide; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.const_wide.jm.T_const_wide_1; +import com.android.jack.opcodes.const_wide.jm.T_const_wide_2; +import com.android.jack.opcodes.const_wide.jm.T_const_wide_3; +import com.android.jack.opcodes.const_wide.jm.T_const_wide_4; +import com.android.jack.opcodes.const_wide.jm.T_const_wide_5; +import com.android.jack.opcodes.const_wide.jm.T_const_wide_6; +import com.android.jack.opcodes.const_wide.jm.T_const_wide_7; + + +public class Test_const_wide extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_const_wide_1 t = new T_const_wide_1(); + long a = 20l; + long b = 20l; + assertEquals(a - b, t.run()); + } + + /** + * @title normal test + */ + public void testN2() { + T_const_wide_2 t = new T_const_wide_2(); + long a = 20l; + long b = 19l; + assertEquals(a - b, t.run()); + } + + /** + * @title normal test + */ + public void testN3() { + T_const_wide_3 t = new T_const_wide_3(); + double b = 1234d; + double c = 1234d; + double d = b - c; + assertEquals(d, t.run()); + } + + /** + * @title push long into stack + */ + public void testN4() { + T_const_wide_4 t = new T_const_wide_4(); + long a = 1234567890122l; + long b = 1l; + assertEquals(a + b, t.run()); + } + + /** + * @title push double into stack + */ + public void testN5() { + T_const_wide_5 t = new T_const_wide_5(); + double a = 1234567890123232323232232323232323232323232323456788d; + double b = 1d; + assertEquals(a + b, t.run(), 0d); + } + + public void testN6() { + T_const_wide_6 t = new T_const_wide_6(); + assertEquals(1234567890123l, t.run()); + } + + public void testN7() { + T_const_wide_7 t = new T_const_wide_7(); + assertEquals(9876543210123l, t.run()); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_1.java b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_1.java new file mode 100644 index 0000000..d4ef38b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const_wide.jm; + +public class T_const_wide_1 { + + public long run() { + return 0l; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_2.java b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_2.java new file mode 100644 index 0000000..bc0b043 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const_wide.jm; + +public class T_const_wide_2 { + + public long run() { + return 1l; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_3.java b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_3.java new file mode 100644 index 0000000..99ee714 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const_wide.jm; + +public class T_const_wide_3 { + + public double run() { + return 0d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_4.java b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_4.java new file mode 100644 index 0000000..b5cddde --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const_wide.jm; + +public class T_const_wide_4 { + + public long run() { + return 1234567890123l; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_5.java b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_5.java new file mode 100644 index 0000000..9c9684d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const_wide.jm; + +public class T_const_wide_5 { + + public double run() { + return 1234567890123232323232232323232323232323232323456789d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_6.java b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_6.java new file mode 100644 index 0000000..08d81c0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const_wide.jm; + +public class T_const_wide_6 { + + public long run() { + return 1234567890123l; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_7.java b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_7.java new file mode 100644 index 0000000..798ccca --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_7.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.const_wide.jm; + +public class T_const_wide_7 { + + public long run() { + return 9876543210123l; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_double/Test_div_double.java b/jack-tests/tests/com/android/jack/opcodes/div_double/Test_div_double.java new file mode 100644 index 0000000..55865ce --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_double/Test_div_double.java @@ -0,0 +1,146 @@ +/* + * 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.jack.opcodes.div_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.div_double.jm.T_div_double_1; +import com.android.jack.opcodes.div_double.jm.T_div_double_3; +import com.android.jack.opcodes.div_double.jm.T_div_double_4; + + +public class Test_div_double extends DxTestCase { + + /** + * @title Arguments = 2.7d, 3.14d + */ + public void testN1() { + + T_div_double_1 t = new T_div_double_1(); + assertEquals(0.8598726114649682d, t.run(2.7d, 3.14d)); + } + + /** + * @title Dividend = 0 + */ + public void testN2() { + T_div_double_1 t = new T_div_double_1(); + assertEquals(0d, t.run(0, 3.14d)); + } + + /** + * @title Dividend is negative + */ + public void testN3() { + + T_div_double_1 t = new T_div_double_1(); + assertEquals(-1.162962962962963d, t.run(-3.14d, 2.7d)); + } + + /** + * @title Dividend is negative + */ + public void testN4() { + + T_div_double_1 t = new T_div_double_1(); + assertEquals(-1.162962962962963d, t.run(-3.14d, 2.7d)); + } + + /** + * @title Dividend is negative + */ + public void testN5() { + + T_div_double_3 t = new T_div_double_3(); + assertEquals(-1.162963001816361d, t.run(-3.14f, 2.7d)); + } + + /** + * @title Dividend is negative + */ + public void testN6() { + + T_div_double_4 t = new T_div_double_4(); + assertEquals(-116.29629629629629d, t.run(-314l, 2.7d)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, + * Double.NEGATIVE_INFINITY + */ + public void testB2() { + T_div_double_1 t = new T_div_double_1(); + assertEquals(Double.NaN, t.run(Double.POSITIVE_INFINITY, + Double.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, -2.7d + */ + public void testB3() { + T_div_double_1 t = new T_div_double_1(); + assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.POSITIVE_INFINITY, + -2.7d)); + } + + /** + * @title Arguments = -2.7d, Double.NEGATIVE_INFINITY + */ + public void testB4() { + T_div_double_1 t = new T_div_double_1(); + assertEquals(0d, t.run(-2.7d, Double.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_div_double_1 t = new T_div_double_1(); + assertEquals(Double.NaN, t.run(0, 0)); + } + + /** + * @title Arguments = 0, -2.7 + */ + public void testB6() { + T_div_double_1 t = new T_div_double_1(); + assertEquals(-0d, t.run(0, -2.7d)); + } + + /** + * @title Arguments = -2.7, 0 + */ + public void testB7() { + T_div_double_1 t = new T_div_double_1(); + assertEquals(Double.NEGATIVE_INFINITY, t.run(-2.7d, 0)); + } + + /** + * @title Arguments = 1, Double.MAX_VALUE + */ + public void testB8() { + T_div_double_1 t = new T_div_double_1(); + assertEquals(Double.POSITIVE_INFINITY, t.run(1, Double.MIN_VALUE)); + } + + /** + * @title Arguments = Double.MAX_VALUE, -1E-9f + */ + public void testB9() { + T_div_double_1 t = new T_div_double_1(); + assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.MAX_VALUE, -1E-9f)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_double/jm/T_div_double_1.java b/jack-tests/tests/com/android/jack/opcodes/div_double/jm/T_div_double_1.java new file mode 100644 index 0000000..2a51de6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_double/jm/T_div_double_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_double.jm; + +public class T_div_double_1 { + + public double run(double a, double b) { + return a/b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_double/jm/T_div_double_3.java b/jack-tests/tests/com/android/jack/opcodes/div_double/jm/T_div_double_3.java new file mode 100644 index 0000000..9743665 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_double/jm/T_div_double_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_double.jm; + +public class T_div_double_3 { + + public double run(float a, double b) { + return (double)a/b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_double/jm/T_div_double_4.java b/jack-tests/tests/com/android/jack/opcodes/div_double/jm/T_div_double_4.java new file mode 100644 index 0000000..a0e2abf --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_double/jm/T_div_double_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_double.jm; + +public class T_div_double_4 { + + public double run(long a, double b) { + return (double)a/b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_float/Test_div_float.java b/jack-tests/tests/com/android/jack/opcodes/div_float/Test_div_float.java new file mode 100644 index 0000000..fbce8c9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_float/Test_div_float.java @@ -0,0 +1,141 @@ +/* + * 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.jack.opcodes.div_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.div_float.jm.T_div_float_1; +import com.android.jack.opcodes.div_float.jm.T_div_float_3; +import com.android.jack.opcodes.div_float.jm.T_div_float_4; + + +public class Test_div_float extends DxTestCase { + + /** + * @title Arguments = 2.7f, 3.14f + */ + public void testN1() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(0.8598726f, t.run(2.7f, 3.14f)); + } + + /** + * @title Dividend = 0 + */ + public void testN2() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(0f, t.run(0, 3.14f)); + } + + /** + * @title Dividend is negative + */ + public void testN3() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(-1.162963f, t.run(-3.14f, 2.7f)); + } + + /** + * @title Dividend is negative + */ + public void testN4() { + T_div_float_3 t = new T_div_float_3(); + assertEquals(-1.162963f, t.run(-3.14f, 2.7f)); + } + + /** + * @title Dividend is negative + */ + public void testN5() { + T_div_float_4 t = new T_div_float_4(); + assertEquals(-116.296295f, t.run(-314l, 2.7f)); + } + + /** + * @title Arguments = Float.MAX_VALUE, Float.NaN + */ + public void testB1() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(Float.NaN, t.run(Float.MAX_VALUE, Float.NaN)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, + * Float.NEGATIVE_INFINITY + */ + public void testB2() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(Float.NaN, t.run(Float.POSITIVE_INFINITY, + Float.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, -2.7f + */ + public void testB3() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(Float.NEGATIVE_INFINITY, t.run(Float.POSITIVE_INFINITY, + -2.7f)); + } + + /** + * @title Arguments = -2.7f, Float.NEGATIVE_INFINITY + */ + public void testB4() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(0f, t.run(-2.7f, Float.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(Float.NaN, t.run(0, 0)); + } + + /** + * @title Arguments = 0, -2.7 + */ + public void testB6() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(-0f, t.run(0, -2.7f)); + } + + /** + * @title Arguments = -2.7, 0 + */ + public void testB7() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(Float.NEGATIVE_INFINITY, t.run(-2.7f, 0)); + } + + /** + * @title Arguments = 1, Float.MAX_VALUE + */ + public void testB8() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(1, Float.MIN_VALUE)); + } + + /** + * @title Arguments = Float.MAX_VALUE, -1E-9f + */ + public void testB9() { + T_div_float_1 t = new T_div_float_1(); + assertEquals(Float.NEGATIVE_INFINITY, t.run(Float.MAX_VALUE, -1E-9f)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_float/jm/T_div_float_1.java b/jack-tests/tests/com/android/jack/opcodes/div_float/jm/T_div_float_1.java new file mode 100644 index 0000000..52a5b08 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_float/jm/T_div_float_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_float.jm; + +public class T_div_float_1 { + + public float run(float a, float b) { + return a/b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_float/jm/T_div_float_3.java b/jack-tests/tests/com/android/jack/opcodes/div_float/jm/T_div_float_3.java new file mode 100644 index 0000000..2c20734 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_float/jm/T_div_float_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_float.jm; + +public class T_div_float_3 { + + public float run(float a, double b) { + return a/(float)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_float/jm/T_div_float_4.java b/jack-tests/tests/com/android/jack/opcodes/div_float/jm/T_div_float_4.java new file mode 100644 index 0000000..98ed7e3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_float/jm/T_div_float_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_float.jm; + +public class T_div_float_4 { + + public float run(long a, float b) { + return (float)a/b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_int/Test_div_int.java b/jack-tests/tests/com/android/jack/opcodes/div_int/Test_div_int.java new file mode 100644 index 0000000..f1fc30a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_int/Test_div_int.java @@ -0,0 +1,153 @@ +/* + * 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.jack.opcodes.div_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.div_int.jm.T_div_int_1; +import com.android.jack.opcodes.div_int.jm.T_div_int_3; +import com.android.jack.opcodes.div_int.jm.T_div_int_4; + + +public class Test_div_int extends DxTestCase { + + /** + * @title Arguments = 8, 4 + */ + public void testN1() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(2, t.run(8, 4)); + } + + /** + * @title Rounding + */ + public void testN2() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(268435455, t.run(1073741823, 4)); + } + + /** + * @title Dividend = 0 + */ + public void testN3() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(0, t.run(0, 4)); + } + + /** + * @title Dividend is negative + */ + public void testN4() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(-3, t.run(-10, 3)); + } + + /** + * @title Divisor is negative + */ + public void testN5() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(-357913941, t.run(1073741824, -3)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN6() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(5965, t.run(-17895697, -3000)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN7() { + T_div_int_3 t = new T_div_int_3(); + assertEquals(5965, t.run(-17895697, -3000)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN8() { + T_div_int_4 t = new T_div_int_4(); + assertEquals(5965, t.run(-17895697, -3000)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, -1 + */ + public void testB1() { + T_div_int_1 t = new T_div_int_1(); + // result is MIN_VALUE because overflow occurs in this case + assertEquals(Integer.MIN_VALUE, t.run(Integer.MIN_VALUE, -1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, 1 + */ + public void testB2() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(Integer.MIN_VALUE, t.run(Integer.MIN_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, 1 + */ + public void testB3() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(Integer.MAX_VALUE, t.run(Integer.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, Integer.MAX_VALUE + */ + public void testB4() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(-1, t.run(Integer.MIN_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = 1, Integer.MAX_VALUE + */ + public void testB5() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(0, t.run(1, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = 1, Integer.MIN_VALUE + */ + public void testB6() { + T_div_int_1 t = new T_div_int_1(); + assertEquals(0, t.run(1, Integer.MIN_VALUE)); + } + + /** + * @title Divisor is 0 + */ + public void testE1() { + T_div_int_1 t = new T_div_int_1(); + try { + t.run(1, 0); + fail("expected ArithmeticException"); + } catch (ArithmeticException ae) { + // expected + } + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_int/jm/T_div_int_1.java b/jack-tests/tests/com/android/jack/opcodes/div_int/jm/T_div_int_1.java new file mode 100644 index 0000000..d80597e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_int/jm/T_div_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_int.jm; + +public class T_div_int_1 { + + public int run(int a, int b) { + return a/b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_int/jm/T_div_int_3.java b/jack-tests/tests/com/android/jack/opcodes/div_int/jm/T_div_int_3.java new file mode 100644 index 0000000..01c25d6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_int/jm/T_div_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_int.jm; + +public class T_div_int_3 { + + public int run(int a, double b) { + return a/(int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_int/jm/T_div_int_4.java b/jack-tests/tests/com/android/jack/opcodes/div_int/jm/T_div_int_4.java new file mode 100644 index 0000000..5192c1b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_int/jm/T_div_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_int.jm; + +public class T_div_int_4 { + + public int run(long a, int b) { + return (int)a/b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_long/Test_div_long.java b/jack-tests/tests/com/android/jack/opcodes/div_long/Test_div_long.java new file mode 100644 index 0000000..177e10a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_long/Test_div_long.java @@ -0,0 +1,156 @@ +/* + * 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.jack.opcodes.div_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.div_long.jm.T_div_long_1; +import com.android.jack.opcodes.div_long.jm.T_div_long_4; +import com.android.jack.opcodes.div_long.jm.T_div_long_5; +import com.android.jack.opcodes.div_long.jm.T_div_long_6; + + +public class Test_div_long extends DxTestCase { + + /** + * @title Arguments = 100000000000l, 40000000000l + */ + public void testN1() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(2l, t.run(100000000000l, 40000000000l)); + } + + /** + * @title Rounding + */ + public void testN2() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(8l, t.run(98765432123456l, 12345678912345l)); + } + + /** + * @title Dividend = 0 + */ + public void testN3() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(0l, t.run(0l, 98765432123456l)); + } + + /** + * @title Dividend is negative + */ + public void testN4() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(-8, t.run(-98765432123456l, 12345678912345l)); + } + + /** + * @title Divisor is negative + */ + public void testN5() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(-8, t.run(98765432123456l, -12345678912345l)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN6() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(80l, t.run(-98765432123456l, -1234567891234l)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN7() { + T_div_long_4 t = new T_div_long_4(); + assertEquals(80l, t.run(-98765432123456l, -1234567891234l)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN8() { + T_div_long_5 t = new T_div_long_5(); + assertEquals(0, t.run(-9876, -1234567891234l)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN9() { + T_div_long_6 t = new T_div_long_6(); + assertEquals(80l, t.run(-98765432123456l, -1234567891234l)); + } + + /** + * @title Arguments = Long.MIN_VALUE, -1 + */ + public void testB1() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(-9223372036854775808L, t.run(Long.MIN_VALUE, -1)); + } + /** + * @title Arguments = Long.MIN_VALUE, 1 + */ + public void testB2() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(-9223372036854775808L, t.run(Long.MIN_VALUE, 1)); + } + /** + * @title Arguments = Long.MAX_VALUE, 1 + */ + public void testB3() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(9223372036854775807L, t.run(Long.MAX_VALUE, 1)); + } + /** + * @title Arguments = Long.MIN_VALUE, Long.MAX_VALUE + */ + public void testB4() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(-1, t.run(Long.MIN_VALUE, Long.MAX_VALUE)); + } + /** + * @title Arguments = 1, Long.MAX_VALUE + */ + public void testB5() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(0, t.run(1, Long.MAX_VALUE)); + } + /** + * @title Arguments = 1, Long.MIN_VALUE + */ + public void testB6() { + T_div_long_1 t = new T_div_long_1(); + assertEquals(0, t.run(1, Long.MIN_VALUE)); + } + + /** + * @title Divisor is 0 + */ + public void testE1() { + T_div_long_1 t = new T_div_long_1(); + try { + t.run(12345678912345l, 0); + fail("expected ArithmeticException"); + } catch (ArithmeticException ae) { + // expected + } + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_1.java b/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_1.java new file mode 100644 index 0000000..bb38e32 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_1.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.div_long.jm; + + +public class T_div_long_1 { + + public long run(long a, long b) { + return a/b; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_4.java b/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_4.java new file mode 100644 index 0000000..533b348 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_long.jm; + +public class T_div_long_4 { + + public long run(long a, double b) { + return (long)(a/b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_5.java b/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_5.java new file mode 100644 index 0000000..f6dda75 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_long.jm; + +public class T_div_long_5 { + + public long run(int a, long b) { + return a/b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_6.java b/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_6.java new file mode 100644 index 0000000..7c1d9ee --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/div_long/jm/T_div_long_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.div_long.jm; + +public class T_div_long_6 { + + public long run(float a, long b) { + return (long)(a/b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_float/Test_double_to_float.java b/jack-tests/tests/com/android/jack/opcodes/double_to_float/Test_double_to_float.java new file mode 100644 index 0000000..549a2b5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_float/Test_double_to_float.java @@ -0,0 +1,123 @@ +/* + * 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.jack.opcodes.double_to_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.double_to_float.jm.T_double_to_float_1; +import com.android.jack.opcodes.double_to_float.jm.T_double_to_float_3; +import com.android.jack.opcodes.double_to_float.jm.T_double_to_float_4; + + +public class Test_double_to_float extends DxTestCase { + + /** + * @title Argument = 2.71 + */ + public void testN1() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertEquals(2.71f, t.run(2.71d)); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertEquals(1f, t.run(1d)); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertEquals(-1f, t.run(-1d)); + } + + /** + * @title Argument = 271 + */ + public void testN4() { + T_double_to_float_3 t = new T_double_to_float_3(); + assertEquals(271f, t.run(271l)); + } + + /** + * @title Argument = 271 + */ + public void testN5() { + T_double_to_float_4 t = new T_double_to_float_4(); + assertEquals(271f, t.run(271l)); + } + + /** + * @title Argument = Double.MAX_VALUE + */ + public void testB1() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(Double.MAX_VALUE)); + } + + /** + * @title Argument = Double.MIN_VALUE + */ + public void testB2() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertEquals(0f, t.run(Double.MIN_VALUE)); + } + + /** + * @title Argument = -0 + */ + public void testB3() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertEquals(-0f, t.run(-0d)); + } + + /** + * @title Argument = NaN + */ + public void testB4() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertTrue(Float.isNaN(t.run(Double.NaN))); + } + + /** + * @title Argument = POSITIVE_INFINITY + */ + public void testB5() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertTrue(Float.isInfinite(t.run(Double.POSITIVE_INFINITY))); + } + + /** + * @title Argument = NEGATIVE_INFINITY + */ + public void testB6() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertTrue(Float.isInfinite(t.run(Double.NEGATIVE_INFINITY))); + } + + + /** + * @title Argument = -Double.MIN_VALUE + */ + public void testB7() { + T_double_to_float_1 t = new T_double_to_float_1(); + assertEquals(-0f, t.run(-4.9E-324d)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_1.java b/jack-tests/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_1.java new file mode 100644 index 0000000..09b4840 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.double_to_float.jm; + +public class T_double_to_float_1 { + + public float run(double a) { + return (float)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_3.java b/jack-tests/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_3.java new file mode 100644 index 0000000..50e8c1c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.double_to_float.jm; + +public class T_double_to_float_3 { + + public float run(float a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_4.java b/jack-tests/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_4.java new file mode 100644 index 0000000..82ec04b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.double_to_float.jm; + +public class T_double_to_float_4 { + + public float run(long a) { + return (float) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_int/Test_double_to_int.java b/jack-tests/tests/com/android/jack/opcodes/double_to_int/Test_double_to_int.java new file mode 100644 index 0000000..b9bd1e4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_int/Test_double_to_int.java @@ -0,0 +1,114 @@ +/* + * 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.jack.opcodes.double_to_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.double_to_int.jm.T_double_to_int_1; +import com.android.jack.opcodes.double_to_int.jm.T_double_to_int_3; +import com.android.jack.opcodes.double_to_int.jm.T_double_to_int_4; + + +public class Test_double_to_int extends DxTestCase { + + /** + * @title Argument = 2.9999999d + */ + public void testN1() { + T_double_to_int_1 t = new T_double_to_int_1(); + assertEquals(2, t.run(2.9999999d)); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_double_to_int_1 t = new T_double_to_int_1(); + assertEquals(1, t.run(1d)); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_double_to_int_1 t = new T_double_to_int_1(); + assertEquals(-1, t.run(-1d)); + } + + /** + * @title Argument = -1 + */ + public void testN4() { + T_double_to_int_3 t = new T_double_to_int_3(); + assertEquals(-1, t.run(-1l)); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_double_to_int_4 t = new T_double_to_int_4(); + assertEquals(-1, t.run(-1l)); + } + + /** + * @title Argument = -0 + */ + public void testB1() { + T_double_to_int_1 t = new T_double_to_int_1(); + assertEquals(0, t.run(-0d)); + } + + /** + * @title Argument = Double.MAX_VALUE + */ + public void testB2() { + T_double_to_int_1 t = new T_double_to_int_1(); + assertEquals(Integer.MAX_VALUE, t.run(Double.MAX_VALUE)); + } + + /** + * @title Argument = Double.MIN_VALUE + */ + public void testB3() { + T_double_to_int_1 t = new T_double_to_int_1(); + assertEquals(0, t.run(Double.MIN_VALUE)); + } + + /** + * @title Argument = NaN + */ + public void testB4() { + T_double_to_int_1 t = new T_double_to_int_1(); + assertEquals(0, t.run(Double.NaN)); + } + + /** + * @title Argument = POSITIVE_INFINITY + */ + public void testB5() { + T_double_to_int_1 t = new T_double_to_int_1(); + assertEquals(Integer.MAX_VALUE, t.run(Double.POSITIVE_INFINITY)); + } + + /** + * @title Argument = NEGATIVE_INFINITY + */ + public void testB6() { + T_double_to_int_1 t = new T_double_to_int_1(); + assertEquals(Integer.MIN_VALUE, t.run(Double.NEGATIVE_INFINITY)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_1.java b/jack-tests/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_1.java new file mode 100644 index 0000000..5bec311 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.double_to_int.jm; + +public class T_double_to_int_1 { + + public int run(double a) { + return (int)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_3.java b/jack-tests/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_3.java new file mode 100644 index 0000000..3741f38 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.double_to_int.jm; + +public class T_double_to_int_3 { + + public int run(float a) { + return (int)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_4.java b/jack-tests/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_4.java new file mode 100644 index 0000000..6368473 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.double_to_int.jm; + +public class T_double_to_int_4 { + + public int run(long a) { + return (int)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_long/Test_double_to_long.java b/jack-tests/tests/com/android/jack/opcodes/double_to_long/Test_double_to_long.java new file mode 100644 index 0000000..efed44b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_long/Test_double_to_long.java @@ -0,0 +1,115 @@ +/* + * 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.jack.opcodes.double_to_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.double_to_long.jm.T_double_to_long_1; +import com.android.jack.opcodes.double_to_long.jm.T_double_to_long_3; +import com.android.jack.opcodes.double_to_long.jm.T_double_to_long_4; + + +public class Test_double_to_long extends DxTestCase { + + /** + * @title Argument = 2.9999999 + */ + public void testN1() { + T_double_to_long_1 t = new T_double_to_long_1(); + assertEquals(2l, t.run(2.9999999d)); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_double_to_long_1 t = new T_double_to_long_1(); + assertEquals(1l, t.run(1d)); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_double_to_long_1 t = new T_double_to_long_1(); + assertEquals(-1l, t.run(-1d)); + } + + /** + * @title Argument = -1 + */ + public void testN4() { + T_double_to_long_3 t = new T_double_to_long_3(); + assertEquals(-1l, t.run(-1l)); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_double_to_long_4 t = new T_double_to_long_4(); + assertEquals(-1l, t.run(-1l)); + } + + /** + * @title Argument = Double.MAX_VALUE + */ + public void testB1() { + T_double_to_long_1 t = new T_double_to_long_1(); + assertEquals(Long.MAX_VALUE, t.run(Double.MAX_VALUE)); + } + + /** + * @title Argument = Double.MIN_VALUE + */ + public void testB2() { + T_double_to_long_1 t = new T_double_to_long_1(); + assertEquals(0, t.run(Double.MIN_VALUE)); + } + + /** + * @title Argument = -0 + */ + public void testB3() { + T_double_to_long_1 t = new T_double_to_long_1(); + assertEquals(0l, t.run(-0)); + } + + /** + * @title Argument = NaN + */ + public void testB4() { + T_double_to_long_1 t = new T_double_to_long_1(); + assertEquals(0l, t.run(Double.NaN)); + } + + /** + * @title Argument = POSITIVE_INFINITY + */ + public void testB5() { + T_double_to_long_1 t = new T_double_to_long_1(); + assertEquals(Long.MAX_VALUE, t.run(Double.POSITIVE_INFINITY)); + } + + /** + * @title Argument = NEGATIVE_INFINITY + */ + public void testB6() { + T_double_to_long_1 t = new T_double_to_long_1(); + assertEquals(Long.MIN_VALUE, t.run(Double.NEGATIVE_INFINITY)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_1.java b/jack-tests/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_1.java new file mode 100644 index 0000000..eda4031 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.double_to_long.jm; + +public class T_double_to_long_1 { + + public long run(double a) { + return (long)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_3.java b/jack-tests/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_3.java new file mode 100644 index 0000000..149cef2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.double_to_long.jm; + +public class T_double_to_long_3 { + + public long run(float a) { + return (long)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_4.java b/jack-tests/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_4.java new file mode 100644 index 0000000..17d8ba4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.double_to_long.jm; + +public class T_double_to_long_4 { + + public long run(long a) { + return (long)(double)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_double/Test_float_to_double.java b/jack-tests/tests/com/android/jack/opcodes/float_to_double/Test_float_to_double.java new file mode 100644 index 0000000..b8b8bfd --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_double/Test_float_to_double.java @@ -0,0 +1,116 @@ +/* + * 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.jack.opcodes.float_to_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.float_to_double.jm.T_float_to_double_1; +import com.android.jack.opcodes.float_to_double.jm.T_float_to_double_3; +import com.android.jack.opcodes.float_to_double.jm.T_float_to_double_4; + + +public class Test_float_to_double extends DxTestCase { + + /** + * @title Argument = 0.5 + */ + public void testN1() { + T_float_to_double_1 t = new T_float_to_double_1(); + assertEquals(0.5d, t.run(0.5f), 0d); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_float_to_double_1 t = new T_float_to_double_1(); + assertEquals(1d, t.run(1), 0d); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_float_to_double_1 t = new T_float_to_double_1(); + assertEquals(-1d, t.run(-1), 0d); + } + + /** + * @title Argument = -1 + */ + public void testN4() { + T_float_to_double_3 t = new T_float_to_double_3(); + assertEquals(-1d, t.run(-1), 0d); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_float_to_double_4 t = new T_float_to_double_4(); + assertEquals(-1d, t.run(-1), 0d); + } + + /** + * @title Argument = Float.MAX_VALUE + */ + public void testB1() { + T_float_to_double_1 t = new T_float_to_double_1(); + double r = 0x1.fffffeP+127d; + assertEquals(r, t.run(Float.MAX_VALUE), 0d); + } + + /** + * @title Argument = Float.MIN_VALUE + */ + public void testB2() { + T_float_to_double_1 t = new T_float_to_double_1(); + double r = 0x0.000002P-126d; + assertEquals(r, t.run(Float.MIN_VALUE), 0d); + } + + /** + * @title Argument = -0 + */ + public void testB3() { + T_float_to_double_1 t = new T_float_to_double_1(); + assertEquals(-0d, t.run(-0), 0d); + } + + /** + * @title Argument = NaN + */ + public void testB4() { + T_float_to_double_1 t = new T_float_to_double_1(); + assertTrue(Double.isNaN(t.run(Float.NaN))); + } + + /** + * @title Argument = POSITIVE_INFINITY + */ + public void testB5() { + T_float_to_double_1 t = new T_float_to_double_1(); + assertTrue(Double.isInfinite(t.run(Float.POSITIVE_INFINITY))); + } + + /** + * @title Argument = NEGATIVE_INFINITY + */ + public void testB6() { + T_float_to_double_1 t = new T_float_to_double_1(); + assertTrue(Double.isInfinite(t.run(Float.NEGATIVE_INFINITY))); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_1.java b/jack-tests/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_1.java new file mode 100644 index 0000000..586e021 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.float_to_double.jm; + +public class T_float_to_double_1 { + + public double run(float a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_3.java b/jack-tests/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_3.java new file mode 100644 index 0000000..1d76047 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.float_to_double.jm; + +public class T_float_to_double_3 { + + public double run(double a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_4.java b/jack-tests/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_4.java new file mode 100644 index 0000000..a23737b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.float_to_double.jm; + +public class T_float_to_double_4 { + + public double run(long a) { + return (float) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_int/Test_float_to_int.java b/jack-tests/tests/com/android/jack/opcodes/float_to_int/Test_float_to_int.java new file mode 100644 index 0000000..39cc6dd --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_int/Test_float_to_int.java @@ -0,0 +1,114 @@ +/* + * 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.jack.opcodes.float_to_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.float_to_int.jm.T_float_to_int_1; +import com.android.jack.opcodes.float_to_int.jm.T_float_to_int_3; +import com.android.jack.opcodes.float_to_int.jm.T_float_to_int_4; + + +public class Test_float_to_int extends DxTestCase { + + /** + * @title Argument = 2.999999f + */ + public void testN1() { + T_float_to_int_1 t = new T_float_to_int_1(); + assertEquals(2, t.run(2.999999f)); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_float_to_int_1 t = new T_float_to_int_1(); + assertEquals(1, t.run(1f)); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_float_to_int_1 t = new T_float_to_int_1(); + assertEquals(-1, t.run(-1f)); + } + + /** + * @title Argument = -1 + */ + public void testN4() { + T_float_to_int_3 t = new T_float_to_int_3(); + assertEquals(-1, t.run(-1f)); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_float_to_int_4 t = new T_float_to_int_4(); + assertEquals(-1, t.run(-1l)); + } + + /** + * @title Argument = -0f + */ + public void testB1() { + T_float_to_int_1 t = new T_float_to_int_1(); + assertEquals(0, t.run(-0f)); + } + + /** + * @title Argument = Float.MAX_VALUE + */ + public void testB2() { + T_float_to_int_1 t = new T_float_to_int_1(); + assertEquals(Integer.MAX_VALUE, t.run(Float.MAX_VALUE)); + } + + /** + * @title Argument = Float.MIN_VALUE + */ + public void testB3() { + T_float_to_int_1 t = new T_float_to_int_1(); + assertEquals(0, t.run(Float.MIN_VALUE)); + } + + /** + * @title Argument = NaN + */ + public void testB4() { + T_float_to_int_1 t = new T_float_to_int_1(); + assertEquals(0, t.run(Float.NaN)); + } + + /** + * @title Argument = POSITIVE_INFINITY + */ + public void testB5() { + T_float_to_int_1 t = new T_float_to_int_1(); + assertEquals(Integer.MAX_VALUE, t.run(Float.POSITIVE_INFINITY)); + } + + /** + * @title Argument = NEGATIVE_INFINITY + */ + public void testB6() { + T_float_to_int_1 t = new T_float_to_int_1(); + assertEquals(Integer.MIN_VALUE, t.run(Float.NEGATIVE_INFINITY)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_1.java b/jack-tests/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_1.java new file mode 100644 index 0000000..d2714a0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.float_to_int.jm; + +public class T_float_to_int_1 { + + public int run(float a) { + return (int)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_3.java b/jack-tests/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_3.java new file mode 100644 index 0000000..63e70c4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.float_to_int.jm; + +public class T_float_to_int_3 { + + public int run(double a) { + return (int)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_4.java b/jack-tests/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_4.java new file mode 100644 index 0000000..b28ca23 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.float_to_int.jm; + +public class T_float_to_int_4 { + + public int run(long a) { + return (int)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_long/Test_float_to_long.java b/jack-tests/tests/com/android/jack/opcodes/float_to_long/Test_float_to_long.java new file mode 100644 index 0000000..6d942d2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_long/Test_float_to_long.java @@ -0,0 +1,115 @@ +/* + * 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.jack.opcodes.float_to_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.float_to_long.jm.T_float_to_long_1; +import com.android.jack.opcodes.float_to_long.jm.T_float_to_long_3; +import com.android.jack.opcodes.float_to_long.jm.T_float_to_long_4; + + +public class Test_float_to_long extends DxTestCase { + + /** + * @title Argument = 2.999999f + */ + public void testN1() { + T_float_to_long_1 t = new T_float_to_long_1(); + assertEquals(2l, t.run(2.999999f)); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_float_to_long_1 t = new T_float_to_long_1(); + assertEquals(1l, t.run(1)); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_float_to_long_1 t = new T_float_to_long_1(); + assertEquals(-1l, t.run(-1)); + } + + /** + * @title Argument = -1 + */ + public void testN4() { + T_float_to_long_3 t = new T_float_to_long_3(); + assertEquals(-1l, t.run(-1)); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_float_to_long_4 t = new T_float_to_long_4(); + assertEquals(-1l, t.run(-1)); + } + + /** + * @title Argument = Float.MAX_VALUE + */ + public void testB1() { + T_float_to_long_1 t = new T_float_to_long_1(); + assertEquals(Long.MAX_VALUE, t.run(Float.MAX_VALUE)); + } + + /** + * @title Argument = Float.MIN_VALUE + */ + public void testB2() { + T_float_to_long_1 t = new T_float_to_long_1(); + assertEquals(0, t.run(Float.MIN_VALUE)); + } + + /** + * @title Argument = 0 + */ + public void testB3() { + T_float_to_long_1 t = new T_float_to_long_1(); + assertEquals(0l, t.run(0)); + } + + /** + * @title Argument = NaN + */ + public void testB4() { + T_float_to_long_1 t = new T_float_to_long_1(); + assertEquals(0l, t.run(Float.NaN)); + } + + /** + * @title Argument = POSITIVE_INFINITY + */ + public void testB5() { + T_float_to_long_1 t = new T_float_to_long_1(); + assertEquals(Long.MAX_VALUE, t.run(Float.POSITIVE_INFINITY)); + } + + /** + * @title Argument = NEGATIVE_INFINITY + */ + public void testB6() { + T_float_to_long_1 t = new T_float_to_long_1(); + assertEquals(Long.MIN_VALUE, t.run(Float.NEGATIVE_INFINITY)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_1.java b/jack-tests/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_1.java new file mode 100644 index 0000000..fd470ab --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.float_to_long.jm; + +public class T_float_to_long_1 { + + public long run(float a) { + return (long)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_3.java b/jack-tests/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_3.java new file mode 100644 index 0000000..4c7aee7 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.float_to_long.jm; + +public class T_float_to_long_3 { + + public long run(double a) { + return (long)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_4.java b/jack-tests/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_4.java new file mode 100644 index 0000000..4aee445 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.float_to_long.jm; + +public class T_float_to_long_4 { + + public long run(long a) { + return (long)(float)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_eq/Test_if_eq.java b/jack-tests/tests/com/android/jack/opcodes/if_eq/Test_if_eq.java new file mode 100644 index 0000000..5b151a3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_eq/Test_if_eq.java @@ -0,0 +1,133 @@ +/* + * 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.jack.opcodes.if_eq; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_eq.jm.T_if_eq_1; +import com.android.jack.opcodes.if_eq.jm.T_if_eq_2; +import com.android.jack.opcodes.if_eq.jm.T_if_eq_3; + + +public class Test_if_eq extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_if_eq_1 t = new T_if_eq_1(); + String a = "a"; + String b = "b"; + + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_eq instruction + */ + assertEquals(1234, t.run(a, b)); + } + + /** + * @title normal test + */ + public void testN2() { + T_if_eq_1 t = new T_if_eq_1(); + String a = "a"; + assertEquals(1, t.run(a, a)); + } + + public void testN3() { + T_if_eq_2 t = new T_if_eq_2(); + String a = "a"; + assertEquals(true, t.run(a, a)); + } + + /** + * @title Compare with null + */ + public void testB1() { + T_if_eq_1 t = new T_if_eq_1(); + String a = "a"; + assertEquals(1234, t.run(null, a)); + } + + /** + * @title Arguments = 5, 6 + */ + public void testN1Int() { + T_if_eq_3 t = new T_if_eq_3(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_eq instruction + */ + assertEquals(1234, t.run(5, 6)); + } + + /** + * @title Arguments = 0x0f0e0d0c, 0x0f0e0d0c + */ + public void testN2Int() { + T_if_eq_3 t = new T_if_eq_3(); + assertEquals(1, t.run(0x0f0e0d0c, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 5, -5 + */ + public void testN3Int() { + T_if_eq_3 t = new T_if_eq_3(); + assertEquals(1234, t.run(5, -5)); + } + + /** + * @title Arguments = 0x01001234, 0x1234 + */ + public void testN4Int() { + T_if_eq_3 t = new T_if_eq_3(); + assertEquals(1234, t.run(0x01001234, 0x1234)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE + */ + public void testB1Int() { + T_if_eq_3 t = new T_if_eq_3(); + assertEquals(1, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE + */ + public void testB2Int() { + T_if_eq_3 t = new T_if_eq_3(); + assertEquals(1, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE)); + } + + /** + * @title Arguments = 0, 1234567 + */ + public void testB3Int() { + T_if_eq_3 t = new T_if_eq_3(); + assertEquals(1234, t.run(0, 1234567)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB4Int() { + T_if_eq_3 t = new T_if_eq_3(); + assertEquals(1, t.run(0, 0)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_1.java b/jack-tests/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_1.java new file mode 100644 index 0000000..2b759d5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_eq.jm; + +public class T_if_eq_1 { + + public int run(String a, String b) { + return a == b ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_2.java b/jack-tests/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_2.java new file mode 100644 index 0000000..67a5d13 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_eq.jm; + +public class T_if_eq_2 { + + public boolean run(String a, String b) { + return a == b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_3.java b/jack-tests/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_3.java new file mode 100644 index 0000000..66bfdc8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_eq.jm; + +public class T_if_eq_3 { + + public int run(int a, int b) { + return a == b ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_eqz/Test_if_eqz.java b/jack-tests/tests/com/android/jack/opcodes/if_eqz/Test_if_eqz.java new file mode 100644 index 0000000..5f40686 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_eqz/Test_if_eqz.java @@ -0,0 +1,107 @@ +/* + * 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.jack.opcodes.if_eqz; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_eqz.jm.T_if_eqz_1; +import com.android.jack.opcodes.if_eqz.jm.T_if_eqz_2; +import com.android.jack.opcodes.if_eqz.jm.T_if_eqz_3; +import com.android.jack.opcodes.if_eqz.jm.T_if_eqz_4; + + +public class Test_if_eqz extends DxTestCase { + + /** + * @title Argument = 5 + */ + public void testN1() { + T_if_eqz_1 t = new T_if_eqz_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_eqz instruction + */ + assertEquals(1234, t.run(5)); + } + + /** + * @title Argument = 0 + */ + public void testN2() { + T_if_eqz_1 t = new T_if_eqz_1(); + assertEquals(1, t.run(0)); + } + + /** + * @title Arguments = -5 + */ + public void testN3() { + T_if_eqz_1 t = new T_if_eqz_1(); + assertEquals(1234, t.run(-5)); + } + + /** + * @title Arguments = -5 + */ + public void testN4() { + T_if_eqz_2 t = new T_if_eqz_2(); + assertEquals(false, t.run(-5)); + } + + /** + * @title Arguments = Integer.MAX_VALUE + */ + public void testB1() { + T_if_eqz_1 t = new T_if_eqz_1(); + assertEquals(1234, t.run(Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE + */ + public void testB2() { + T_if_eqz_1 t = new T_if_eqz_1(); + assertEquals(1234, t.run(Integer.MIN_VALUE)); + } + + /** + * @title Argument = this + */ + public void testN1Null() { + T_if_eqz_3 t = new T_if_eqz_3(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_eqz instruction + */ + assertEquals(1234, t.run(this)); + } + + /** + * @title Argument = null + */ + public void testN2Null() { + T_if_eqz_3 t = new T_if_eqz_3(); + assertEquals(1, t.run(null)); + } + + /** + * @title Argument = null + */ + public void testN3Null() { + T_if_eqz_4 t = new T_if_eqz_4(); + assertEquals(true, t.run(null)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_1.java b/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_1.java new file mode 100644 index 0000000..ee76303 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_eqz.jm; + +public class T_if_eqz_1 { + + public int run(int a) { + return a == 0 ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_2.java b/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_2.java new file mode 100644 index 0000000..86e1629 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_eqz.jm; + +public class T_if_eqz_2 { + + public boolean run(int a) { + return a == 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_3.java b/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_3.java new file mode 100644 index 0000000..578aa24 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_eqz.jm; + +public class T_if_eqz_3 { + + public int run(Object o) { + return o == null ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_4.java b/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_4.java new file mode 100644 index 0000000..fb52990 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_eqz.jm; + +public class T_if_eqz_4 { + + public boolean run(Object o) { + return o == null; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_ge/Test_if_ge.java b/jack-tests/tests/com/android/jack/opcodes/if_ge/Test_if_ge.java new file mode 100644 index 0000000..004f13b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_ge/Test_if_ge.java @@ -0,0 +1,126 @@ +/* + * 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.jack.opcodes.if_ge; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_ge.jm.T_if_ge_1; +import com.android.jack.opcodes.if_ge.jm.T_if_ge_2; + + +public class Test_if_ge extends DxTestCase { + + /** + * @title Arguments = 5, 6 + */ + public void testN1() { + T_if_ge_1 t = new T_if_ge_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_ge instruction + */ + assertEquals(1234, t.run(5, 6)); + } + + /** + * @title Arguments = 0x0f0e0d0c, 0x0f0e0d0c + */ + public void testN2() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1, t.run(0x0f0e0d0c, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 5, -5 + */ + public void testN3() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1, t.run(5, -5)); + } + + /** + * @title Arguments = 0x0f0e0d0d, 0x0f0e0d0c + */ + public void testN4() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1, t.run(0x0f0e0d0d, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 0x1234, 0x01001234 + */ + public void testN5() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1234, t.run(0x1234, 0x01001234)); + } + + /** + * @title Arguments = -5, 5 + */ + public void testN6() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1234, t.run(-5, 5)); + } + + /** + * @title Arguments = -5, 5 + */ + public void testN7() { + T_if_ge_2 t = new T_if_ge_2(); + assertEquals(false, t.run(-5, 5)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE + */ + public void testB1() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE + */ + public void testB2() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE)); + } + + /** + * @title Arguments = 1234567, 0 + */ + public void testB3() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1, t.run(1234567, 0)); + } + + /** + * @title Arguments = 0, 1234567 + */ + public void testB4() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1234, t.run(0, 1234567)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_if_ge_1 t = new T_if_ge_1(); + assertEquals(1, t.run(0, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_ge/jm/T_if_ge_1.java b/jack-tests/tests/com/android/jack/opcodes/if_ge/jm/T_if_ge_1.java new file mode 100644 index 0000000..06ca508 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_ge/jm/T_if_ge_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_ge.jm; + +public class T_if_ge_1 { + + public int run(int a, int b) { + return a >= b ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_ge/jm/T_if_ge_2.java b/jack-tests/tests/com/android/jack/opcodes/if_ge/jm/T_if_ge_2.java new file mode 100644 index 0000000..8a49b7a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_ge/jm/T_if_ge_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_ge.jm; + +public class T_if_ge_2 { + + public boolean run(int a, int b) { + return a >= b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_gez/Test_if_gez.java b/jack-tests/tests/com/android/jack/opcodes/if_gez/Test_if_gez.java new file mode 100644 index 0000000..0aa5e15 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_gez/Test_if_gez.java @@ -0,0 +1,70 @@ +/* + * 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.jack.opcodes.if_gez; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_gez.jm.T_if_gez_1; +import com.android.jack.opcodes.if_gez.jm.T_if_gez_2; + + +public class Test_if_gez extends DxTestCase { + + /** + * @title Argument = 5 + */ + public void testN1() { + T_if_gez_1 t = new T_if_gez_1(); + assertEquals(1, t.run(5)); + } + + /** + * @title Argument = 0 + */ + public void testN2() { + T_if_gez_1 t = new T_if_gez_1(); + assertEquals(1, t.run(0)); + } + + /** + * @title Arguments = -5 + */ + public void testN3() { + T_if_gez_1 t = new T_if_gez_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_gez instruction + */ + assertEquals(1234, t.run(-5)); + } + + /** + * @title Argument = 5 + */ + public void testN4() { + T_if_gez_2 t = new T_if_gez_2(); + assertTrue(t.run(5)); + } + + /** + * @title Arguments = Integer.MAX_VALUE + */ + public void testB1() { + T_if_gez_1 t = new T_if_gez_1(); + assertEquals(1, t.run(Integer.MAX_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_gez/jm/T_if_gez_1.java b/jack-tests/tests/com/android/jack/opcodes/if_gez/jm/T_if_gez_1.java new file mode 100644 index 0000000..74a996c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_gez/jm/T_if_gez_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_gez.jm; + +public class T_if_gez_1 { + + public int run(int a) { + return a >= 0 ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_gez/jm/T_if_gez_2.java b/jack-tests/tests/com/android/jack/opcodes/if_gez/jm/T_if_gez_2.java new file mode 100644 index 0000000..75f49b8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_gez/jm/T_if_gez_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_gez.jm; + +public class T_if_gez_2 { + + public boolean run(int a) { + return a >= 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_gt/Test_if_gt.java b/jack-tests/tests/com/android/jack/opcodes/if_gt/Test_if_gt.java new file mode 100644 index 0000000..c895aa8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_gt/Test_if_gt.java @@ -0,0 +1,127 @@ +/* + * 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.jack.opcodes.if_gt; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_gt.jm.T_if_gt_1; +import com.android.jack.opcodes.if_gt.jm.T_if_gt_2; + + +public class Test_if_gt extends DxTestCase { + + /** + * @title Arguments = 5, 6 + */ + public void testN1() { + T_if_gt_1 t = new T_if_gt_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_gt instruction + */ + assertEquals(1234, t.run(5, 6)); + } + + /** + * @title Arguments = 0x0f0e0d0c, 0x0f0e0d0c + */ + public void testN2() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1234, t.run(0x0f0e0d0c, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 5, -5 + */ + public void testN3() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1, t.run(5, -5)); + } + + /** + * @title Arguments = 0x0f0e0d0d, 0x0f0e0d0c + */ + public void testN4() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1, t.run(0x0f0e0d0d, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 0x1234, 0x01001234 + */ + public void testN5() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1234, t.run(0x1234, 0x01001234)); + } + + /** + * @title Arguments = -5, 5 + */ + public void testN6() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1234, t.run(-5, 5)); + } + + /** + * @title Arguments = -5, 5 + */ + public void testN7() { + T_if_gt_2 t = new T_if_gt_2(); + assertEquals(false, t.run(-5, 5)); + } + + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE + */ + public void testB1() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1234, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE + */ + public void testB2() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1234, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE)); + } + + /** + * @title Arguments = 1234567, 0 + */ + public void testB3() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1, t.run(1234567, 0)); + } + + /** + * @title Arguments = 0, 1234567 + */ + public void testB4() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1234, t.run(0, 1234567)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_if_gt_1 t = new T_if_gt_1(); + assertEquals(1234, t.run(0, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_gt/jm/T_if_gt_1.java b/jack-tests/tests/com/android/jack/opcodes/if_gt/jm/T_if_gt_1.java new file mode 100644 index 0000000..c78f683 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_gt/jm/T_if_gt_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_gt.jm; + +public class T_if_gt_1 { + + public int run(int a, int b) { + return a > b ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_gt/jm/T_if_gt_2.java b/jack-tests/tests/com/android/jack/opcodes/if_gt/jm/T_if_gt_2.java new file mode 100644 index 0000000..e4fb856 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_gt/jm/T_if_gt_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_gt.jm; + +public class T_if_gt_2 { + + public boolean run(int a, int b) { + return a > b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_gtz/Test_if_gtz.java b/jack-tests/tests/com/android/jack/opcodes/if_gtz/Test_if_gtz.java new file mode 100644 index 0000000..3328763 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_gtz/Test_if_gtz.java @@ -0,0 +1,78 @@ +/* + * 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.jack.opcodes.if_gtz; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_gtz.jm.T_if_gtz_1; +import com.android.jack.opcodes.if_gtz.jm.T_if_gtz_2; + + +public class Test_if_gtz extends DxTestCase { + + /** + * @title Argument = 5 + */ + public void testN1() { + T_if_gtz_1 t = new T_if_gtz_1(); + assertEquals(1, t.run(5)); + } + + /** + * @title Argument = 0 + */ + public void testN2() { + T_if_gtz_1 t = new T_if_gtz_1(); + assertEquals(1234, t.run(0)); + } + + /** + * @title Arguments = -5 + */ + public void testN3() { + T_if_gtz_1 t = new T_if_gtz_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_gtz instruction + */ + assertEquals(1234, t.run(-5)); + } + + /** + * @title Argument = 5 + */ + public void testN4() { + T_if_gtz_2 t = new T_if_gtz_2(); + assertTrue(t.run(5)); + } + + /** + * @title Arguments = Integer.MAX_VALUE + */ + public void testB1() { + T_if_gtz_1 t = new T_if_gtz_1(); + assertEquals(1, t.run(Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE + */ + public void testB2() { + T_if_gtz_1 t = new T_if_gtz_1(); + assertEquals(1234, t.run(Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_gtz/jm/T_if_gtz_1.java b/jack-tests/tests/com/android/jack/opcodes/if_gtz/jm/T_if_gtz_1.java new file mode 100644 index 0000000..50ae6eb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_gtz/jm/T_if_gtz_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_gtz.jm; + +public class T_if_gtz_1 { + + public int run(int a) { + return a > 0 ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_gtz/jm/T_if_gtz_2.java b/jack-tests/tests/com/android/jack/opcodes/if_gtz/jm/T_if_gtz_2.java new file mode 100644 index 0000000..1e57da5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_gtz/jm/T_if_gtz_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_gtz.jm; + +public class T_if_gtz_2 { + + public boolean run(int a) { + return a > 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_le/Test_if_le.java b/jack-tests/tests/com/android/jack/opcodes/if_le/Test_if_le.java new file mode 100644 index 0000000..c10a780 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_le/Test_if_le.java @@ -0,0 +1,127 @@ +/* + * 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.jack.opcodes.if_le; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_le.jm.T_if_le_1; +import com.android.jack.opcodes.if_le.jm.T_if_le_2; + + +public class Test_if_le extends DxTestCase { + + /** + * @title Arguments = 5, 6 + */ + public void testN1() { + T_if_le_1 t = new T_if_le_1(); + + assertEquals(1, t.run(5, 6)); + } + + /** + * @title Arguments = 0x0f0e0d0c, 0x0f0e0d0c + */ + public void testN2() { + T_if_le_1 t = new T_if_le_1(); + assertEquals(1, t.run(0x0f0e0d0c, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 5, -5 + */ + public void testN3() { + T_if_le_1 t = new T_if_le_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_le instruction + */ + assertEquals(1234, t.run(5, -5)); + } + + /** + * @title Arguments = 0x0f0e0d0d, 0x0f0e0d0c + */ + public void testN4() { + T_if_le_1 t = new T_if_le_1(); + assertEquals(1234, t.run(0x0f0e0d0d, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 0x1234, 0x01001234 + */ + public void testN5() { + T_if_le_1 t = new T_if_le_1(); + assertEquals(1, t.run(0x1234, 0x01001234)); + } + + /** + * @title Arguments = -5, 5 + */ + public void testN6() { + T_if_le_1 t = new T_if_le_1(); + assertEquals(1, t.run(-5, 5)); + } + + /** + * @title Arguments = -5, 5 + */ + public void testN7() { + T_if_le_2 t = new T_if_le_2(); + assertEquals(true, t.run(-5, 5)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE + */ + public void testB1() { + T_if_le_1 t = new T_if_le_1(); + assertEquals(1, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE + */ + public void testB2() { + T_if_le_1 t = new T_if_le_1(); + assertEquals(1, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE)); + } + + /** + * @title Arguments = 1234567, 0 + */ + public void testB3() { + T_if_le_1 t = new T_if_le_1(); + assertEquals(1234, t.run(1234567, 0)); + } + + /** + * @title Arguments = 0, 1234567 + */ + public void testB4() { + T_if_le_1 t = new T_if_le_1(); + assertEquals(1, t.run(0, 1234567)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_if_le_1 t = new T_if_le_1(); + assertEquals(1, t.run(0, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_le/jm/T_if_le_1.java b/jack-tests/tests/com/android/jack/opcodes/if_le/jm/T_if_le_1.java new file mode 100644 index 0000000..dd1f49a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_le/jm/T_if_le_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_le.jm; + +public class T_if_le_1 { + + public int run(int a, int b) { + return a <= b ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_le/jm/T_if_le_2.java b/jack-tests/tests/com/android/jack/opcodes/if_le/jm/T_if_le_2.java new file mode 100644 index 0000000..6d13b51 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_le/jm/T_if_le_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_le.jm; + +public class T_if_le_2 { + + public boolean run(int a, int b) { + return a <= b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_lez/Test_if_lez.java b/jack-tests/tests/com/android/jack/opcodes/if_lez/Test_if_lez.java new file mode 100644 index 0000000..783f14b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_lez/Test_if_lez.java @@ -0,0 +1,77 @@ +/* + * 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.jack.opcodes.if_lez; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_lez.jm.T_if_lez_1; +import com.android.jack.opcodes.if_lez.jm.T_if_lez_2; + + +public class Test_if_lez extends DxTestCase { + + /** + * @title Argument = 5 + */ + public void testN1() { + T_if_lez_1 t = new T_if_lez_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_lez instruction + */ + assertEquals(1234, t.run(5)); + } + + /** + * @title Argument = 0 + */ + public void testN2() { + T_if_lez_1 t = new T_if_lez_1(); + assertEquals(1, t.run(0)); + } + + /** + * @title Arguments = -5 + */ + public void testN3() { + T_if_lez_1 t = new T_if_lez_1(); + assertEquals(1, t.run(-5)); + } + + /** + * @title Arguments = -5 + */ + public void testN4() { + T_if_lez_2 t = new T_if_lez_2(); + assertEquals(true, t.run(-5)); + } + + /** + * @title Arguments = Integer.MAX_VALUE + */ + public void testB1() { + T_if_lez_1 t = new T_if_lez_1(); + assertEquals(1234, t.run(Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE + */ + public void testB2() { + T_if_lez_1 t = new T_if_lez_1(); + assertEquals(1, t.run(Integer.MIN_VALUE)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_lez/jm/T_if_lez_1.java b/jack-tests/tests/com/android/jack/opcodes/if_lez/jm/T_if_lez_1.java new file mode 100644 index 0000000..f875624 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_lez/jm/T_if_lez_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_lez.jm; + +public class T_if_lez_1 { + + public int run(int a) { + return a <= 0 ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_lez/jm/T_if_lez_2.java b/jack-tests/tests/com/android/jack/opcodes/if_lez/jm/T_if_lez_2.java new file mode 100644 index 0000000..3130e3d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_lez/jm/T_if_lez_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_lez.jm; + +public class T_if_lez_2 { + + public boolean run(int a) { + return a <= 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_lt/Test_if_lt.java b/jack-tests/tests/com/android/jack/opcodes/if_lt/Test_if_lt.java new file mode 100644 index 0000000..d3378c6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_lt/Test_if_lt.java @@ -0,0 +1,126 @@ +/* + * 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.jack.opcodes.if_lt; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_lt.jm.T_if_lt_1; +import com.android.jack.opcodes.if_lt.jm.T_if_lt_2; + + +public class Test_if_lt extends DxTestCase { + + /** + * @title Arguments = 5, 6 + */ + public void testN1() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1, t.run(5, 6)); + } + + /** + * @title Arguments = 0x0f0e0d0c, 0x0f0e0d0c + */ + public void testN2() { + T_if_lt_1 t = new T_if_lt_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_lt instruction + */ + assertEquals(1234, t.run(0x0f0e0d0c, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 5, -5 + */ + public void testN3() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1234, t.run(5, -5)); + } + + /** + * @title Arguments = 0x0f0e0d0d, 0x0f0e0d0c + */ + public void testN4() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1234, t.run(0x0f0e0d0d, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 0x1234, 0x01001234 + */ + public void testN5() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1, t.run(0x1234, 0x01001234)); + } + + /** + * @title Arguments = -5, 5 + */ + public void testN6() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1, t.run(-5, 5)); + } + + /** + * @title Arguments = -5, 5 + */ + public void testN7() { + T_if_lt_2 t = new T_if_lt_2(); + assertEquals(true, t.run(-5, 5)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE + */ + public void testB1() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1234, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE + */ + public void testB2() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1234, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE)); + } + + /** + * @title Arguments = 1234567, 0 + */ + public void testB3() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1234, t.run(1234567, 0)); + } + + /** + * @title Arguments = 0, 1234567 + */ + public void testB4() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1, t.run(0, 1234567)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_if_lt_1 t = new T_if_lt_1(); + assertEquals(1234, t.run(0, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_lt/jm/T_if_lt_1.java b/jack-tests/tests/com/android/jack/opcodes/if_lt/jm/T_if_lt_1.java new file mode 100644 index 0000000..115d812 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_lt/jm/T_if_lt_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_lt.jm; + +public class T_if_lt_1 { + + public int run(int a, int b) { + return a < b ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_lt/jm/T_if_lt_2.java b/jack-tests/tests/com/android/jack/opcodes/if_lt/jm/T_if_lt_2.java new file mode 100644 index 0000000..57d6752 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_lt/jm/T_if_lt_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_lt.jm; + +public class T_if_lt_2 { + + public boolean run(int a, int b) { + return a < b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_ltz/Test_if_ltz.java b/jack-tests/tests/com/android/jack/opcodes/if_ltz/Test_if_ltz.java new file mode 100644 index 0000000..a1724e4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_ltz/Test_if_ltz.java @@ -0,0 +1,78 @@ +/* + * 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.jack.opcodes.if_ltz; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_ltz.jm.T_if_ltz_1; +import com.android.jack.opcodes.if_ltz.jm.T_if_ltz_2; + + +public class Test_if_ltz extends DxTestCase { + + /** + * @title Argument = 5 + */ + public void testN1() { + T_if_ltz_1 t = new T_if_ltz_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_ltz instruction + */ + assertEquals(1234, t.run(5)); + } + + /** + * @title Argument = 0 + */ + public void testN2() { + T_if_ltz_1 t = new T_if_ltz_1(); + assertEquals(1234, t.run(0)); + } + + /** + * @title Arguments = -5 + */ + public void testN3() { + T_if_ltz_1 t = new T_if_ltz_1(); + assertEquals(1, t.run(-5)); + } + + /** + * @title Arguments = -5 + */ + public void testN4() { + T_if_ltz_2 t = new T_if_ltz_2(); + assertEquals(true, t.run(-5)); + } + + /** + * @title Arguments = Integer.MAX_VALUE + */ + public void testB1() { + T_if_ltz_1 t = new T_if_ltz_1(); + assertEquals(1234, t.run(Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE + */ + public void testB2() { + T_if_ltz_1 t = new T_if_ltz_1(); + assertEquals(1, t.run(Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_ltz/jm/T_if_ltz_1.java b/jack-tests/tests/com/android/jack/opcodes/if_ltz/jm/T_if_ltz_1.java new file mode 100644 index 0000000..a4e7cf9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_ltz/jm/T_if_ltz_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_ltz.jm; + +public class T_if_ltz_1 { + + public int run(int a) { + return a < 0 ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_ltz/jm/T_if_ltz_2.java b/jack-tests/tests/com/android/jack/opcodes/if_ltz/jm/T_if_ltz_2.java new file mode 100644 index 0000000..fc06798 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_ltz/jm/T_if_ltz_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_ltz.jm; + +public class T_if_ltz_2 { + + public boolean run(int a) { + return a < 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_ne/Test_if_ne.java b/jack-tests/tests/com/android/jack/opcodes/if_ne/Test_if_ne.java new file mode 100644 index 0000000..41cf5f9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_ne/Test_if_ne.java @@ -0,0 +1,93 @@ +/* + * 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.jack.opcodes.if_ne; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_ne.jm.T_if_ne_1; + + +public class Test_if_ne extends DxTestCase { + + /** + * @title Arguments = 5, 6 + */ + public void testN1() { + T_if_ne_1 t = new T_if_ne_1(); + assertEquals(1, t.run(5, 6)); + } + + /** + * @title Arguments = 0x0f0e0d0c, 0x0f0e0d0c + */ + public void testN2() { + T_if_ne_1 t = new T_if_ne_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_ne instruction + */ + assertEquals(1234, t.run(0x0f0e0d0c, 0x0f0e0d0c)); + } + + /** + * @title Arguments = 5, -5 + */ + public void testN3() { + T_if_ne_1 t = new T_if_ne_1(); + assertEquals(1, t.run(5, -5)); + } + + /** + * @title Arguments = 0x01001234, 0x1234 + */ + public void testN4() { + T_if_ne_1 t = new T_if_ne_1(); + assertEquals(1, t.run(0x01001234, 0x1234)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE + */ + public void testB1() { + T_if_ne_1 t = new T_if_ne_1(); + assertEquals(1234, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE + */ + public void testB2() { + T_if_ne_1 t = new T_if_ne_1(); + assertEquals(1234, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE)); + } + + /** + * @title Arguments = 0, 1234567 + */ + public void testB3() { + T_if_ne_1 t = new T_if_ne_1(); + assertEquals(1, t.run(0, 1234567)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB4() { + T_if_ne_1 t = new T_if_ne_1(); + assertEquals(1234, t.run(0, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_ne/jm/T_if_ne_1.java b/jack-tests/tests/com/android/jack/opcodes/if_ne/jm/T_if_ne_1.java new file mode 100644 index 0000000..26d45bb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_ne/jm/T_if_ne_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_ne.jm; + +public class T_if_ne_1 { + + public int run(int a, int b) { + return a != b ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_ne/jm/T_if_ne_2.java b/jack-tests/tests/com/android/jack/opcodes/if_ne/jm/T_if_ne_2.java new file mode 100644 index 0000000..9ae7f56 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_ne/jm/T_if_ne_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_ne.jm; + +public class T_if_ne_2 { + + public boolean run(int a, int b) { + return a != b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_nez/Test_if_nez.java b/jack-tests/tests/com/android/jack/opcodes/if_nez/Test_if_nez.java new file mode 100644 index 0000000..0822431 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_nez/Test_if_nez.java @@ -0,0 +1,107 @@ +/* + * 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.jack.opcodes.if_nez; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.if_nez.jm.T_if_nez_1; +import com.android.jack.opcodes.if_nez.jm.T_if_nez_2; +import com.android.jack.opcodes.if_nez.jm.T_if_nez_3; +import com.android.jack.opcodes.if_nez.jm.T_if_nez_4; + + +public class Test_if_nez extends DxTestCase { + + /** + * @title Argument = 5 + */ + public void testN1() { + T_if_nez_1 t = new T_if_nez_1(); + assertEquals(1, t.run(5)); + } + + /** + * @title Argument = 0 + */ + public void testN2() { + T_if_nez_1 t = new T_if_nez_1(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_nez instruction + */ + assertEquals(1234, t.run(0)); + } + + /** + * @title Arguments = -5 + */ + public void testN3() { + T_if_nez_1 t = new T_if_nez_1(); + assertEquals(1, t.run(-5)); + } + + /** + * @title Arguments = -5 + */ + public void testN4() { + T_if_nez_2 t = new T_if_nez_2(); + assertEquals(true, t.run(-5)); + } + + /** + * @title Arguments = Integer.MAX_VALUE + */ + public void testB1() { + T_if_nez_1 t = new T_if_nez_1(); + assertEquals(1, t.run(Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MIN_VALUE + */ + public void testB2() { + T_if_nez_1 t = new T_if_nez_1(); + assertEquals(1, t.run(Integer.MIN_VALUE)); + } + + /** + * @title Argument = this + */ + public void testN1NonNull() { + T_if_nez_3 t = new T_if_nez_3(); + assertEquals(1, t.run(this)); + } + + /** + * @title Argument = null + */ + public void testN2NonNull() { + T_if_nez_3 t = new T_if_nez_3(); + /* + * Compare with 1234 to check that in case of failed comparison + * execution proceeds at the address following if_nez instruction + */ + assertEquals(1234, t.run(null)); + } + + /** + * @title Argument = this + */ + public void testN3NonNull() { + T_if_nez_4 t = new T_if_nez_4(); + assertEquals(true, t.run(this)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_1.java b/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_1.java new file mode 100644 index 0000000..0097da5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_nez.jm; + +public class T_if_nez_1 { + + public int run(int a) { + return a != 0 ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_2.java b/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_2.java new file mode 100644 index 0000000..b51e18d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_nez.jm; + +public class T_if_nez_2 { + + public boolean run(int a) { + return a != 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_3.java b/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_3.java new file mode 100644 index 0000000..c092877 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_nez.jm; + +public class T_if_nez_3 { + + public int run(Object o) { + return o != null ? 1 : 1234; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_4.java b/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_4.java new file mode 100644 index 0000000..8cd762c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.if_nez.jm; + +public class T_if_nez_4 { + + public boolean run(Object o) { + return o != null; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iget/Test_iget.java b/jack-tests/tests/com/android/jack/opcodes/iget/Test_iget.java new file mode 100644 index 0000000..df64f02 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iget/Test_iget.java @@ -0,0 +1,87 @@ +/* + * 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.jack.opcodes.iget; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.iget.jm.T_iget_1; +import com.android.jack.opcodes.iget.jm.T_iget_11; +import com.android.jack.opcodes.iget.jm.T_iget_15; +import com.android.jack.opcodes.iget.jm.T_iget_2; +import com.android.jack.opcodes.iget.jm.T_iget_4; +import com.android.jack.opcodes.iget.jm.T_iget_5; +import com.android.jack.opcodes.iget.jm.T_iget_6; + + +public class Test_iget extends DxTestCase { + private int TestStubField = 123; + protected int TestStubFieldP = 0; + + private int privateInt = 456; + + /** + * @title type - int + */ + public void testN1() { + T_iget_1 t = new T_iget_1(); + assertEquals(35, t.run()); + } + + /** + * @title type - double + */ + public void testN2() { + T_iget_2 t = new T_iget_2(); + assertEquals(123d, t.run()); + } + + /** + * @title access protected field from subclass + */ + public void testN3() { + // @uses com.android.jack.opcodes.iget.jm.T_iget_1 + T_iget_11 t = new T_iget_11(); + assertEquals(10, t.run()); + } + + public void testN4() { + T_iget_4 t = new T_iget_4(); + assertEquals(5, t.run()); + } + + public void testN5() { + T_iget_15 t = new T_iget_15(); + assertNull(t.run()); + } + + /** + * @title attempt to access static field + */ + public void testN6() { + T_iget_5 t = new T_iget_5(); + assertEquals(5, t.run()); + } + + /** + * @title attempt to access of non-accessible private field + */ + public void testN7() { + T_iget_6 t = new T_iget_6(); + int res = t.run(); + assertEquals(-99, t.run()); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_1.java b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_1.java new file mode 100644 index 0000000..40d1c92 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_1.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.iget.jm; + +public class T_iget_1 { + public int i1 = 5; + protected int p1 = 10; + private int pvt1 = 20; + + public int run(){ + return i1 + p1 + pvt1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_11.java b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_11.java new file mode 100644 index 0000000..49505c5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_11.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.iget.jm; + +public class T_iget_11 extends T_iget_1 { + + public int run(){ + return p1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_15.java b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_15.java new file mode 100644 index 0000000..568ad3e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_15.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.iget.jm; + +public class T_iget_15 { + + public Object run() { + TChild s = new TChild(); + return s.o; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_2.java b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_2.java new file mode 100644 index 0000000..3f353ea --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_2.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.iget.jm; + +public class T_iget_2 { + + public double val = 123.0d; + + public double run() { + return val; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_4.java b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_4.java new file mode 100644 index 0000000..81609ed --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_4.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.iget.jm; + +public class T_iget_4 { + + public int i1 = 5; + public int run(){ + return i1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_5.java b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_5.java new file mode 100644 index 0000000..7fa65e5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_5.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.iget.jm; + +public class T_iget_5 { + + public static int i1 = 5; + public int run(){ + return i1; + } +} + diff --git a/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_6.java b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_6.java new file mode 100644 index 0000000..1fafddc --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iget/jm/T_iget_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.iget.jm; + +public class T_iget_6 { + + public int run() { + return -99; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iget/jm/TestStubs.java b/jack-tests/tests/com/android/jack/opcodes/iget/jm/TestStubs.java new file mode 100644 index 0000000..bb7b96c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iget/jm/TestStubs.java @@ -0,0 +1,31 @@ +/* + * 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.jack.opcodes.iget.jm; + + + +class TSuper { + public String s = "abc"; +} + +class TChild extends TSuper { + public Object o = null; +} + +public class TestStubs { + private int privateInt = 456; +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_byte/Test_int_to_byte.java b/jack-tests/tests/com/android/jack/opcodes/int_to_byte/Test_int_to_byte.java new file mode 100644 index 0000000..8145dde --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_byte/Test_int_to_byte.java @@ -0,0 +1,147 @@ +/* + * 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.jack.opcodes.int_to_byte; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.int_to_byte.jm.T_int_to_byte_1; +import com.android.jack.opcodes.int_to_byte.jm.T_int_to_byte_3; +import com.android.jack.opcodes.int_to_byte.jm.T_int_to_byte_4; + + +public class Test_int_to_byte extends DxTestCase { + + /** + * @title Argument = 1 + */ + public void testN1() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(1, t.run(1)); + } + + /** + * @title Argument = -1 + */ + public void testN2() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(-1, t.run(-1)); + } + + /** + * @title Argument = 16 + */ + public void testN3() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(16, t.run(16)); + } + + /** + * @title Argument = -32 + */ + public void testN4() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(-32, t.run(-32)); + } + + /** + * @title Argument = 134 + */ + public void testN5() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(-122, t.run(134)); + } + + /** + * @title Argument = -134 + */ + public void testN6() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(122, t.run(-134)); + } + + /** + * @title Argument = 1 + */ + public void testN7() { + T_int_to_byte_3 t = new T_int_to_byte_3(); + assertEquals(1, t.run(1)); + } + + /** + * @title Argument = 1 + */ + public void testN8() { + T_int_to_byte_4 t = new T_int_to_byte_4(); + assertEquals(1, t.run(1)); + } + + /** + * @title s. Argument = 127 + */ + public void testB1() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(127, t.run(127)); + } + + /** + * @title s. Argument = 128 + */ + public void testB2() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(-128, t.run(128)); + } + + /** + * @title s. Argument = 0 + */ + public void testB3() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(0, t.run(0)); + } + + /** + * @title s. Argument = -128 + */ + public void testB4() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(-128, t.run(-128)); + } + + /** + * @title s. Argument = -129 + */ + public void testB5() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(127, t.run(-129)); + } + + /** + * @title s. Argument = Integer.MAX_VALUE + */ + public void testB6() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(-1, t.run(Integer.MAX_VALUE)); + } + + /** + * @title s. Argument = Integer.MIN_VALUE + */ + public void testB7() { + T_int_to_byte_1 t = new T_int_to_byte_1(); + assertEquals(0, t.run(Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_1.java b/jack-tests/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_1.java new file mode 100644 index 0000000..918bc55 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_byte.jm; + +public class T_int_to_byte_1 { + + public byte run(int a) { + return (byte) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_3.java b/jack-tests/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_3.java new file mode 100644 index 0000000..f3d0a68 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_byte.jm; + +public class T_int_to_byte_3 { + + public byte run(double a) { + return (byte) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_4.java b/jack-tests/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_4.java new file mode 100644 index 0000000..c8e9f99 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_byte.jm; + +public class T_int_to_byte_4 { + + public byte run(long a) { + return (byte) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_char/Test_int_to_char.java b/jack-tests/tests/com/android/jack/opcodes/int_to_char/Test_int_to_char.java new file mode 100644 index 0000000..291e6c9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_char/Test_int_to_char.java @@ -0,0 +1,108 @@ +/* + * 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.jack.opcodes.int_to_char; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.int_to_char.jm.T_int_to_char_1; +import com.android.jack.opcodes.int_to_char.jm.T_int_to_char_3; +import com.android.jack.opcodes.int_to_char.jm.T_int_to_char_4; + + +public class Test_int_to_char extends DxTestCase { + + /** + * @title Argument = 65 + */ + public void testN1() { + T_int_to_char_1 t = new T_int_to_char_1(); + assertEquals('A', t.run(65)); + } + + /** + * @title Argument = 65537 + */ + public void testN2() { + T_int_to_char_1 t = new T_int_to_char_1(); + assertEquals('\u0001', t.run(65537)); + } + + /** + * @title Argument = -2 + */ + public void testN3() { + T_int_to_char_1 t = new T_int_to_char_1(); + assertEquals('\ufffe', t.run(-2)); + } + + /** + * @title Argument = 0x110000 + */ + public void testN4() { + T_int_to_char_1 t = new T_int_to_char_1(); + assertEquals('\u0000', t.run(0x110000)); + } + + /** + * @title Argument = 65 + */ + public void testN5() { + T_int_to_char_3 t = new T_int_to_char_3(); + assertEquals('A', t.run(65)); + } + + /** + * @title Argument = 65 + */ + public void testN6() { + T_int_to_char_4 t = new T_int_to_char_4(); + assertEquals('A', t.run(65)); + } + + /** + * @title Argument = 0 + */ + public void testB1() { + T_int_to_char_1 t = new T_int_to_char_1(); + assertEquals('\u0000', t.run(0)); + } + + /** + * @title Argument = 65535 + */ + public void testB2() { + T_int_to_char_1 t = new T_int_to_char_1(); + assertEquals('\uffff', t.run(65535)); + } + + /** + * @title Argument = Integer.MAX_VALUE + */ + public void testB3() { + T_int_to_char_1 t = new T_int_to_char_1(); + assertEquals('\uffff', t.run(Integer.MAX_VALUE)); + } + + /** + * @title Argument = Integer.MIN_VALUE + */ + public void testB4() { + T_int_to_char_1 t = new T_int_to_char_1(); + assertEquals('\u0000', t.run(Integer.MIN_VALUE)); + } + + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_1.java b/jack-tests/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_1.java new file mode 100644 index 0000000..9ac1e52 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_char.jm; + +public class T_int_to_char_1 { + + public char run(int a) { + return (char) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_3.java b/jack-tests/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_3.java new file mode 100644 index 0000000..1397568 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_char.jm; + +public class T_int_to_char_3 { + + public char run(double a) { + return (char) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_4.java b/jack-tests/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_4.java new file mode 100644 index 0000000..516ecca --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_char.jm; + +public class T_int_to_char_4 { + + public char run(long a) { + return (char) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_double/Test_int_to_double.java b/jack-tests/tests/com/android/jack/opcodes/int_to_double/Test_int_to_double.java new file mode 100644 index 0000000..5512fc2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_double/Test_int_to_double.java @@ -0,0 +1,74 @@ +/* + * 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.jack.opcodes.int_to_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.int_to_double.jm.T_int_to_double_1; + + +public class Test_int_to_double extends DxTestCase { + + /** + * @title Argument = 300000000 + */ + public void testN1() { + T_int_to_double_1 t = new T_int_to_double_1(); + assertEquals(300000000d, t.run(300000000), 0d); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_int_to_double_1 t = new T_int_to_double_1(); + assertEquals(1d, t.run(1), 0d); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_int_to_double_1 t = new T_int_to_double_1(); + assertEquals(-1d, t.run(-1), 0d); + } + + + /** + * @title Argument = Integer.MAX_VALUE + */ + public void testB1() { + T_int_to_double_1 t = new T_int_to_double_1(); + assertEquals(2147483647d, t.run(Integer.MAX_VALUE), 0d); + } + + /** + * @title Argument = Integer.MIN_VALUE + */ + public void testB2() { + T_int_to_double_1 t = new T_int_to_double_1(); + assertEquals(-2147483648d, t.run(Integer.MIN_VALUE), 0d); + } + + /** + * @title Argument = 0 + */ + public void testB3() { + T_int_to_double_1 t = new T_int_to_double_1(); + assertEquals(0d, t.run(0), 0d); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_1.java b/jack-tests/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_1.java new file mode 100644 index 0000000..b523a88 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_double.jm; + +public class T_int_to_double_1 { + + public double run(int a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_3.java b/jack-tests/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_3.java new file mode 100644 index 0000000..ac739be --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_double.jm; + +public class T_int_to_double_3 { + + public double run(float a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_4.java b/jack-tests/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_4.java new file mode 100644 index 0000000..bc11c75 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_double.jm; + +public class T_int_to_double_4 { + + public double run(long a) { + return (double) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_float/Test_int_to_float.java b/jack-tests/tests/com/android/jack/opcodes/int_to_float/Test_int_to_float.java new file mode 100644 index 0000000..641ee48 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_float/Test_int_to_float.java @@ -0,0 +1,99 @@ +/* + * 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.jack.opcodes.int_to_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.int_to_float.jm.T_int_to_float_1; +import com.android.jack.opcodes.int_to_float.jm.T_int_to_float_3; +import com.android.jack.opcodes.int_to_float.jm.T_int_to_float_4; + + +public class Test_int_to_float extends DxTestCase { + + /** + * @title Argument = 123456 + */ + public void testN1() { + T_int_to_float_1 t = new T_int_to_float_1(); + assertEquals(123456f, t.run(123456), 0f); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_int_to_float_1 t = new T_int_to_float_1(); + assertEquals(1f, t.run(1), 0f); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_int_to_float_1 t = new T_int_to_float_1(); + assertEquals(-1f, t.run(-1), 0f); + } + + /** + * @title Argument = 33564439 + */ + public void testN4() { + T_int_to_float_1 t = new T_int_to_float_1(); + assertEquals(3.356444E7f, t.run(33564439), 0f); + } + + /** + * @title Argument = 33564439 + */ + public void testN5() { + T_int_to_float_3 t = new T_int_to_float_3(); + assertEquals(3.356444E7f, t.run(33564439), 0f); + } + + /** + * @title Argument = 33564439 + */ + public void testN6() { + T_int_to_float_4 t = new T_int_to_float_4(); + assertEquals(3.356444E7f, t.run(33564439), 0f); + } + + /** + * @title Argument = 0 + */ + public void testB1() { + T_int_to_float_1 t = new T_int_to_float_1(); + assertEquals(0f, t.run(0), 0f); + } + + /** + * @title Argument = Argument = Integer.MAX_VALUE + */ + public void testB2() { + T_int_to_float_1 t = new T_int_to_float_1(); + assertEquals(2147483650f, t.run(Integer.MAX_VALUE), 0f); + } + + /** + * @title Argument = Integer.MIN_VALUE + */ + public void testB3() { + T_int_to_float_1 t = new T_int_to_float_1(); + assertEquals(-2147483650f, t.run(Integer.MIN_VALUE), 0f); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_1.java b/jack-tests/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_1.java new file mode 100644 index 0000000..7b79780 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_float.jm; + +public class T_int_to_float_1 { + + public float run(int a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_3.java b/jack-tests/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_3.java new file mode 100644 index 0000000..36b7ee3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_float.jm; + +public class T_int_to_float_3 { + + public float run(double a) { + return (float)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_4.java b/jack-tests/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_4.java new file mode 100644 index 0000000..ce5a2ce --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_float.jm; + +public class T_int_to_float_4 { + + public float run(long a) { + return (float) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_long/Test_int_to_long.java b/jack-tests/tests/com/android/jack/opcodes/int_to_long/Test_int_to_long.java new file mode 100644 index 0000000..78c6f9f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_long/Test_int_to_long.java @@ -0,0 +1,91 @@ +/* + * 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.jack.opcodes.int_to_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.int_to_long.jm.T_int_to_long_1; +import com.android.jack.opcodes.int_to_long.jm.T_int_to_long_3; +import com.android.jack.opcodes.int_to_long.jm.T_int_to_long_4; + + +public class Test_int_to_long extends DxTestCase { + + /** + * @title Argument = 123456 + */ + public void testN1() { + T_int_to_long_1 t = new T_int_to_long_1(); + assertEquals(123456l, t.run(123456)); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_int_to_long_1 t = new T_int_to_long_1(); + assertEquals(1l, t.run(1)); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_int_to_long_1 t = new T_int_to_long_1(); + assertEquals(-1l, t.run(-1)); + } + + /** + * @title Argument = -1 + */ + public void testN4() { + T_int_to_long_3 t = new T_int_to_long_3(); + assertEquals(-1l, t.run(-1)); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_int_to_long_4 t = new T_int_to_long_4(); + assertEquals(-1l, t.run(-1)); + } + + /** + * @title Argument = 0 + */ + public void testB1() { + T_int_to_long_1 t = new T_int_to_long_1(); + assertEquals(0l, t.run(0)); + } + + /** + * @title Argument = Integer.MAX_VALUE + */ + public void testB2() { + T_int_to_long_1 t = new T_int_to_long_1(); + assertEquals(2147483647l, t.run(Integer.MAX_VALUE)); + } + + /** + * @title Argument = Integer.MIN_VALUE + */ + public void testB3() { + T_int_to_long_1 t = new T_int_to_long_1(); + assertEquals(-2147483648l, t.run(Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_1.java b/jack-tests/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_1.java new file mode 100644 index 0000000..aa021c1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_long.jm; + +public class T_int_to_long_1 { + + public long run(int a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_3.java b/jack-tests/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_3.java new file mode 100644 index 0000000..8f0bc4f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_long.jm; + +public class T_int_to_long_3 { + + public long run(double a) { + return (long)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_4.java b/jack-tests/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_4.java new file mode 100644 index 0000000..54414f9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_long.jm; + +public class T_int_to_long_4 { + + public long run(long a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_short/Test_int_to_short.java b/jack-tests/tests/com/android/jack/opcodes/int_to_short/Test_int_to_short.java new file mode 100644 index 0000000..4b6ee23 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_short/Test_int_to_short.java @@ -0,0 +1,124 @@ +/* + * 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.jack.opcodes.int_to_short; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.int_to_short.jm.T_int_to_short_1; +import com.android.jack.opcodes.int_to_short.jm.T_int_to_short_3; +import com.android.jack.opcodes.int_to_short.jm.T_int_to_short_4; + + +public class Test_int_to_short extends DxTestCase { + + /** + * @title Argument = 1 + */ + public void testN1() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(1, t.run(1)); + } + + /** + * @title Argument = -1 + */ + public void testN2() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(-1, t.run(-1)); + } + + /** + * @title Argument = 32767 + */ + public void testN3() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(32767, t.run(32767)); + } + + /** + * @title Argument = -32768 + */ + public void testN4() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(-32768, t.run(-32768)); + } + + /** + * @title Argument = -32769 + */ + public void testN5() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(32767, t.run(-32769)); + } + + /** + * @title Argument = 32768 + */ + public void testN6() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(-32768, t.run(32768)); + } + + /** + * @title Argument = 0x10fedc; + */ + public void testN7() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(0xfffffedc, t.run(0x10fedc)); + } + + /** + * @title Argument = 0x10fedc; + */ + public void testN8() { + T_int_to_short_3 t = new T_int_to_short_3(); + assertEquals(0xfffffedc, t.run(0x10fedc)); + } + + /** + * @title Argument = 0x10fedc; + */ + public void testN9() { + T_int_to_short_4 t = new T_int_to_short_4(); + assertEquals(0xfffffedc, t.run(0x10fedc)); + } + + + /** + * @title Argument = 0 + */ + public void testB1() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(0, t.run(0)); + } + + /** + * @title Argument = Integer.MAX_VALUE + */ + public void testB2() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(-1, t.run(Integer.MAX_VALUE)); + } + + /** + * @title Argument = Integer.MIN_VALUE + */ + public void testB3() { + T_int_to_short_1 t = new T_int_to_short_1(); + assertEquals(0, t.run(Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_1.java b/jack-tests/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_1.java new file mode 100644 index 0000000..4afb7ee --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_short.jm; + +public class T_int_to_short_1 { + + public short run(int a) { + return (short)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_3.java b/jack-tests/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_3.java new file mode 100644 index 0000000..5543f6b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_short.jm; + +public class T_int_to_short_3 { + + public short run(double a) { + return (short)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_4.java b/jack-tests/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_4.java new file mode 100644 index 0000000..0a86651 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.int_to_short.jm; + +public class T_int_to_short_4 { + + public short run(long a) { + return (short)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_direct/Test_invoke_direct.java b/jack-tests/tests/com/android/jack/opcodes/invoke_direct/Test_invoke_direct.java new file mode 100644 index 0000000..724a5b6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_direct/Test_invoke_direct.java @@ -0,0 +1,43 @@ +/* + * 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.jack.opcodes.invoke_direct; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.invoke_direct.jm.T_invoke_direct_2; +import com.android.jack.opcodes.invoke_direct.jm.T_invoke_direct_21; + + + +public class Test_invoke_direct extends DxTestCase { + + /** + * @title private method call + */ + public void testN2() { + T_invoke_direct_2 t = new T_invoke_direct_2(); + assertEquals(345, t.run()); + } + + /** + * @title Check that new frame is created by invokespecial + */ + public void testN7() { + //@uses com.android.jack.opcodes.invokespecial.jm.TSuper + T_invoke_direct_21 t = new T_invoke_direct_21(); + assertEquals(1, t.run()); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_direct/jm/TSuper.java b/jack-tests/tests/com/android/jack/opcodes/invoke_direct/jm/TSuper.java new file mode 100644 index 0000000..a500d94 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_direct/jm/TSuper.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +/** 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.jack.opcodes.invoke_direct.jm; + +/** + * @author fjost + * + */ +public class TSuper { + public int toInt() { + return 5; + } + + public int toInt(float v) { + return (int)v; + } + + public int testArgsOrder(int a, int b) { + return a/b; + } + + public native int toIntNative(); + + public static int toIntStatic() { + return 5; + } + + protected int toIntP() { + return 5; + } + + private int toIntPvt() { + return 5; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_direct/jm/T_invoke_direct_2.java b/jack-tests/tests/com/android/jack/opcodes/invoke_direct/jm/T_invoke_direct_2.java new file mode 100644 index 0000000..7cbab10 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_direct/jm/T_invoke_direct_2.java @@ -0,0 +1,28 @@ +/* + * 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.jack.opcodes.invoke_direct.jm; + +public class T_invoke_direct_2 { + + public int run() { + return getInt(); + } + + private int getInt() { + return 345; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_direct/jm/T_invoke_direct_21.java b/jack-tests/tests/com/android/jack/opcodes/invoke_direct/jm/T_invoke_direct_21.java new file mode 100644 index 0000000..bba82e7 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_direct/jm/T_invoke_direct_21.java @@ -0,0 +1,35 @@ +/* + * 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.jack.opcodes.invoke_direct.jm; + +public class T_invoke_direct_21 extends TSuper { + + + private int test(int a, int b) { + int i = 0; + int j = 0; + return 5; + } + + public int run() { + int i = 123; + int j = 456; + test(0, 1); + + return 1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/Test_invoke_interface.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/Test_invoke_interface.java new file mode 100644 index 0000000..c1a4fa3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/Test_invoke_interface.java @@ -0,0 +1,88 @@ +/* + * 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.jack.opcodes.invoke_interface; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.invoke_interface.jm.ITestImpl; +import com.android.jack.opcodes.invoke_interface.jm.T_invoke_interface_1; +import com.android.jack.opcodes.invoke_interface.jm.T_invoke_interface_12; +import com.android.jack.opcodes.invoke_interface.jm.T_invoke_interface_14; +import com.android.jack.opcodes.invoke_interface.jm.T_invoke_interface_19; +import com.android.jack.opcodes.invoke_interface.jm.T_invoke_interface_2; + + +public class Test_invoke_interface extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_invoke_interface_1 t = new T_invoke_interface_1(); + assertEquals(0, t.run("aa", "aa")); + assertEquals(-1, t.run("aa", "bb")); + assertEquals(1, t.run("bb", "aa")); + } + + /** + * @title Check that new frame is created by invoke_interface and + * arguments are passed to method + */ + public void testN2() { + //@uses com.android.jack.opcodes.invoke_interface.jm.ITest + //@uses com.android.jack.opcodes.invoke_interface.jm.ITestImpl + T_invoke_interface_14 t = new T_invoke_interface_14(); + ITestImpl impl = new ITestImpl(); + assertEquals(1, t.run(impl)); + } + + /** + * @title Check that monitor is acquired if method is synchronized + */ + public void testN3() { + //@uses com.android.jack.opcodes.invoke_interface.jm.ITest + assertTrue(T_invoke_interface_19.execute()); + } + + /** + * @title expected NullPointerException + */ + public void testE3() { + //@uses com.android.jack.opcodes.invoke_interface.jm.ITest + try { + new T_invoke_interface_2(null); + fail("expected NullPointerException"); + } catch (NullPointerException npe) { + // expected + } + } + + /** + * @title Native method can't be linked + */ + public void testE5() { + //@uses com.android.jack.opcodes.invoke_interface.jm.ITest + //@uses com.android.jack.opcodes.invoke_interface.jm.ITestImpl + T_invoke_interface_12 t = new T_invoke_interface_12(); + ITestImpl impl = new ITestImpl(); + try { + t.run(impl); + fail("expected UnsatisfiedLinkError"); + } catch (UnsatisfiedLinkError e) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/ITest.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/ITest.java new file mode 100644 index 0000000..7aec079 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/ITest.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + +public interface ITest { + public void doit(); + public void doit(int i); + public void doitNative(); + public int test(int a); + public int testArgsOrder(int a, int b); +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/ITestImpl.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/ITestImpl.java new file mode 100644 index 0000000..6d5f0d8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/ITestImpl.java @@ -0,0 +1,39 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + +public class ITestImpl implements ITest { + public void doit() { + // impl + } + + public void doit(int i) { + // + } + + public native void doitNative(); + + public int test(int a) { + if (a == 999) return 195; + return 0; + } + + public int testArgsOrder(int a, int b) { + return a / b; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/ITestImplAbstract.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/ITestImplAbstract.java new file mode 100644 index 0000000..862c55e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/ITestImplAbstract.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + +abstract class ITestImplAbstract implements ITest { + abstract public void doit(); + abstract public void doit(int i); + public native void doitNative(); +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_1.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_1.java new file mode 100644 index 0000000..ac476fe --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + +public class T_invoke_interface_1 { + + public int run(Comparable c, Object o) { + return c.compareTo(o); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_12.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_12.java new file mode 100644 index 0000000..300fadd --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_12.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + +public class T_invoke_interface_12 { + + public void run(ITest test) { + test.doitNative(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_14.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_14.java new file mode 100644 index 0000000..248a9c4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_14.java @@ -0,0 +1,32 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + +public class T_invoke_interface_14 { + + public int run(ITest test) { + int a = 123; + int b = 345; + if(test.testArgsOrder(64, 2) == 32) + { + if(a == 123) + if(b == 345) + return 1; + } + return 0; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_17.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_17.java new file mode 100644 index 0000000..4b8558f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_17.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + +public class T_invoke_interface_17 { + + public void run(ITest test) { + test.test(1); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_19.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_19.java new file mode 100644 index 0000000..ab5cdbf --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_19.java @@ -0,0 +1,69 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + + +public class T_invoke_interface_19 implements Runnable, ITest { + public final static int CNT = 1000; + int value = 0; + boolean failed = false; + + public void run() { + for(int i = 0; i < CNT; i++) { + doit(); + } + } + + public synchronized void doit(){ + value++; + int c = value; + Thread.yield(); + if(c != value) + failed = true; + } + public void doit(int i){ + } + public void doitNative(){ + } + public int test(int a) { + return 0; + } + public int testArgsOrder(int a, int b){ + return 0; + } + + public static boolean execute() { + T_invoke_interface_19 test = new T_invoke_interface_19(); + Thread t1 = new Thread(test); + Thread t2 = new Thread(test); + + t1.start(); + t2.start(); + + try + { + Thread.sleep(5000); + } + catch(InterruptedException ie) { + return false; + } + + if(test.value != CNT * 2) + return false; + return !test.failed; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_2.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_2.java new file mode 100644 index 0000000..bc10480 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + +public class T_invoke_interface_2 { + + public T_invoke_interface_2 (ITest test) { + test.doit(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_23.java b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_23.java new file mode 100644 index 0000000..a6cef6c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_23.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_interface.jm; + +public class T_invoke_interface_23 { + + public T_invoke_interface_23 (ITest test) { + test.doit(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/TestStubs.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/TestStubs.java new file mode 100644 index 0000000..b035960 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/TestStubs.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_static; + +public class TestStubs { + + protected void TestStub() { + // used by testE9 + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/Test_invoke_static.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/Test_invoke_static.java new file mode 100644 index 0000000..8f9eb5a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/Test_invoke_static.java @@ -0,0 +1,138 @@ +/* + * 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.jack.opcodes.invoke_static; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_1; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_12; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_13; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_14; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_15; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_18; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_2; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_4; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_5; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_6; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_7; +import com.android.jack.opcodes.invoke_static.jm.T_invoke_static_8; + + +public class Test_invoke_static extends DxTestCase { + + /** + * @title Static method from library class Math + */ + public void testN1() { + T_invoke_static_1 t = new T_invoke_static_1(); + assertEquals(1234567, t.run()); + } + + /** + * @title Static method from user class + */ + public void testN2() { + // @uses com.android.jack.opcodes.invoke_static.jm.TestClass + T_invoke_static_2 t = new T_invoke_static_2(); + assertEquals(777, t.run()); + } + + /** + * @title Check that <clinit> is called + */ + public void testN3() { + assertEquals(123456789l, T_invoke_static_4.run()); + } + + /** + * @title Check that monitor is acquired if method is synchronized + */ + public void testN4() { + assertTrue(T_invoke_static_12.execute()); + } + + /** + * @title Check that new frame is created by invoke_static and + * arguments are passed to method + */ + public void testN5() { + // @uses com.android.jack.opcodes.invoke_static.jm.TestClass + T_invoke_static_15 t = new T_invoke_static_15(); + assertTrue(t.run()); + } + + /** + * @title Static protected method from other class in the same package + */ + public void testN6() { + // @uses com.android.jack.opcodes.invoke_static.jm.TestClass + T_invoke_static_18 t = new T_invoke_static_18(); + assertEquals(888, t.run()); + } + + /** + * @title attempt to call non-static method + * + */ + public void testE1() { + T_invoke_static_5 t = new T_invoke_static_5(); + t.run(); + } + + /** + * @title Native method can't be linked + * + */ + public void testE2() { + T_invoke_static_6 t = new T_invoke_static_6(); + try { + t.run(); + fail("expected UnsatisfiedLinkError"); + } catch (UnsatisfiedLinkError ule) { + // expected + } + } + + public void testN7() { + T_invoke_static_7 t = new T_invoke_static_7(); + t.run(); + } + + public void testN8() { + T_invoke_static_8 t = new T_invoke_static_8(); + t.run(); + } + + public void testN9() { + T_invoke_static_13 t = new T_invoke_static_13(); + t.run(); + } + + /** + * @title initialization of referenced class throws exception + */ + public void testE7() { + // @uses com.android.jack.opcodes.invoke_static.jm.TestClassInitError + T_invoke_static_14 t = new T_invoke_static_14(); + try { + t.run(); + fail("expected Error"); + } catch (Error e) { + // expected + } + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_1.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_1.java new file mode 100644 index 0000000..12ef168 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_1 { + + public int run() { + return Math.abs(-1234567); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_12.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_12.java new file mode 100644 index 0000000..deb94a1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_12.java @@ -0,0 +1,58 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_12 implements Runnable { + public final static int CNT = 1000; + static int value = 0; + static boolean failed = false; + + public void run() { + for(int i = 0; i < CNT; i++) { + test(); + } + } + + private synchronized static void test() { + value++; + int c = value; + Thread.yield(); + if(c != value) + failed = true; + } + + public static boolean execute() { + T_invoke_static_12 test = new T_invoke_static_12(); + Thread t1 = new Thread(test); + Thread t2 = new Thread(test); + + t1.start(); + t2.start(); + + try + { + Thread.sleep(5000); + } + catch(InterruptedException ie) { + return false; + } + + if(value != CNT * 2) + return false; + return !failed; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_13.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_13.java new file mode 100644 index 0000000..68ba42b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_13.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_13 { + + public void run(){ + TestClass.test1(1); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_14.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_14.java new file mode 100644 index 0000000..b8c0ce1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_14.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_14 { + + public void run(){ + TestClassInitError.test(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_15.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_15.java new file mode 100644 index 0000000..c24221d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_15.java @@ -0,0 +1,31 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_15 { + + public boolean run(){ + int i = 123; + int j = 345; + if(TestClass.testArgsOrder(12, 2) == 6) + if(i == 123) + if(j == 345) + return true; + return false; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_18.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_18.java new file mode 100644 index 0000000..b0f21e4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_18.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +import com.android.jack.opcodes.invoke_static.jm.TestClass; + +public class T_invoke_static_18 { + + public int run() { + return TestClass.testP(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_2.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_2.java new file mode 100644 index 0000000..58f2bda --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_2.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +import com.android.jack.opcodes.invoke_static.jm.TestClass; + +public class T_invoke_static_2 { + + public int run() { + return TestClass.test(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_20.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_20.java new file mode 100644 index 0000000..8e9cf36 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_20.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_20 { + + public int run() { + return Math.abs(-1234567); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_4.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_4.java new file mode 100644 index 0000000..daec2a9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_4.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_4 { + + static long v2 = 123456789l; + + public static long run() { + return v2; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_5.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_5.java new file mode 100644 index 0000000..ab84180 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_5.java @@ -0,0 +1,28 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_5 { + + public int run() { + return test(5); + } + + public int test(int i1) { + return i1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_6.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_6.java new file mode 100644 index 0000000..d75bff2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_6.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_6 { + + public static native void test(); + + public void run() { + test(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_7.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_7.java new file mode 100644 index 0000000..3053da9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_7.java @@ -0,0 +1,28 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_7 { + + public static void test(){ + } + + public void run(){ + test(); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_8.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_8.java new file mode 100644 index 0000000..f4b6b33 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_8.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class T_invoke_static_8 { + + public void run(){ + TestClass.test(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/TestClass.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/TestClass.java new file mode 100644 index 0000000..61227ae --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/TestClass.java @@ -0,0 +1,45 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class TestClass { + + public static int test(){ + return 777; + } + + public static int test1(int i1){ + int i = i1 + 5; + return i; + } + + public static int testArgsOrder(int i1, int i2){ + int a = 3454; + int b = 2302; + int i = i1 / i2; + return i; + } + + protected static int testP(){ + return 888; + } + + private static void testPvt(){ + + } +} + diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/TestClassAbstract.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/TestClassAbstract.java new file mode 100644 index 0000000..fd9a847 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/TestClassAbstract.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public abstract class TestClassAbstract { + + public abstract void test(); +} + diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/TestClassInitError.java b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/TestClassInitError.java new file mode 100644 index 0000000..9396501 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_static/jm/TestClassInitError.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_static.jm; + +public class TestClassInitError { + static int a = 1 / 0; + public static void test() { + + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_super/Test_invoke_super.java b/jack-tests/tests/com/android/jack/opcodes/invoke_super/Test_invoke_super.java new file mode 100644 index 0000000..8b1539a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_super/Test_invoke_super.java @@ -0,0 +1,70 @@ +/* + * 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.jack.opcodes.invoke_super; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.invoke_super.jm.T_invoke_super_1; +import com.android.jack.opcodes.invoke_super.jm.T_invoke_super_15; +import com.android.jack.opcodes.invoke_super.jm.T_invoke_super_18; +import com.android.jack.opcodes.invoke_super.jm.T_invoke_super_19; +import com.android.jack.opcodes.invoke_super.jm.T_invoke_super_26; + + +public class Test_invoke_super extends DxTestCase { + /** + * @title Superclass' method call + */ + public void testN1() { + //@uses com.android.jack.opcodes.invokespecial.jm.TSuper + T_invoke_super_1 t = new T_invoke_super_1(); + assertEquals(5, t.run()); + } + + /** + * @title Invoke method of superclass of superclass + */ + public void testN3() { + //@uses com.android.jack.opcodes.invokespecial.jm.TSuper + //@uses com.android.jack.opcodes.invokespecial.jm.TSuper2 + T_invoke_super_15 t = new T_invoke_super_15(); + assertEquals(5, t.run()); + } + + /** + * @title Invoke protected method of superclass if method with the + * same name exists in "this" class + */ + public void testN5() { + //@uses com.android.jack.opcodes.invokespecial.jm.TSuper + T_invoke_super_18 t = new T_invoke_super_18(); + assertEquals(5, t.run()); + } + + /** + * @title Check that method's arguments are popped from stack + */ + public void testN6() { + //@uses com.android.jack.opcodes.invokespecial.jm.TSuper + T_invoke_super_19 t = new T_invoke_super_19(); + assertEquals(2, t.run()); + } + + public void testN10() { + T_invoke_super_26 t = new T_invoke_super_26(); + assertEquals(13, t.run()); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/TSuper.java b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/TSuper.java new file mode 100644 index 0000000..47201f2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/TSuper.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +/** 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.jack.opcodes.invoke_super.jm; + +/** + * @author fjost + * + */ +public class TSuper { + public int toInt() { + return 5; + } + + public int toInt(float v) { + return (int)v; + } + + public int testArgsOrder(int a, int b) { + return a/b; + } + + public native int toIntNative(); + + public static int toIntStatic() { + return 5; + } + + protected int toIntP() { + return 5; + } + + private int toIntPvt() { + return 5; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/TSuper2.java b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/TSuper2.java new file mode 100644 index 0000000..8b512fb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/TSuper2.java @@ -0,0 +1,42 @@ +/* + * 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. + */ + +/** 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.jack.opcodes.invoke_super.jm; + +/** + * @author fjost + * + */ +public class TSuper2 extends TSuper { + + public int test() { + return 13; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_1.java b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_1.java new file mode 100644 index 0000000..e2a2f1c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_1.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.invoke_super.jm; + + +public class T_invoke_super_1 extends TSuper { + + public int run() { + return super.toInt(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_14.java b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_14.java new file mode 100644 index 0000000..e65cc12 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_14.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.invoke_super.jm; + + +public class T_invoke_super_14 extends TSuper { + + public int run() { + return super.toInt(5f); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_15.java b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_15.java new file mode 100644 index 0000000..3387cc8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_15.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.invoke_super.jm; + + +public class T_invoke_super_15 extends TSuper2 { + + public int run() { + return super.toInt(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_18.java b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_18.java new file mode 100644 index 0000000..2cd09a9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_18.java @@ -0,0 +1,29 @@ +/* + * 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.jack.opcodes.invoke_super.jm; + + +public class T_invoke_super_18 extends TSuper { + + protected int toIntP() { + return 10; + } + + public int run() { + return super.toIntP(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_19.java b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_19.java new file mode 100644 index 0000000..dab3c0e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_19.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.invoke_super.jm; + + +public class T_invoke_super_19 extends TSuper { + + public int run() { + return super.testArgsOrder(128, 64); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_26.java b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_26.java new file mode 100644 index 0000000..d19103f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_26.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.invoke_super.jm; + + +public class T_invoke_super_26 extends TSuper2 { + + public int run() { + return super.test(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/TProtected.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/TProtected.java new file mode 100644 index 0000000..ccffbeb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/TProtected.java @@ -0,0 +1,30 @@ +/* + * 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.jack.opcodes.invoke_virtual; + +public class TProtected { + + @SuppressWarnings("unused") + private void TestStub() { + // used by testE6 + } + + + protected void TestStubP() { + // used by testE7 + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/Test_invoke_virtual.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/Test_invoke_virtual.java new file mode 100644 index 0000000..f435bb2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/Test_invoke_virtual.java @@ -0,0 +1,135 @@ +/* + * 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.jack.opcodes.invoke_virtual; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_1; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_13; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_14; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_17; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_19; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_2; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_22; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_23; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_4; +import com.android.jack.opcodes.invoke_virtual.jm.T_invoke_virtual_7; + + +public class Test_invoke_virtual extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_invoke_virtual_1 t = new T_invoke_virtual_1(); + int a = 1; + String sa = "a" + a; + String sb = "a1"; + assertTrue(t.run(sa, sb)); + assertFalse(t.run(this, sa)); + assertFalse(t.run(sb, this)); + } + + /** + * @title Check that monitor is acquired if method is synchronized + */ + public void testN2() { + assertTrue(T_invoke_virtual_2.execute()); + } + + /** + * @title Invoke protected method of superclass + */ + public void testN3() { + // @uses com.android.jack.opcodes.invoke_virtual.jm.TSuper + T_invoke_virtual_7 t = new T_invoke_virtual_7(); + assertEquals(5, t.run()); + } + + /** + * @title Private method call + */ + public void testN4() { + T_invoke_virtual_13 t = new T_invoke_virtual_13(); + assertEquals(345, t.run()); + } + + /** + * @title Check that new frame is created by invoke_virtual and + * arguments are passed to method + */ + public void testN5() { + // @uses com.android.jack.opcodes.invoke_virtual.jm.TSuper + T_invoke_virtual_14 t = new T_invoke_virtual_14(); + assertTrue(t.run()); + } + + /** + * @title Recursion of method lookup procedure + */ + public void testN6() { + // @uses com.android.jack.opcodes.invoke_virtual.jm.TSuper + T_invoke_virtual_17 t = new T_invoke_virtual_17(); + assertEquals(5, t.run()); + } + + /** + * @title Recursion of method lookup procedure + */ + public void testN7() { + // @uses com.android.jack.opcodes.invoke_virtual.jm.TSuper + T_invoke_virtual_19 t = new T_invoke_virtual_19(); + assertEquals(3, t.run()); + } + + public void testN8() { + T_invoke_virtual_22 t = new T_invoke_virtual_22(); + assertEquals(1, t.run()); + } + + public void testN9() { + T_invoke_virtual_23 t = new T_invoke_virtual_23(); + assertEquals(13, t.run()); + } + + /** + * @title + */ + public void testE1() { + T_invoke_virtual_1 t = new T_invoke_virtual_1(); + String s = "s"; + try { + t.run(null, s); + fail("expected NullPointerException"); + } catch (NullPointerException npe) { + // expected + } + } + + /** + * @title Native method can't be linked + */ + public void testE2() { + T_invoke_virtual_4 t = new T_invoke_virtual_4(); + try { + t.run(); + fail("expected UnsatisfiedLinkError"); + } catch (UnsatisfiedLinkError ule) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/ATest.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/ATest.java new file mode 100644 index 0000000..f5a26ce --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/ATest.java @@ -0,0 +1,23 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +public abstract class ATest { + + public abstract void test(); + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/TPlain.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/TPlain.java new file mode 100644 index 0000000..603a921 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/TPlain.java @@ -0,0 +1,41 @@ +/* + * 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. + */ + +/** 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.jack.opcodes.invoke_virtual.jm; + +/** + * @author fjost + * + */ +public class TPlain { + public int toInt() { + return 1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/TSuper.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/TSuper.java new file mode 100644 index 0000000..6a6f2bd --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/TSuper.java @@ -0,0 +1,66 @@ +/* + * 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. + */ + +/** 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.jack.opcodes.invoke_virtual.jm; + +/** + * @author fjost + * + */ +public class TSuper { + public int toInt() { + return 5; + } + + public int toInt(float v) { + return (int)v; + } + + public native int toIntNative(); + + public static int toIntStatic() { + return 5; + } + + protected int toIntP() { + return 5; + } + + private int toIntPvt() { + return 5; + } + + public int testArgsOrder(int a, int b){ + int i = 349; + int j = 344656; + return a / b; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/TSuper2.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/TSuper2.java new file mode 100644 index 0000000..e616a7e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/TSuper2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +public class TSuper2 extends TSuper { + + public int test() { + return 13; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_1.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_1.java new file mode 100644 index 0000000..8ec270a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +public class T_invoke_virtual_1 { + + public boolean run(Object x, Object y) { + return x.equals(y); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_13.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_13.java new file mode 100644 index 0000000..c33299e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_13.java @@ -0,0 +1,28 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +public class T_invoke_virtual_13 { + + public int run() { + return getInt(); + } + + private int getInt() { + return 345; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_14.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_14.java new file mode 100644 index 0000000..ecff4fc --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_14.java @@ -0,0 +1,33 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +import com.android.jack.opcodes.invoke_virtual.jm.TSuper; + + +public class T_invoke_virtual_14 extends TSuper { + + public boolean run() { + int a = 123; + int b = 659; + if(testArgsOrder(300, 3) == 100) + if(a == 123) + if(b == 659) + return true; + return false; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_17.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_17.java new file mode 100644 index 0000000..b623f89 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_17.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +import com.android.jack.opcodes.invoke_virtual.jm.TSuper; + + +public class T_invoke_virtual_17 extends TSuper { + + public int run() { + return toInt(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_19.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_19.java new file mode 100644 index 0000000..be40833 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_19.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +import com.android.jack.opcodes.invoke_virtual.jm.TSuper; + + +public class T_invoke_virtual_19 extends TSuper { + + public int run() { + return toInt(3.14f); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_2.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_2.java new file mode 100644 index 0000000..262ceed --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_2.java @@ -0,0 +1,58 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +public class T_invoke_virtual_2 implements Runnable { + public final static int CNT = 1000; + int value = 0; + boolean failed = false; + + public void run() { + for(int i = 0; i < CNT; i++) { + test(); + } + } + + public synchronized void test() { + value++; + int c = value; + Thread.yield(); + if(c != value) + failed = true; + } + + public static boolean execute() { + T_invoke_virtual_2 test = new T_invoke_virtual_2(); + Thread t1 = new Thread(test); + Thread t2 = new Thread(test); + + t1.start(); + t2.start(); + + try + { + Thread.sleep(5000); + } + catch(InterruptedException ie) { + return false; + } + + if(test.value != CNT * 2) + return false; + return !test.failed; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_22.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_22.java new file mode 100644 index 0000000..06fe65b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_22.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +import com.android.jack.opcodes.invoke_virtual.jm.TSuper; + +public class T_invoke_virtual_22 extends TSuper { + + public int run() { + TPlain p = new TPlain(); + return p.toInt(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_23.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_23.java new file mode 100644 index 0000000..581b46e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_23.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +public class T_invoke_virtual_23 extends TSuper2 { + + public int run() { + return super.test(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_4.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_4.java new file mode 100644 index 0000000..ed9c2a4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_4.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +public class T_invoke_virtual_4 { + + public native void test(); + + public void run() { + test(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_7.java b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_7.java new file mode 100644 index 0000000..9bd78f9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_7.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.invoke_virtual.jm; + +import com.android.jack.opcodes.invoke_virtual.jm.TSuper; + + +public class T_invoke_virtual_7 extends TSuper { + + public int run() { + return toIntP(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iput/TIput.java b/jack-tests/tests/com/android/jack/opcodes/iput/TIput.java new file mode 100644 index 0000000..e84e479 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iput/TIput.java @@ -0,0 +1,29 @@ +/* + * 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.jack.opcodes.iput; + +class TIput { + // used by testE2 + @SuppressWarnings("unused") + private int TestStubField = 0; + + // used by testE7 + protected int TestStubFieldP = 0; + + // used by testE5 + public final int TestStubFieldFinal = 0; +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iput/Test_iput.java b/jack-tests/tests/com/android/jack/opcodes/iput/Test_iput.java new file mode 100644 index 0000000..3ba68e1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iput/Test_iput.java @@ -0,0 +1,90 @@ +/* + * 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.jack.opcodes.iput; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.iput.jm.T_iput_1; +import com.android.jack.opcodes.iput.jm.T_iput_12; +import com.android.jack.opcodes.iput.jm.T_iput_14; +import com.android.jack.opcodes.iput.jm.T_iput_16; +import com.android.jack.opcodes.iput.jm.T_iput_18; +import com.android.jack.opcodes.iput.jm.T_iput_2; + + +public class Test_iput extends DxTestCase { + + /** + * @title type - int + */ + public void testN1() { + T_iput_1 t = new T_iput_1(); + assertEquals(0, t.st_i1); + t.run(); + assertEquals(1000000, t.st_i1); + } + + /** + * @title type - double + */ + public void testN2() { + T_iput_2 t = new T_iput_2(); + assertEquals(0d, t.st_d1); + t.run(); + assertEquals(1000000d, t.st_d1); + } + + /** + * @title modification of final field + */ + public void testN3() { + T_iput_12 t = new T_iput_12(); + assertEquals(0, t.st_i1); + t.run(); + assertEquals(1000000, t.st_i1); + } + + /** + * @title modification of protected field from subclass + */ + public void testN4() { + // @uses com.android.jack.opcodes.iput.jm.T_iput_1 + T_iput_14 t = new T_iput_14(); + assertEquals(0, t.getProtectedField()); + t.run(); + assertEquals(1000000, t.getProtectedField()); + } + + /** + * @title assignment compatible object references + */ + public void testN5() { + // @uses com.android.jack.opcodes.iput.jm.TChild + // @uses com.android.jack.opcodes.iput.jm.TSuper + T_iput_18 t = new T_iput_18(); + assertEquals(0, t.run().compareTo("xyz")); + } + + /** + * @title assignment compatible values + */ + public void testN6() { + T_iput_16 t = new T_iput_16(); + assertNull(t.o); + t.run(); + assertEquals("", (String) t.o); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_1.java b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_1.java new file mode 100644 index 0000000..04b3b2e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_1.java @@ -0,0 +1,32 @@ +/* + * 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.jack.opcodes.iput.jm; + +public class T_iput_1 { + public int st_i1; + protected int st_p1; + private int st_pvt1; + + public void run() { + st_i1 = 1000000; + } + + public int getPvtField() + { + return st_pvt1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_12.java b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_12.java new file mode 100644 index 0000000..6110ba8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_12.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.iput.jm; + +public class T_iput_12 { + public int st_i1; + + public void run() { + st_i1 = 1000000; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_14.java b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_14.java new file mode 100644 index 0000000..93ed641 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_14.java @@ -0,0 +1,29 @@ +/* + * 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.jack.opcodes.iput.jm; + +public class T_iput_14 extends T_iput_1{ + + public void run() { + st_p1 = 1000000; + } + + public int getProtectedField(){ + return st_p1; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_16.java b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_16.java new file mode 100644 index 0000000..7f95766 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_16.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.iput.jm; + +public class T_iput_16 { + + public Object o = null; + + public void run() { + String s = new String(""); + o = s; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_18.java b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_18.java new file mode 100644 index 0000000..40dcd32 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_18.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.iput.jm; + +public class T_iput_18 { + + public String run() { + TChild c = new TChild(); + c.s = "xyz"; + return c.s; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_2.java b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_2.java new file mode 100644 index 0000000..257cbb8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iput/jm/T_iput_2.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.iput.jm; + +public class T_iput_2 { + + public double st_d1; + + public void run() { + st_d1 = 1000000d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/iput/jm/TestStubs.java b/jack-tests/tests/com/android/jack/opcodes/iput/jm/TestStubs.java new file mode 100644 index 0000000..389f9d5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/iput/jm/TestStubs.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.iput.jm; + + + +class TSuper { + public String s = "abc"; +} + +class TChild extends TSuper { + public Object o = null; +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_double/Test_long_to_double.java b/jack-tests/tests/com/android/jack/opcodes/long_to_double/Test_long_to_double.java new file mode 100644 index 0000000..476979c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_double/Test_long_to_double.java @@ -0,0 +1,91 @@ +/* + * 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.jack.opcodes.long_to_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.long_to_double.jm.T_long_to_double_1; +import com.android.jack.opcodes.long_to_double.jm.T_long_to_double_3; +import com.android.jack.opcodes.long_to_double.jm.T_long_to_double_4; + + +public class Test_long_to_double extends DxTestCase { + + /** + * @title Argument = 50000000000 + */ + public void testN1() { + T_long_to_double_1 t = new T_long_to_double_1(); + assertEquals(5.0E10d, t.run(50000000000l), 0d); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_long_to_double_1 t = new T_long_to_double_1(); + assertEquals(1d, t.run(1l), 0d); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_long_to_double_1 t = new T_long_to_double_1(); + assertEquals(-1d, t.run(-1l), 0d); + } + + /** + * @title Argument = -1 + */ + public void testN4() { + T_long_to_double_3 t = new T_long_to_double_3(); + assertEquals(-1d, t.run(-1l), 0d); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_long_to_double_4 t = new T_long_to_double_4(); + assertEquals(-1d, t.run(-1), 0d); + } + + /** + * @title Argument = Long.MAX_VALUE + */ + public void testB1() { + T_long_to_double_1 t = new T_long_to_double_1(); + assertEquals(9.223372036854776E18d, t.run(Long.MAX_VALUE), 0d); + } + + /** + * @title Argument = Long.MIN_VALUE + */ + public void testB2() { + T_long_to_double_1 t = new T_long_to_double_1(); + assertEquals(-9.223372036854776E18, t.run(Long.MIN_VALUE), 0d); + } + + /** + * @title Argument = 0 + */ + public void testB3() { + T_long_to_double_1 t = new T_long_to_double_1(); + assertEquals(0d, t.run(0), 0d); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_1.java b/jack-tests/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_1.java new file mode 100644 index 0000000..bb6b351 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.long_to_double.jm; + +public class T_long_to_double_1 { + + public double run(long a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_3.java b/jack-tests/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_3.java new file mode 100644 index 0000000..61e2333 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_3.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.long_to_double.jm; + +public class T_long_to_double_3 { + + public double run(float a) { + return a; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_4.java b/jack-tests/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_4.java new file mode 100644 index 0000000..427fdeb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.long_to_double.jm; + +public class T_long_to_double_4 { + + public double run(int a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_float/Test_long_to_float.java b/jack-tests/tests/com/android/jack/opcodes/long_to_float/Test_long_to_float.java new file mode 100644 index 0000000..dba67cc --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_float/Test_long_to_float.java @@ -0,0 +1,91 @@ +/* + * 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.jack.opcodes.long_to_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.long_to_float.jm.T_long_to_float_1; +import com.android.jack.opcodes.long_to_float.jm.T_long_to_float_3; +import com.android.jack.opcodes.long_to_float.jm.T_long_to_float_4; + + +public class Test_long_to_float extends DxTestCase { + + /** + * @title Argument = 123456789012345 + */ + public void testN1() { + T_long_to_float_1 t = new T_long_to_float_1(); + assertEquals(1.23456788E14f, t.run(123456789012345l), 0f); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_long_to_float_1 t = new T_long_to_float_1(); + assertEquals(1f, t.run(1l), 0f); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_long_to_float_1 t = new T_long_to_float_1(); + assertEquals(-1f, t.run(-1l), 0f); + } + + /** + * @title Argument = -1 + */ + public void testN4() { + T_long_to_float_3 t = new T_long_to_float_3(); + assertEquals(-1f, t.run(-1l), 0f); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_long_to_float_4 t = new T_long_to_float_4(); + assertEquals(-1f, t.run(-1), 0f); + } + + /** + * @title Argument = Long.MAX_VALUE + */ + public void testB1() { + T_long_to_float_1 t = new T_long_to_float_1(); + assertEquals(9.223372036854776E18, t.run(Long.MAX_VALUE), 0f); + } + + /** + * @title Argument = Long.MIN_VALUE + */ + public void testB2() { + T_long_to_float_1 t = new T_long_to_float_1(); + assertEquals(-9.223372036854776E18, t.run(Long.MIN_VALUE), 0f); + } + + /** + * @title Argument = 0 + */ + public void testB3() { + T_long_to_float_1 t = new T_long_to_float_1(); + assertEquals(0f, t.run(0l), 0f); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_1.java b/jack-tests/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_1.java new file mode 100644 index 0000000..e3fd86b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.long_to_float.jm; + +public class T_long_to_float_1 { + + public float run(long a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_3.java b/jack-tests/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_3.java new file mode 100644 index 0000000..9bc2b48 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.long_to_float.jm; + +public class T_long_to_float_3 { + + public float run(double a) { + return (float)a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_4.java b/jack-tests/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_4.java new file mode 100644 index 0000000..2220164 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.long_to_float.jm; + +public class T_long_to_float_4 { + + public float run(int a) { + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_int/Test_long_to_int.java b/jack-tests/tests/com/android/jack/opcodes/long_to_int/Test_long_to_int.java new file mode 100644 index 0000000..f5a4903 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_int/Test_long_to_int.java @@ -0,0 +1,99 @@ +/* + * 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.jack.opcodes.long_to_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.long_to_int.jm.T_long_to_int_1; +import com.android.jack.opcodes.long_to_int.jm.T_long_to_int_3; +import com.android.jack.opcodes.long_to_int.jm.T_long_to_int_4; + + +public class Test_long_to_int extends DxTestCase { + + /** + * @title Argument = 0xAAAAFFEEDDCCl + */ + public void testN1() { + T_long_to_int_1 t = new T_long_to_int_1(); + assertEquals(0xFFEEDDCC, t.run(0xAAAAFFEEDDCCl)); + } + + /** + * @title Argument = -123456789 + */ + public void testN2() { + T_long_to_int_1 t = new T_long_to_int_1(); + assertEquals(-123456789, t.run(-123456789l)); + } + + /** + * @title Argument = 1 + */ + public void testN3() { + T_long_to_int_1 t = new T_long_to_int_1(); + assertEquals(1, t.run(1l)); + } + + /** + * @title Argument = -1 + */ + public void testN4() { + T_long_to_int_1 t = new T_long_to_int_1(); + assertEquals(-1, t.run(-1l)); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_long_to_int_3 t = new T_long_to_int_3(); + assertEquals(-1, t.run(-1l)); + } + + /** + * @title Argument = -1 + */ + public void testN6() { + T_long_to_int_4 t = new T_long_to_int_4(); + assertEquals(-1, t.run(-1l)); + } + + /** + * @title Argument = Long.MAX_VALUE + */ + public void testB1() { + T_long_to_int_1 t = new T_long_to_int_1(); + assertEquals(-1, t.run(Long.MAX_VALUE)); + } + + /** + * @title Argument = Long.MIN_VALUE + */ + public void testB2() { + T_long_to_int_1 t = new T_long_to_int_1(); + assertEquals(0, t.run(Long.MIN_VALUE)); + } + + /** + * @title Argument = 0 + */ + public void testB3() { + T_long_to_int_1 t = new T_long_to_int_1(); + assertEquals(0, t.run(0l)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_1.java b/jack-tests/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_1.java new file mode 100644 index 0000000..e83c215 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.long_to_int.jm; + +public class T_long_to_int_1 { + + public int run(long a) { + return (int) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_3.java b/jack-tests/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_3.java new file mode 100644 index 0000000..a6cc593 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.long_to_int.jm; + +public class T_long_to_int_3 { + + public int run(double a) { + return (int) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_4.java b/jack-tests/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_4.java new file mode 100644 index 0000000..4348c41 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.long_to_int.jm; + +public class T_long_to_int_4 { + + public int run(float a) { + return (int) a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/monitor_enter/Test_monitor_enter.java b/jack-tests/tests/com/android/jack/opcodes/monitor_enter/Test_monitor_enter.java new file mode 100644 index 0000000..fa31ad4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/monitor_enter/Test_monitor_enter.java @@ -0,0 +1,113 @@ +/* + * 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.jack.opcodes.monitor_enter; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.monitor_enter.jm.T_monitor_enter_1; +import com.android.jack.opcodes.monitor_enter.jm.T_monitor_enter_2; +import com.android.jack.opcodes.monitor_enter.jm.T_monitor_enter_4; + + +public class Test_monitor_enter extends DxTestCase { + + /** + * @title normal test + * + * @throws InterruptedException + */ + public void testN1() throws InterruptedException { + //@uses com.android.jack.opcodes.monitor_enter.TestRunnable + final T_monitor_enter_1 t1 = new T_monitor_enter_1(); + Runnable r1 = new TestRunnable(t1); + Runnable r2 = new TestRunnable(t1); + Thread tr1 = new Thread(r1); + Thread tr2 = new Thread(r2); + tr1.start(); + tr2.start(); + + tr1.join(); + tr2.join(); + assertEquals(2, t1.counter); + } + + /** + * @title Tests behavior when monitor owned by current thread. + * + * @throws InterruptedException + */ + public void testN2() throws InterruptedException { + //@uses com.android.jack.opcodes.monitor_enter.TestRunnable2 + final T_monitor_enter_2 t1 = new T_monitor_enter_2(); + Runnable r1 = new TestRunnable2(t1, 10); + Runnable r2 = new TestRunnable2(t1, 20); + Thread tr1 = new Thread(r1); + Thread tr2 = new Thread(r2); + tr1.start(); + tr2.start(); + + tr1.join(); + tr2.join(); + assertTrue(t1.result); + } + + + /** + * @title expected NullPointerException + */ + public void testE1() { + T_monitor_enter_4 t = new T_monitor_enter_4(); + try { + t.run(); + fail("expected NullPointerException"); + } catch (NullPointerException npe) { + // expected + } + } + +} + +class TestRunnable implements Runnable { + private T_monitor_enter_1 t1; + TestRunnable(T_monitor_enter_1 t1) { + this.t1 = t1; + } + + public void run() { + try { + t1.run(); + } catch (InterruptedException e) { + throw new RuntimeException("interrupted!"); + } + } +} + +class TestRunnable2 implements Runnable { + private T_monitor_enter_2 t2; + private int val; + TestRunnable2(T_monitor_enter_2 t2, int val) { + this.t2 = t2; + this.val = val; + } + + public void run() { + try { + t2.run(val); + } catch (InterruptedException e) { + throw new RuntimeException("interrupted!"); + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_1.java b/jack-tests/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_1.java new file mode 100644 index 0000000..1097f4e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_1.java @@ -0,0 +1,29 @@ +/* + * 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.jack.opcodes.monitor_enter.jm; + +public class T_monitor_enter_1 { + public int counter = 0; + + public void run() throws InterruptedException { + synchronized(this) { + int a = counter; + Thread.sleep(500); + counter = ++a; + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_2.java b/jack-tests/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_2.java new file mode 100644 index 0000000..9927de6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_2.java @@ -0,0 +1,35 @@ +/* + * 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.jack.opcodes.monitor_enter.jm; + +public class T_monitor_enter_2 { + + private int flg = 0; + public boolean result = true; + + public void run(int v) throws InterruptedException { + synchronized(this) { + synchronized(this) { + flg = v; + } + Thread.sleep(500); + if(flg != v) { + result = false; + } + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_4.java b/jack-tests/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_4.java new file mode 100644 index 0000000..c110322 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_4.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.monitor_enter.jm; + +public class T_monitor_enter_4 { + + public void run() { + Object o = null; + synchronized(o) { + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_double/Test_mul_double.java b/jack-tests/tests/com/android/jack/opcodes/mul_double/Test_mul_double.java new file mode 100644 index 0000000..66fcd80 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_double/Test_mul_double.java @@ -0,0 +1,135 @@ +/* + * 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.jack.opcodes.mul_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.mul_double.jm.T_mul_double_1; +import com.android.jack.opcodes.mul_double.jm.T_mul_double_3; +import com.android.jack.opcodes.mul_double.jm.T_mul_double_4; + + +public class Test_mul_double extends DxTestCase { + + /** + * @title Arguments = 2.7d, 3.14d + */ + + public void testN1() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(8.478000000000002d, t.run(2.7d, 3.14d)); + } + + /** + * @title Arguments = 0, -3.14d + */ + public void testN2() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(-0d, t.run(0, -3.14d)); + } + + /** + * @title Arguments = -2.7d, -3.14d + */ + public void testN3() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(8.478000000000002d, t.run(-3.14d, -2.7d)); + } + + /** + * @title Arguments = -2.7d, -3.14d + */ + public void testN4() { + T_mul_double_3 t = new T_mul_double_3(); + assertEquals(8.478000283241272d, t.run(-3.14f, -2.7d)); + } + + /** + * @title Arguments = -2.7d, -3.14d + */ + public void testN5() { + T_mul_double_4 t = new T_mul_double_4(); + assertEquals(847.8000000000001d, t.run(-314l, -2.7d)); + } + + /** + * @title Arguments = Double.MAX_VALUE, Double.NaN + */ + public void testB1() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(Double.NaN, t.run(Double.MAX_VALUE, Double.NaN)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, 0 + */ + public void testB2() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(Double.NaN, t.run(Double.POSITIVE_INFINITY, 0)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, -2.7d + */ + public void testB3() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.POSITIVE_INFINITY, + -2.7d)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, + * Double.NEGATIVE_INFINITY + */ + public void testB4() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.POSITIVE_INFINITY, + Double.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = +0, -0d + */ + public void testB5() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(-0d, t.run(+0d, -0d)); + } + + /** + * @title Arguments = -0d, -0d + */ + public void testB6() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(+0d, t.run(-0d, -0d)); + } + + /** + * @title Arguments = Double.MAX_VALUE, Double.MAX_VALUE + */ + public void testB7() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(Double.POSITIVE_INFINITY, t.run(Double.MAX_VALUE, + Double.MAX_VALUE)); + } + + /** + * @title Arguments = Double.MIN_VALUE, -1.4E-45f + */ + public void testB8() { + T_mul_double_1 t = new T_mul_double_1(); + assertEquals(-0d, t.run(Double.MIN_VALUE, -1.4E-45f)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_1.java b/jack-tests/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_1.java new file mode 100644 index 0000000..89881c5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_double.jm; + +public class T_mul_double_1 { + + public double run(double a, double b) { + return a*b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_3.java b/jack-tests/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_3.java new file mode 100644 index 0000000..024958d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_double.jm; + +public class T_mul_double_3 { + + public double run(float a, double b) { + return (double)a*b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_4.java b/jack-tests/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_4.java new file mode 100644 index 0000000..2d9a80e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_double.jm; + +public class T_mul_double_4 { + + public double run(long a, double b) { + return (double)a*b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_float/Test_mul_float.java b/jack-tests/tests/com/android/jack/opcodes/mul_float/Test_mul_float.java new file mode 100644 index 0000000..fe22406 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_float/Test_mul_float.java @@ -0,0 +1,135 @@ +/* + * 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.jack.opcodes.mul_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.mul_float.jm.T_mul_float_1; +import com.android.jack.opcodes.mul_float.jm.T_mul_float_3; +import com.android.jack.opcodes.mul_float.jm.T_mul_float_4; + + +public class Test_mul_float extends DxTestCase { + + /** + * @title Arguments = 2.7f, 3.14f + */ + public void testN1() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(8.478001f, t.run(2.7f, 3.14f)); + } + + /** + * @title Arguments = 0, -3.14f + */ + public void testN2() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(-0f, t.run(0, -3.14f)); + } + + /** + * @title Arguments = -2.7f, -3.14f + */ + public void testN3() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(8.478001f, t.run(-3.14f, -2.7f)); + } + + /** + * @title Arguments = -2.7f, -3.14f + */ + public void testN4() { + T_mul_float_3 t = new T_mul_float_3(); + assertEquals(8.478001f, t.run(-3.14f, -2.7f)); + } + + /** + * @title Arguments = -2.7f, -3.14f + */ + public void testN5() { + T_mul_float_4 t = new T_mul_float_4(); + assertEquals(847.8f, t.run(-314l, -2.7f)); + } + + /** + * @title Arguments = Float.MAX_VALUE, Float.NaN + */ + public void testB1() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(Float.NaN, t.run(Float.MAX_VALUE, Float.NaN)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, 0 + */ + public void testB2() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(Float.NaN, t.run(Float.POSITIVE_INFINITY, 0)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, -2.7f + */ + public void testB3() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(Float.NEGATIVE_INFINITY, t.run(Float.POSITIVE_INFINITY, + -2.7f)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, + * Float.NEGATIVE_INFINITY + */ + public void testB4() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(Float.NEGATIVE_INFINITY, t.run(Float.POSITIVE_INFINITY, + Float.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = +0, -0f + */ + public void testB5() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(-0f, t.run(+0f, -0f)); + } + + /** + * @title Arguments = -0f, -0f + */ + public void testB6() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(+0f, t.run(-0f, -0f)); + } + + /** + * @title Arguments = Float.MAX_VALUE, Float.MAX_VALUE + */ + public void testB7() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(Float.MAX_VALUE, + Float.MAX_VALUE)); + } + + /** + * @title Arguments = Float.MIN_VALUE, -1.4E-45f + */ + public void testB8() { + T_mul_float_1 t = new T_mul_float_1(); + assertEquals(-0f, t.run(Float.MIN_VALUE, -1.4E-45f)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_1.java b/jack-tests/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_1.java new file mode 100644 index 0000000..86f14e2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_float.jm; + +public class T_mul_float_1 { + + public float run(float a, float b) { + return a*b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_3.java b/jack-tests/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_3.java new file mode 100644 index 0000000..a3bd46d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_float.jm; + +public class T_mul_float_3 { + + public float run(float a, double b) { + return a*(float)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_4.java b/jack-tests/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_4.java new file mode 100644 index 0000000..e6471ad --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_float.jm; + +public class T_mul_float_4 { + + public float run(long a, float b) { + return (float)a*b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_int/Test_mul_int.java b/jack-tests/tests/com/android/jack/opcodes/mul_int/Test_mul_int.java new file mode 100644 index 0000000..5366161 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_int/Test_mul_int.java @@ -0,0 +1,116 @@ +/* + * 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.jack.opcodes.mul_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.mul_int.jm.T_mul_int_1; +import com.android.jack.opcodes.mul_int.jm.T_mul_int_3; +import com.android.jack.opcodes.mul_int.jm.T_mul_int_4; + + +public class Test_mul_int extends DxTestCase { + + /** + * @title Arguments = 8, 4 + */ + public void testN1() { + T_mul_int_1 t = new T_mul_int_1(); + assertEquals(32, t.run(8, 4)); + } + + /** + * @title Arguments = -2, 255 + */ + public void testN2() { + T_mul_int_1 t = new T_mul_int_1(); + assertEquals(-510, t.run(-2, 255)); + } + + /** + * @title Arguments = 0x7ffffffe, 2 + */ + public void testN3() { + T_mul_int_1 t = new T_mul_int_1(); + assertEquals(-4, t.run(0x7ffffffe, 2)); + } + + /** + * @title Arguments = 4, 0x80000001 + */ + public void testN4() { + T_mul_int_1 t = new T_mul_int_1(); + assertEquals(4, t.run(4, 0x80000001)); + } + + /** + * @title Arguments = 4, 0x80000001 + */ + public void testN5() { + T_mul_int_3 t = new T_mul_int_3(); + assertEquals(4, t.run(4, 0x80000001)); + } + + /** + * @title Arguments = 4, 0x80000001 + */ + public void testN6() { + T_mul_int_4 t = new T_mul_int_4(); + assertEquals(4, t.run(4, 0x80000001)); + } + + /** + * @title Arguments = 0, Integer.MAX_VALUE + */ + public void testB1() { + T_mul_int_1 t = new T_mul_int_1(); + assertEquals(0, t.run(0, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, 1 + */ + public void testB2() { + T_mul_int_1 t = new T_mul_int_1(); + assertEquals(Integer.MAX_VALUE, t.run(Integer.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, 1 + */ + public void testB3() { + T_mul_int_1 t = new T_mul_int_1(); + assertEquals(Integer.MIN_VALUE, t.run(Integer.MIN_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MIN_VALUE + */ + public void testB4() { + T_mul_int_1 t = new T_mul_int_1(); + assertEquals(Integer.MIN_VALUE, t.run(Integer.MAX_VALUE, + Integer.MIN_VALUE)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_mul_int_1 t = new T_mul_int_1(); + assertEquals(0, t.run(0, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_1.java b/jack-tests/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_1.java new file mode 100644 index 0000000..c00e416 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_int.jm; + +public class T_mul_int_1 { + + public int run(int a, int b) { + return a*b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_3.java b/jack-tests/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_3.java new file mode 100644 index 0000000..971e404 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_int.jm; + +public class T_mul_int_3 { + + public int run(int a, double b) { + return a*(int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_4.java b/jack-tests/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_4.java new file mode 100644 index 0000000..6d523f5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_int.jm; + +public class T_mul_int_4 { + + public int run(long a, int b) { + return (int)a*b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_long/Test_mul_long.java b/jack-tests/tests/com/android/jack/opcodes/mul_long/Test_mul_long.java new file mode 100644 index 0000000..28027f1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_long/Test_mul_long.java @@ -0,0 +1,126 @@ +/* + * 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.jack.opcodes.mul_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.mul_long.jm.T_mul_long_1; +import com.android.jack.opcodes.mul_long.jm.T_mul_long_4; +import com.android.jack.opcodes.mul_long.jm.T_mul_long_5; +import com.android.jack.opcodes.mul_long.jm.T_mul_long_6; + + +public class Test_mul_long extends DxTestCase { + + /** + * @title Arguments = 222000000000l, 5000000000l + */ + public void testN1() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(3195355577426903040l, t.run(222000000000l, 5000000000l)); + } + + /** + * @title Arguments = -123456789l, 123456789l + */ + public void testN2() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(-15241578750190521l, t.run(-123456789l, 123456789l)); + } + + /** + * @title Arguments = -123456789l, -123456789l + */ + public void testN3() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(15241578750190521l, t.run(-123456789l, -123456789l)); + } + + /** + * @title Arguments = -123456789l, -123456789l + */ + public void testN4() { + T_mul_long_4 t = new T_mul_long_4(); + assertEquals(15241578750190520l, t.run(-123456789l, -123456789l)); + } + + /** + * @title Arguments = -123456789l, -123456789l + */ + public void testN5() { + T_mul_long_5 t = new T_mul_long_5(); + assertEquals(152345677626l, t.run(-123456789l, -1234)); + } + + /** + * @title Arguments = -123456789l, -123456789l + */ + public void testN6() { + T_mul_long_6 t = new T_mul_long_6(); + assertEquals(15241579434344448l, t.run(-123456789l, -123456789l)); + } + + /** + * @title Arguments = 0, Long.MAX_VALUE + */ + public void testB1() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(0, t.run(0, Long.MAX_VALUE)); + } + /** + * @title Arguments = Long.MAX_VALUE, 1 + */ + public void testB2() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(9223372036854775807L, t.run(Long.MAX_VALUE, 1)); + } + /** + * @title Arguments = Long.MIN_VALUE, 1 + */ + public void testB3() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(-9223372036854775808L, t.run(Long.MIN_VALUE, 1)); + } + /** + * @title Arguments = Long.MAX_VALUE, Long.MIN_VALUE + */ + public void testB4() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(-9223372036854775808L, t.run(Long.MAX_VALUE, + Long.MIN_VALUE)); + } + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(0, t.run(0, 0)); + } + /** + * @title Arguments = Long.MAX_VALUE, -1 + */ + public void testB6() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(-9223372036854775807L, t.run(Long.MAX_VALUE, -1)); + } + /** + * @title Arguments = Long.MIN_VALUE, -1 + */ + public void testB7() { + T_mul_long_1 t = new T_mul_long_1(); + assertEquals(-9223372036854775808L, t.run(Long.MIN_VALUE, -1)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_1.java b/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_1.java new file mode 100644 index 0000000..4bc6da4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_long.jm; + +public class T_mul_long_1 { + + public long run(long a, long b) { + return a*b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_4.java b/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_4.java new file mode 100644 index 0000000..2042dac --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_long.jm; + +public class T_mul_long_4 { + + public long run(long a, double b) { + return (long)(a*b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_5.java b/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_5.java new file mode 100644 index 0000000..32981c5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_long.jm; + +public class T_mul_long_5 { + + public long run(long a, int b) { + return a*b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_6.java b/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_6.java new file mode 100644 index 0000000..0c851b3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.mul_long.jm; + +public class T_mul_long_6 { + + public long run(float a, long b) { + return (long)(a*b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_double/Test_neg_double.java b/jack-tests/tests/com/android/jack/opcodes/neg_double/Test_neg_double.java new file mode 100644 index 0000000..1cdfc14 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_double/Test_neg_double.java @@ -0,0 +1,97 @@ +/* + * 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.jack.opcodes.neg_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.neg_double.jm.T_neg_double_1; + + +public class Test_neg_double extends DxTestCase { + + /** + * @title Argument = 1 + */ + public void testN1() { + T_neg_double_1 t = new T_neg_double_1(); + assertEquals(-1d, t.run(1d)); + } + + /** + * @title Argument = -1 + */ + public void testN2() { + T_neg_double_1 t = new T_neg_double_1(); + assertEquals(1d, t.run(-1d)); + } + + /** + * @title Argument = +0 + */ + public void testN3() { + T_neg_double_1 t = new T_neg_double_1(); + assertEquals(-0d, t.run(+0d)); + } + + /** + * @title Argument = -2.7 + */ + public void testN4() { + T_neg_double_1 t = new T_neg_double_1(); + assertEquals(2.7d, t.run(-2.7d)); + } + + + /** + * @title Argument = Double.NaN + */ + public void testB1() { + T_neg_double_1 t = new T_neg_double_1(); + assertEquals(Double.NaN, t.run(Double.NaN)); + } + + /** + * @title Argument = Double.NEGATIVE_INFINITY + */ + public void testB2() { + T_neg_double_1 t = new T_neg_double_1(); + assertEquals(Double.POSITIVE_INFINITY, t.run(Double.NEGATIVE_INFINITY)); + } + + /** + * @title Argument = Double.POSITIVE_INFINITY + */ + public void testB3() { + T_neg_double_1 t = new T_neg_double_1(); + assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.POSITIVE_INFINITY)); + } + + /** + * @title Argument = Double.MAX_VALUE + */ + public void testB4() { + T_neg_double_1 t = new T_neg_double_1(); + assertEquals(-1.7976931348623157E308d, t.run(Double.MAX_VALUE)); + } + + /** + * @title Argument = Double.MIN + */ + public void testB5() { + T_neg_double_1 t = new T_neg_double_1(); + assertEquals(-4.9E-324d, t.run(Double.MIN_VALUE)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_double/jm/T_neg_double_1.java b/jack-tests/tests/com/android/jack/opcodes/neg_double/jm/T_neg_double_1.java new file mode 100644 index 0000000..84768a1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_double/jm/T_neg_double_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.neg_double.jm; + +public class T_neg_double_1 { + + public double run(double d) { + return -d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_float/Test_neg_float.java b/jack-tests/tests/com/android/jack/opcodes/neg_float/Test_neg_float.java new file mode 100644 index 0000000..d6b3026 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_float/Test_neg_float.java @@ -0,0 +1,97 @@ +/* + * 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.jack.opcodes.neg_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.neg_float.jm.T_neg_float_1; + + +public class Test_neg_float extends DxTestCase { + + /** + * @title Argument = 1 + */ + public void testN1() { + T_neg_float_1 t = new T_neg_float_1(); + assertEquals(-1f, t.run(1f)); + } + + /** + * @title Argument = -1 + */ + public void testN2() { + T_neg_float_1 t = new T_neg_float_1(); + assertEquals(1f, t.run(-1f)); + } + + /** + * @title Argument = +0 + */ + public void testN3() { + T_neg_float_1 t = new T_neg_float_1(); + assertEquals(-0f, t.run(+0f)); + } + + /** + * @title Argument = -2.7 + */ + public void testN4() { + T_neg_float_1 t = new T_neg_float_1(); + assertEquals(2.7f, t.run(-2.7f)); + } + + /** + * @title Argument = Float.NaN + */ + public void testB1() { + T_neg_float_1 t = new T_neg_float_1(); + assertEquals(Float.NaN, t.run(Float.NaN)); + } + + /** + * @title Argument = Float.NEGATIVE_INFINITY + */ + public void testB2() { + T_neg_float_1 t = new T_neg_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(Float.NEGATIVE_INFINITY)); + } + + /** + * @title Argument = Float.POSITIVE_INFINITY + */ + public void testB3() { + T_neg_float_1 t = new T_neg_float_1(); + assertEquals(Float.NEGATIVE_INFINITY, t.run(Float.POSITIVE_INFINITY)); + } + + /** + * @title Argument = Float.MAX_VALUE + */ + public void testB4() { + T_neg_float_1 t = new T_neg_float_1(); + assertEquals(-3.4028235E38f, t.run(Float.MAX_VALUE)); + } + + /** + * @title Argument = Float.MIN + */ + public void testB5() { + T_neg_float_1 t = new T_neg_float_1(); + assertEquals(-1.4E-45f, t.run(Float.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_float/jm/T_neg_float_1.java b/jack-tests/tests/com/android/jack/opcodes/neg_float/jm/T_neg_float_1.java new file mode 100644 index 0000000..d653378 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_float/jm/T_neg_float_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.neg_float.jm; + +public class T_neg_float_1 { + + public float run(float d) { + return -d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_int/Test_neg_int.java b/jack-tests/tests/com/android/jack/opcodes/neg_int/Test_neg_int.java new file mode 100644 index 0000000..6f154ec --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_int/Test_neg_int.java @@ -0,0 +1,91 @@ +/* + * 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.jack.opcodes.neg_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.neg_int.jm.T_neg_int_1; +import com.android.jack.opcodes.neg_int.jm.T_neg_int_2; + + +public class Test_neg_int extends DxTestCase { + + /** + * @title Argument = 1 + */ + public void testN1() { + T_neg_int_1 t = new T_neg_int_1(); + assertEquals(-1, t.run(1)); + } + + /** + * @title Argument = -1 + */ + public void testN2() { + T_neg_int_1 t = new T_neg_int_1(); + assertEquals(1, t.run(-1)); + } + + /** + * @title Argument = 32768 + */ + public void testN3() { + T_neg_int_1 t = new T_neg_int_1(); + assertEquals(-32768, t.run(32768)); + } + + /** + * @title Argument = 0 + */ + public void testN4() { + T_neg_int_1 t = new T_neg_int_1(); + assertEquals(0, t.run(0)); + } + + /** + * @title Check that -x == (~x + 1) + */ + public void testN5() { + T_neg_int_2 t = new T_neg_int_2(); + assertTrue(t.run(12345)); + } + + /** + * @title Check that -x == (~x + 1) + */ + public void testN6() { + T_neg_int_2 t = new T_neg_int_2(); + assertTrue(t.run(12345)); + } + + + /** + * @title Argument = Integer.MAX_VALUE + */ + public void testB1() { + T_neg_int_1 t = new T_neg_int_1(); + assertEquals(0x80000001, t.run(Integer.MAX_VALUE)); + } + + /** + * @title Argument = Integer.MIN_VALUE + */ + public void testB2() { + T_neg_int_1 t = new T_neg_int_1(); + assertEquals(Integer.MIN_VALUE, t.run(Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_int/jm/T_neg_int_1.java b/jack-tests/tests/com/android/jack/opcodes/neg_int/jm/T_neg_int_1.java new file mode 100644 index 0000000..2858e1f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_int/jm/T_neg_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.neg_int.jm; + +public class T_neg_int_1 { + + public int run(int d) { + return -d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_int/jm/T_neg_int_2.java b/jack-tests/tests/com/android/jack/opcodes/neg_int/jm/T_neg_int_2.java new file mode 100644 index 0000000..c020c3e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_int/jm/T_neg_int_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.neg_int.jm; + +public class T_neg_int_2 { + + public boolean run(int d) { + return -d == (~d + 1); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_long/Test_neg_long.java b/jack-tests/tests/com/android/jack/opcodes/neg_long/Test_neg_long.java new file mode 100644 index 0000000..439c907 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_long/Test_neg_long.java @@ -0,0 +1,109 @@ +/* + * 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.jack.opcodes.neg_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.neg_long.jm.T_neg_long_1; +import com.android.jack.opcodes.neg_long.jm.T_neg_long_2; +import com.android.jack.opcodes.neg_long.jm.T_neg_long_4; +import com.android.jack.opcodes.neg_long.jm.T_neg_long_5; +import com.android.jack.opcodes.neg_long.jm.T_neg_long_6; + + +public class Test_neg_long extends DxTestCase { + + /** + * @title Argument = 123123123272432432l + */ + public void testN1() { + T_neg_long_1 t = new T_neg_long_1(); + assertEquals(-123123123272432432l, t.run(123123123272432432l)); + } + + /** + * @title Argument = 1 + */ + public void testN2() { + T_neg_long_1 t = new T_neg_long_1(); + assertEquals(-1l, t.run(1l)); + } + + /** + * @title Argument = -1 + */ + public void testN3() { + T_neg_long_1 t = new T_neg_long_1(); + assertEquals(1l, t.run(-1l)); + } + + /** + * @title Check that -x == (~x + 1) + */ + public void testN4() { + T_neg_long_2 t = new T_neg_long_2(); + assertTrue(t.run(123123123272432432l)); + } + + /** + * @title Argument = -1 + */ + public void testN5() { + T_neg_long_4 t = new T_neg_long_4(); + assertEquals(1l, t.run(-1l)); + } + + /** + * @title Argument = -1 + */ + public void testN6() { + T_neg_long_5 t = new T_neg_long_5(); + assertEquals(1l, t.run(-1)); + } + + /** + * @title Argument = -1 + */ + public void testN7() { + T_neg_long_6 t = new T_neg_long_6(); + assertEquals(1l, t.run(-1l)); + } + + /** + * @title Argument = 0 + */ + public void testB1() { + T_neg_long_1 t = new T_neg_long_1(); + assertEquals(0, t.run(0)); + } + + /** + * @title Argument = Long.MAX_VALUE + */ + public void testB2() { + T_neg_long_1 t = new T_neg_long_1(); + assertEquals(-9223372036854775807L, t.run(Long.MAX_VALUE)); + } + + /** + * @title Argument = Long.MIN_VALUE + */ + public void testB3() { + T_neg_long_1 t = new T_neg_long_1(); + assertEquals(-9223372036854775808L, t.run(Long.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_1.java b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_1.java new file mode 100644 index 0000000..f772a1e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.neg_long.jm; + +public class T_neg_long_1 { + + public long run(long d) { + return -d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_2.java b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_2.java new file mode 100644 index 0000000..e51ad7e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.neg_long.jm; + +public class T_neg_long_2 { + + public boolean run(long d) { + return -d == (~d + 1); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_4.java b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_4.java new file mode 100644 index 0000000..544e3be --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.neg_long.jm; + +public class T_neg_long_4 { + + public long run(double d) { + return (long)-d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_5.java b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_5.java new file mode 100644 index 0000000..ed53c24 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.neg_long.jm; + +public class T_neg_long_5 { + + public long run(int d) { + return -d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_6.java b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_6.java new file mode 100644 index 0000000..c10074c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.neg_long.jm; + +public class T_neg_long_6 { + + public long run(float d) { + return (long)-d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/new_array/Test_new_array.java b/jack-tests/tests/com/android/jack/opcodes/new_array/Test_new_array.java new file mode 100644 index 0000000..cbb1b6e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/new_array/Test_new_array.java @@ -0,0 +1,217 @@ +/* + * 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.jack.opcodes.new_array; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.new_array.jm.T_new_array_1; +import com.android.jack.opcodes.new_array.jm.T_new_array_2; +import com.android.jack.opcodes.new_array.jm.T_new_array_4; +import com.android.jack.opcodes.new_array.jm.T_new_array_5; +import com.android.jack.opcodes.new_array.jm.T_new_array_6; + + +public class Test_new_array extends DxTestCase { + + /** + * @title Test for Object + */ + public void testN1() { + T_new_array_1 t = new T_new_array_1(); + + Object[] arr = t.run(10); + assertNotNull(arr); + assertEquals(10, arr.length); + for (int i = 0; i < 10; i++) + assertNull(arr[i]); + } + + /** + * @title Test for String + */ + public void testN2() { + T_new_array_1 t = new T_new_array_1(); + + String[] arr2 = t.run2(5); + assertNotNull(arr2); + assertEquals(5, arr2.length); + for (int i = 0; i < 5; i++) + assertNull(arr2[i]); + } + + /** + * @title Test for Integer + */ + public void testN3() { + T_new_array_1 t = new T_new_array_1(); + + Integer[] arr3 = t.run3(15); + assertNotNull(arr3); + assertEquals(15, arr3.length); + for (int i = 0; i < 15; i++) + assertNull(arr3[i]); + } + + /** + * @title if count is zero, no subsequent dimensions allocated + */ + public void testE1() { + T_new_array_1 t = new T_new_array_1(); + Object[] res = t.run(0); + try { + Object s = res[0]; + fail("expected ArrayIndexOutOfBoundsException"); + } catch (ArrayIndexOutOfBoundsException ae) { + // expected + } + } + + /** + * @title expected NegativeArraySizeException + */ + public void testE2() { + T_new_array_1 t = new T_new_array_1(); + try { + t.run(-2); + fail("expected NegativeArraySizeException"); + } catch (NegativeArraySizeException nase) { + // expected + } + } + + /** + * @title normal test + */ + public void testN1MultiDim() { + T_new_array_2 t = new T_new_array_2(); + String[][][] res = t.run(2, 5, 4); + + assertEquals(2, res.length); + + // check default initialization + for (int i = 0; i < 2; i++) { + assertEquals(5, res[i].length); + + for (int j = 0; j < 5; j++) { + assertEquals(4, res[i][j].length); + + for (int k = 0; j < 4; j++) { + assertNull(res[i][j][k]); + } + } + } + } + + /** + * @title if count is zero, no subsequent dimensions allocated + */ + public void testN2MultiDim() { + T_new_array_2 t = new T_new_array_2(); + String[][][] res = t.run(2, 0, 4); + + try { + String s = res[2][0][0]; + fail("expected ArrayIndexOutOfBoundsException"); + fail("dummy for s "+s); + } catch (ArrayIndexOutOfBoundsException ae) { + // expected + } + } + + public void testN3MultiDim() { + T_new_array_4 t = new T_new_array_4(); + String[][][] res = t.run(2, 1, 4); + + if (res.length != 2) fail("incorrect multiarray length"); + if (res[0].length != 1) fail("incorrect array length"); + + try { + int i = res[0][0].length; + fail("expected NullPointerException"); + fail("dummy for i "+i); + } catch (NullPointerException npe) { + // expected + } + } + + /** + * @title expected NegativeArraySizeException + */ + public void testE1MultiDim() { + T_new_array_2 t = new T_new_array_2(); + try { + t.run(2, -5, 3); + fail("expected NegativeArraySizeException"); + } catch (NegativeArraySizeException nase) { + // expected + } + } + + /** + * @title Array of ints + */ + public void testN1Simple() { + T_new_array_5 t = new T_new_array_5(); + int[] r = t.run(10); + int l = r.length; + assertEquals(10, l); + + // check default initialization + for (int i = 0; i < l; i++) { + assertEquals(0, r[i]); + } + + } + + /** + * @title Array of floats + */ + public void testN2Simple() { + T_new_array_6 t = new T_new_array_6(); + float[] r = t.run(10); + int l = r.length; + assertEquals(10, l); + + // check default initialization + for (int i = 0; i < l; i++) { + assertEquals(0f, r[i]); + } + } + + /** + * @title expected NegativeArraySizeException + */ + public void testE1Simple() { + T_new_array_6 t = new T_new_array_6(); + try { + t.run(-1); + fail("expected NegativeArraySizeException"); + } catch (NegativeArraySizeException nase) { + // expected + } + } + + /** + * @title Array size = 0 + */ + public void testB1Simple() { + T_new_array_5 t = new T_new_array_5(); + int[] r = t.run(0); + assertNotNull(r); + assertEquals(0, r.length); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_1.java b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_1.java new file mode 100644 index 0000000..8027d03 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_1.java @@ -0,0 +1,32 @@ +/* + * 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.jack.opcodes.new_array.jm; + +public class T_new_array_1 { + + public Object[] run(int idx) { + return new Object[idx]; + } + + public String[] run2(int idx) { + return new String[idx]; + } + + public Integer[] run3(int idx) { + return new Integer[idx]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_2.java b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_2.java new file mode 100644 index 0000000..9da8b7c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.new_array.jm; + +public class T_new_array_2 { + + public String[][][] run(int d1, int d2, int d3) { + return new String[d1][d2][d3]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_3.java b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_3.java new file mode 100644 index 0000000..d06213c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.new_array.jm; + +public class T_new_array_3 { + + public String[][] run(int d1, int d2) { + return new String[d1][d2]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_4.java b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_4.java new file mode 100644 index 0000000..08c4512 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.new_array.jm; + +public class T_new_array_4 { + + public String[][][] run(int d1, int d2, int d3) { + return new String[d1][d2][]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_5.java b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_5.java new file mode 100644 index 0000000..b67adfb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.new_array.jm; + +public class T_new_array_5 { + + public int[] run(int sz) { + return new int[sz]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_6.java b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_6.java new file mode 100644 index 0000000..acc9c96 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/new_array/jm/T_new_array_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.new_array.jm; + +public class T_new_array_6 { + + public float[] run(int sz) { + return new float[sz]; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_const/Test_opc_const.java b/jack-tests/tests/com/android/jack/opcodes/opc_const/Test_opc_const.java new file mode 100644 index 0000000..c854924 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_const/Test_opc_const.java @@ -0,0 +1,46 @@ +/* + * 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.jack.opcodes.opc_const; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.opc_const.jm.T_opc_const_1; +import com.android.jack.opcodes.opc_const.jm.T_opc_const_2; + + +public class Test_opc_const extends DxTestCase { + + /** + * @title push float into stack + */ + public void testN1() { + T_opc_const_1 t = new T_opc_const_1(); + float a = 1.5f; + float b = 0.04f; + assertEquals(a + b, t.run(), 0f); + assertEquals(1.54f, t.run(), 0f); + } + + /** + * @title push int into stack + */ + public void testN2() { + T_opc_const_2 t = new T_opc_const_2(); + int a = 1000000000; + int b = 1000000000; + assertEquals(a + b, t.run()); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_const/jm/T_opc_const_1.java b/jack-tests/tests/com/android/jack/opcodes/opc_const/jm/T_opc_const_1.java new file mode 100644 index 0000000..857e8c5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_const/jm/T_opc_const_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_const.jm; + +public class T_opc_const_1 { + + public float run() { + return 1.54f; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_const/jm/T_opc_const_2.java b/jack-tests/tests/com/android/jack/opcodes/opc_const/jm/T_opc_const_2.java new file mode 100644 index 0000000..47f8b54 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_const/jm/T_opc_const_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_const.jm; + +public class T_opc_const_2 { + + public int run() { + return 2000000000; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_goto/Test_opc_goto.java b/jack-tests/tests/com/android/jack/opcodes/opc_goto/Test_opc_goto.java new file mode 100644 index 0000000..760b573 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_goto/Test_opc_goto.java @@ -0,0 +1,50 @@ +/* + * 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.jack.opcodes.opc_goto; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.opc_goto.jm.T_opc_goto_1; +import com.android.jack.opcodes.opc_goto.jm.T_opc_goto_5; + + +public class Test_opc_goto extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_opc_goto_1 t = new T_opc_goto_1(); + assertEquals(0, t.run(20)); + } + + /** + * @title normal test + */ + public void testN2() { + T_opc_goto_1 t = new T_opc_goto_1(); + assertEquals(-20, t.run(-20)); + } + + /** + * @title negative offset + */ + public void testN3() { + T_opc_goto_5 t = new T_opc_goto_5(); + assertTrue(t.run()); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_1.java b/jack-tests/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_1.java new file mode 100644 index 0000000..b9f2655 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_1.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.opc_goto.jm; + +public class T_opc_goto_1 { + + public int run(int a) { + while (a > 0) { + a--; + } + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_2.java b/jack-tests/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_2.java new file mode 100644 index 0000000..5af7c4d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_goto.jm; + +public class T_opc_goto_2 { + + public void run() { + String a = "a"; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_5.java b/jack-tests/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_5.java new file mode 100644 index 0000000..2f4b1b4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_goto.jm; + +public class T_opc_goto_5 { + + public boolean run() { + return true; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_instanceof/Test_opc_instanceof.java b/jack-tests/tests/com/android/jack/opcodes/opc_instanceof/Test_opc_instanceof.java new file mode 100644 index 0000000..cec5479 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_instanceof/Test_opc_instanceof.java @@ -0,0 +1,49 @@ +/* + * 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.jack.opcodes.opc_instanceof; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.opc_instanceof.jm.T_opc_instanceof_1; + + +public class Test_opc_instanceof extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_opc_instanceof_1 t = new T_opc_instanceof_1(); + assertTrue(t.run("")); + } + + /** + * @title check null value + */ + public void testN2() { + T_opc_instanceof_1 t = new T_opc_instanceof_1(); + assertFalse(t.run(null)); + } + + /** + * @title normal test + */ + public void testN3() { + T_opc_instanceof_1 t = new T_opc_instanceof_1(); + assertFalse(t.run(this)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_instanceof/jm/T_opc_instanceof_1.java b/jack-tests/tests/com/android/jack/opcodes/opc_instanceof/jm/T_opc_instanceof_1.java new file mode 100644 index 0000000..d429d84 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_instanceof/jm/T_opc_instanceof_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_instanceof.jm; + +public class T_opc_instanceof_1 { + + public boolean run(Object o) { + return (o instanceof String); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_instanceof/jm/TestStubs.java b/jack-tests/tests/com/android/jack/opcodes/opc_instanceof/jm/TestStubs.java new file mode 100644 index 0000000..9e2dd1b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_instanceof/jm/TestStubs.java @@ -0,0 +1,40 @@ +/* + * 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.jack.opcodes.opc_instanceof.jm; + +public class TestStubs { + @SuppressWarnings("unused") + private class TestStub { + // testE1 + } +} + +interface SuperInterface{ + +} + +interface SuperInterface2{ + +} + +class SuperClass implements SuperInterface{ + +} + +class SubClass extends SuperClass{ + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_new/Test_opc_new.java b/jack-tests/tests/com/android/jack/opcodes/opc_new/Test_opc_new.java new file mode 100644 index 0000000..caf11a0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_new/Test_opc_new.java @@ -0,0 +1,65 @@ +/* + * 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.jack.opcodes.opc_new; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.opc_new.jm.T_opc_new_1; +import com.android.jack.opcodes.opc_new.jm.T_opc_new_3; +import com.android.jack.opcodes.opc_new.jm.T_opc_new_9; + + +public class Test_opc_new extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_opc_new_1 t = new T_opc_new_1(); + String s = t.run(); + assertNotNull(s); + assertEquals(0, s.compareTo("abc")); + } + + /** + * @title expected Error (exception during class loading) + */ + public void testE1() { + try { + T_opc_new_3.run(); + fail("expected Error"); + } catch (Error e) { + // expected + } + } + + /** + * @constraint 4.8.1.18 + * @title attempt to instantiate abstract + * class + */ + public void testE5() { + // @uses com.android.jack.opcodes.opc_new.jm.TestAbstractClass + T_opc_new_9 t = new T_opc_new_9(); + try { + t.run(); + fail("expected Error"); + } catch (Error iae) { + // expected + } + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_1.java b/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_1.java new file mode 100644 index 0000000..880bb2a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_new.jm; + +public class T_opc_new_1 { + + public String run() { + return new String("abc"); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_3.java b/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_3.java new file mode 100644 index 0000000..767e93f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_3.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.opc_new.jm; + +public class T_opc_new_3 { + + static int i = 123 / 0; + + public static int run() { + T_opc_new_3 t = new T_opc_new_3(); + return t.i; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_9.java b/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_9.java new file mode 100644 index 0000000..6926f40 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_9.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_new.jm; + +public class T_opc_new_9 { + + public Object run() { + return new Object(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/TestStubs.java b/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/TestStubs.java new file mode 100644 index 0000000..acac4c6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_new/jm/TestStubs.java @@ -0,0 +1,35 @@ +/* + * 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.jack.opcodes.opc_new.jm; + + +interface TestInterface { + public abstract void test(); +} + +abstract class TestAbstractClass{ + +} + +public class TestStubs { + private static @SuppressWarnings("unused") class TestStub { + private TestStub() { + + } + // testE3 + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/Test_opc_return.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/Test_opc_return.java new file mode 100644 index 0000000..c24036c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/Test_opc_return.java @@ -0,0 +1,176 @@ +/* + * 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.jack.opcodes.opc_return; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_11; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_12; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_13; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_14; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_15; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_1; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_10; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_2; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_3; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_4; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_5; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_6; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_7; +import com.android.jack.opcodes.opc_return.jm.T_opc_return_8; + + +public class Test_opc_return extends DxTestCase { + + /** + * @title check that frames are discarded and reinstananted correctly + */ + public void testN1() { + T_opc_return_1 t = new T_opc_return_1(); + assertEquals(123456, t.run()); + } + + /** + * @title check that monitor is released by return + */ + public void testN2() { + assertTrue(T_opc_return_2.execute()); + } + + + public void testN3() { + T_opc_return_3 t = new T_opc_return_3(); + assertTrue(t.run()); + } + + /** + * @title Lock structural rule 1 is violated + */ + public void testE2() { + T_opc_return_4 t = new T_opc_return_4(); + try { + t.run(); + System.out.print("dvmvfe:"); + //fail("expected IllegalMonitorStateException"); + } catch (IllegalMonitorStateException imse) { + // expected + } + } + + /** + * @title simple + */ + public void testN1Float() { + T_opc_return_5 t = new T_opc_return_5(); + assertEquals(123456f, t.run()); + } + + /** + * @title check that frames are discarded and reinstananted correctly + */ + public void testN2Float() { + T_opc_return_7 t = new T_opc_return_7(); + assertEquals(123456f, t.run()); + } + + /** + * @title check that monitor is released by return + */ + public void testN3Float() { + assertTrue(T_opc_return_8.execute()); + } + + /** + * @title check that monitor is released by return + */ + public void testN4Float() { + T_opc_return_6 t = new T_opc_return_6(); + assertEquals(0f, t.run()); + } + +// /** +// * @title Method is synchronized but thread is not monitor owner +// */ +// public void testE1() { +// T_opc_return_9 t = new T_opc_return_9(); +// try { +// assertTrue(t.run()); +// fail("expected IllegalMonitorStateException"); +// } catch (IllegalMonitorStateException imse) { +// // expected +// } +// } + + /** + * @title Lock structural rule 1 is violated + */ + public void testE2Float() { + T_opc_return_10 t = new T_opc_return_10(); + try { + assertEquals(1f, t.run()); + System.out.print("dvmvfe:"); + //fail("expected IllegalMonitorStateException"); + } catch (IllegalMonitorStateException imse) { + // expected + } + } + + /** + * @title simple + */ + public void testN1Int() { + T_opc_return_11 t = new T_opc_return_11(); + assertEquals(123456, t.run()); + } + + /** + * @title check that frames are discarded and reinstananted correctly + */ + public void testN2Int() { + T_opc_return_12 t = new T_opc_return_12(); + assertEquals(123456, t.run()); + } + + /** + * @title check that monitor is released by return-int + */ + public void testN3Int() { + assertTrue(T_opc_return_13.execute()); + } + + /** + * @title Method is synchronized but thread is not monitor owner + */ + public void testE1Int() { + T_opc_return_14 t = new T_opc_return_14(); + assertTrue(t.run()); + } + + /** + * @title Lock structural rule 1 is violated + */ + public void testE2Int() { + T_opc_return_15 t = new T_opc_return_15(); + try { + assertEquals(1, t.run()); + System.out.print("dvmvfe:"); + //fail("expected IllegalMonitorStateException"); + } catch (IllegalMonitorStateException imse) { + // expected + } + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_1.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_1.java new file mode 100644 index 0000000..b24871c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_1.java @@ -0,0 +1,31 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_1 { + + public int run() { + return 123456; + } + + private static void test() { + int a = 0xaaaa; + int b = 0xbbbb; + int c = 0xcccc; + return; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_10.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_10.java new file mode 100644 index 0000000..a39d3bc --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_10.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_10 { + + public float run() { + return 1f; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_11.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_11.java new file mode 100644 index 0000000..c0e9231 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_11.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_11 { + + public int run() { + return 123456; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_12.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_12.java new file mode 100644 index 0000000..0681899 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_12.java @@ -0,0 +1,31 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_12 { + + public int run() { + return 123456; + } + + private static int test() { + int a = 0xaaaa; + int b = 0xbbbb; + int c = 0xcccc; + return 0xcafe; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_13.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_13.java new file mode 100644 index 0000000..cfb1135 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_13.java @@ -0,0 +1,60 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_13 implements Runnable { + public final static int CNT = 1000; + int value = 0; + boolean failed = false; + + public void run() { + for(int i = 0; i < CNT; i++) { + test(); + } + } + + private synchronized int test() { + value++; + int c = value; + Thread.yield(); + if(c != value) + failed = true; + return c; + } + + public static boolean execute() { + T_opc_return_13 test = new T_opc_return_13(); + Thread t1 = new Thread(test); + Thread t2 = new Thread(test); + + t1.start(); + t2.start(); + + try + { + Thread.sleep(5000); + } + catch(InterruptedException ie) { + return false; + } + + if(test.value != CNT * 2) + return false; + return !test.failed; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_14.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_14.java new file mode 100644 index 0000000..54b8f21 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_14.java @@ -0,0 +1,30 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_14 { + + private synchronized int test() { + return 0; + } + + public boolean run() { + test(); + return true; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_15.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_15.java new file mode 100644 index 0000000..84cb6e3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_15.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_15 { + + public int run() { + return 1; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_2.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_2.java new file mode 100644 index 0000000..c642e1f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_2.java @@ -0,0 +1,59 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_2 implements Runnable { + public final static int CNT = 1000; + int value = 0; + boolean failed = false; + + public void run() { + for(int i = 0; i < CNT; i++) { + test(); + } + } + + private synchronized void test() { + value++; + int c = value; + Thread.yield(); + if(c != value) + failed = true; + } + + public static boolean execute() { + T_opc_return_2 test = new T_opc_return_2(); + Thread t1 = new Thread(test); + Thread t2 = new Thread(test); + + t1.start(); + t2.start(); + + try + { + Thread.sleep(5000); + } + catch(InterruptedException ie) { + return false; + } + + if(test.value != CNT * 2) + return false; + return !test.failed; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_3.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_3.java new file mode 100644 index 0000000..e741701 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_3.java @@ -0,0 +1,30 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_3 { + + private synchronized void test() { + return; + } + + public boolean run() { + test(); + return true; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_4.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_4.java new file mode 100644 index 0000000..fc13cc4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_4.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_4 { + + public void run() { + return; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_5.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_5.java new file mode 100644 index 0000000..3888530 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_5 { + + public float run() { + return 123456f; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_6.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_6.java new file mode 100644 index 0000000..7b1a9ef --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_6.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_6 { + + public float run() { + return 0f; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_7.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_7.java new file mode 100644 index 0000000..524e577 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_7.java @@ -0,0 +1,31 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_7 { + + public float run() { + return 123456f; + } + + private static float test() { + float a = 1111f; + float b = 2222f; + float c = 3333f; + return 4444f; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_8.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_8.java new file mode 100644 index 0000000..e7ca3c6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_8.java @@ -0,0 +1,60 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_8 implements Runnable { + public final static int CNT = 1000; + float value = 0; + boolean failed = false; + + public void run() { + for(int i = 0; i < CNT; i++) { + test(); + } + } + + private synchronized float test() { + value++; + float c = value; + Thread.yield(); + if(c != value) + failed = true; + return c; + } + + public static boolean execute() { + T_opc_return_8 test = new T_opc_return_8(); + Thread t1 = new Thread(test); + Thread t2 = new Thread(test); + + t1.start(); + t2.start(); + + try + { + Thread.sleep(5000); + } + catch(InterruptedException ie) { + return false; + } + + if(test.value != CNT * 2) + return false; + return !test.failed; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_9.java b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_9.java new file mode 100644 index 0000000..9852909 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_9.java @@ -0,0 +1,30 @@ +/* + * 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.jack.opcodes.opc_return.jm; + +public class T_opc_return_9 { + + private synchronized float test() { + return 0f; + } + + public boolean run() { + test(); + return true; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_throw/Test_opc_throw.java b/jack-tests/tests/com/android/jack/opcodes/opc_throw/Test_opc_throw.java new file mode 100644 index 0000000..c318a69 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_throw/Test_opc_throw.java @@ -0,0 +1,75 @@ +/* + * 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.jack.opcodes.opc_throw; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.opc_throw.jm.T_opc_throw_1; +import com.android.jack.opcodes.opc_throw.jm.T_opc_throw_12; +import com.android.jack.opcodes.opc_throw.jm.T_opc_throw_2; +import com.android.jack.opcodes.opc_throw.jm.T_opc_throw_8; + + +public class Test_opc_throw extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_opc_throw_1 t = new T_opc_throw_1(); + try { + t.run(); + fail("must throw a RuntimeException"); + } catch (RuntimeException re) { + // expected + } + } + + /** + * @title Throwing of the objectref on the class Throwable + */ + public void testN2() { + T_opc_throw_2 t = new T_opc_throw_2(); + try { + t.run(); + fail("must throw a Throwable"); + } catch (Throwable e) { + // expected + } + } + + /** + * @title Throwing of the objectref on the subclass of Throwable + */ + public void testN3() { + T_opc_throw_8 t = new T_opc_throw_8(); + try { + t.run(); + fail("must throw a Error"); + } catch (Error e) { + // expected + } + } + + /** + * @title Nearest matching catch must be executed in case of exception + */ + public void testN4() { + T_opc_throw_12 t = new T_opc_throw_12(); + assertTrue(t.run()); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_1.java b/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_1.java new file mode 100644 index 0000000..99d7751 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_throw.jm; + +public class T_opc_throw_1 { + + public void run() { + throw new RuntimeException(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_12.java b/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_12.java new file mode 100644 index 0000000..eb56644 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_12.java @@ -0,0 +1,33 @@ +/* + * 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.jack.opcodes.opc_throw.jm; + +public class T_opc_throw_12 { + + public boolean run() { + try{ + try { + throw new RuntimeException(); + }catch(RuntimeException e1) { + return true; + } + } catch(RuntimeException e2) { + } + return false; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_2.java b/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_2.java new file mode 100644 index 0000000..e722c7f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_throw.jm; + +public class T_opc_throw_2 { + + public void run() throws Throwable { + throw new Throwable(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_8.java b/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_8.java new file mode 100644 index 0000000..1744aa4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_8.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.opc_throw.jm; + +public class T_opc_throw_8 { + + public void run() throws Error { + throw new Error(); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/or_int/Test_or_int.java b/jack-tests/tests/com/android/jack/opcodes/or_int/Test_or_int.java new file mode 100644 index 0000000..3f2079b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/or_int/Test_or_int.java @@ -0,0 +1,83 @@ +/* + * 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.jack.opcodes.or_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.or_int.jm.T_or_int_1; +import com.android.jack.opcodes.or_int.jm.T_or_int_3; +import com.android.jack.opcodes.or_int.jm.T_or_int_4; + + +public class Test_or_int extends DxTestCase { + + /** + * @title Arguments = 15, 8 + */ + public void testN1() { + T_or_int_1 t = new T_or_int_1(); + assertEquals(15, t.run(15, 8)); + } + + /** + * @title Arguments = 0xfffffff8, 0xfffffff1 + */ + public void testN2() { + T_or_int_1 t = new T_or_int_1(); + assertEquals(0xfffffff9, t.run(0xfffffff8, 0xfffffff1)); + } + + /** + * @title Arguments = 0xcafe & -1 + */ + public void testN3() { + T_or_int_1 t = new T_or_int_1(); + assertEquals(-1, t.run(0xcafe, -1)); + } + + /** + * @title Arguments = 0xcafe & -1 + */ + public void testN4() { + T_or_int_3 t = new T_or_int_3(); + assertEquals(-1, t.run(0xcafe, -1)); + } + + /** + * @title Arguments = 0xcafe & -1 + */ + public void testN5() { + T_or_int_4 t = new T_or_int_4(); + assertEquals(-1, t.run(0xcafe, -1)); + } + + /** + * @title Arguments = 0 & -1 + */ + public void testB1() { + T_or_int_1 t = new T_or_int_1(); + assertEquals(-1, t.run(0, -1)); + } + + /** + * @title Arguments = Integer.MAX_VALUE & Integer.MIN_VALUE + */ + public void testB2() { + T_or_int_1 t = new T_or_int_1(); + assertEquals(0xffffffff, t.run(Integer.MAX_VALUE, Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/or_int/jm/T_or_int_1.java b/jack-tests/tests/com/android/jack/opcodes/or_int/jm/T_or_int_1.java new file mode 100644 index 0000000..da6e1cc --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/or_int/jm/T_or_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.or_int.jm; + +public class T_or_int_1 { + + public int run(int a, int b) { + return a | b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/or_int/jm/T_or_int_3.java b/jack-tests/tests/com/android/jack/opcodes/or_int/jm/T_or_int_3.java new file mode 100644 index 0000000..5902141 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/or_int/jm/T_or_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.or_int.jm; + +public class T_or_int_3 { + + public int run(double a, int b) { + return (int)a | b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/or_int/jm/T_or_int_4.java b/jack-tests/tests/com/android/jack/opcodes/or_int/jm/T_or_int_4.java new file mode 100644 index 0000000..bca1fbf --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/or_int/jm/T_or_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.or_int.jm; + +public class T_or_int_4 { + + public int run(int a, long b) { + return a | (int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/or_long/Test_or_long.java b/jack-tests/tests/com/android/jack/opcodes/or_long/Test_or_long.java new file mode 100644 index 0000000..e3cab36 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/or_long/Test_or_long.java @@ -0,0 +1,95 @@ +/* + * 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.jack.opcodes.or_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.or_long.jm.T_or_long_1; +import com.android.jack.opcodes.or_long.jm.T_or_long_3; +import com.android.jack.opcodes.or_long.jm.T_or_long_4; +import com.android.jack.opcodes.or_long.jm.T_or_long_5; + + +public class Test_or_long extends DxTestCase { + + /** + * @title Arguments = 123456789121l, 2l + */ + public void testN1() { + T_or_long_1 t = new T_or_long_1(); + assertEquals(123456789123l, t.run(123456789121l, 2l)); + } + + /** + * @title Arguments = 0xffffffffffffff8l, 0xffffffffffffff1l + */ + public void testN2() { + T_or_long_1 t = new T_or_long_1(); + assertEquals(0xffffffffffffff9l, t.run(0xffffffffffffff8l, + 0xffffffffffffff1l)); + } + + /** + * @title Arguments = 0xabcdefabcdef, -1 + */ + public void testN3() { + T_or_long_1 t = new T_or_long_1(); + assertEquals(-1l, t.run(0xabcdefabcdefl, -1l)); + } + + /** + * @title Arguments = 0xabcdefabcdef, -1 + */ + public void testN4() { + T_or_long_3 t = new T_or_long_3(); + assertEquals(-1l, t.run(0xabcdefabcdefl, -1l)); + } + + + /** + * @title Arguments = 0xabcdefabcdef, -1 + */ + public void testN5() { + T_or_long_4 t = new T_or_long_4(); + assertEquals(-1l, t.run(0xabcdefa, -1l)); + } + + + /** + * @title Arguments = 0xabcdefabcdef, -1 + */ + public void testN6() { + T_or_long_5 t = new T_or_long_5(); + assertEquals(-1l, t.run(0xabcdefabcdefl, -1l)); + } + + + /** + * @title Arguments = 0, -1 + */ + public void testB1() { + T_or_long_1 t = new T_or_long_1(); + assertEquals(-1l, t.run(0l, -1l)); + } + + /** + * @title Arguments = Long.MAX_VALUE, Long.MIN_VALUE + */ + public void testB2() { + T_or_long_1 t = new T_or_long_1(); + assertEquals(-1l, t.run(Long.MAX_VALUE, Long.MIN_VALUE)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_1.java b/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_1.java new file mode 100644 index 0000000..4d42746 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.or_long.jm; + +public class T_or_long_1 { + + public long run(long a, long b) { + return a | b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_3.java b/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_3.java new file mode 100644 index 0000000..ff8fa1f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.or_long.jm; + +public class T_or_long_3 { + + public long run(double a, long b) { + return (long)a | b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_4.java b/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_4.java new file mode 100644 index 0000000..ba8311b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.or_long.jm; + +public class T_or_long_4 { + + public long run(int a, long b) { + return a | b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_5.java b/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_5.java new file mode 100644 index 0000000..cd2517f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/or_long/jm/T_or_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.or_long.jm; + +public class T_or_long_5 { + + public long run(float a, long b) { + return (long)a | b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/packed_switch/Test_packed_switch.java b/jack-tests/tests/com/android/jack/opcodes/packed_switch/Test_packed_switch.java new file mode 100644 index 0000000..67a0532 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/packed_switch/Test_packed_switch.java @@ -0,0 +1,57 @@ +/* + * 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.jack.opcodes.packed_switch; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.packed_switch.jm.T_packed_switch_1; + + +public class Test_packed_switch extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_packed_switch_1 t = new T_packed_switch_1(); + assertEquals(2, t.run(-1)); + + assertEquals(-1, t.run(4)); + assertEquals(20, t.run(2)); + assertEquals(-1, t.run(5)); + + assertEquals(-1, t.run(6)); + assertEquals(20, t.run(3)); + assertEquals(-1, t.run(7)); + } + + /** + * @title check Integer.MAX_VALUE + */ + public void testB1() { + T_packed_switch_1 t = new T_packed_switch_1(); + assertEquals(-1, t.run(Integer.MAX_VALUE)); + } + + /** + * @title check Integer.MIN_VALUE + */ + public void testB2() { + T_packed_switch_1 t = new T_packed_switch_1(); + assertEquals(-1, t.run(Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/packed_switch/jm/T_packed_switch_1.java b/jack-tests/tests/com/android/jack/opcodes/packed_switch/jm/T_packed_switch_1.java new file mode 100644 index 0000000..a6b091b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/packed_switch/jm/T_packed_switch_1.java @@ -0,0 +1,32 @@ +/* + * 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.jack.opcodes.packed_switch.jm; + +public class T_packed_switch_1 { + + public int run(int i) { + switch (i) { + case -1: + return 2; + case 2: + case 3: + return 20; + default: + return -1; + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_double/Test_rem_double.java b/jack-tests/tests/com/android/jack/opcodes/rem_double/Test_rem_double.java new file mode 100644 index 0000000..a72a343 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_double/Test_rem_double.java @@ -0,0 +1,141 @@ +/* + * 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.jack.opcodes.rem_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.rem_double.jm.T_rem_double_1; +import com.android.jack.opcodes.rem_double.jm.T_rem_double_3; +import com.android.jack.opcodes.rem_double.jm.T_rem_double_4; + + +public class Test_rem_double extends DxTestCase { + + /** + * @title Arguments = 2.7d, 3.14d + */ + public void testN1() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(2.7d, t.run(2.7d, 3.14d)); + } + + /** + * @title Dividend = 0 + */ + public void testN2() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(0d, t.run(0, 3.14d)); + } + + /** + * @title Dividend is negative + */ + public void testN3() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(-0.43999999999999995d, t.run(-3.14d, 2.7d)); + } + + /** + * @title Dividend is negative + */ + public void testN4() { + T_rem_double_3 t = new T_rem_double_3(); + assertEquals(-0.4399999523162843d, t.run(-3.14d, 2.7f)); + } + + /** + * @title Dividend is negative + */ + public void testN5() { + T_rem_double_4 t = new T_rem_double_4(); + assertEquals(-0.7999999999999794d, t.run(-314l, 2.7d)); + } + + /** + * @title Arguments = Double.MAX_VALUE, Double.NaN + */ + public void testB1() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(Double.NaN, t.run(Double.MAX_VALUE, Double.NaN)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, + * Double.NEGATIVE_INFINITY + */ + public void testB2() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(Double.NaN, t.run(Double.POSITIVE_INFINITY, + Double.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, -2.7d + */ + public void testB3() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(Double.NaN, t.run(Double.POSITIVE_INFINITY, -2.7d)); + } + + /** + * @title Arguments = -2.7d, Double.NEGATIVE_INFINITY + */ + public void testB4() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(-2.7d, t.run(-2.7d, Double.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(Double.NaN, t.run(0, 0)); + } + + /** + * @title Arguments = 0, -2.7 + */ + public void testB6() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(0d, t.run(0, -2.7d)); + } + + /** + * @title Arguments = -2.7, 0 + */ + public void testB7() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(Double.NaN, t.run(-2.7d, 0)); + } + + /** + * @title Arguments = 1, Double.MAX_VALUE + */ + public void testB8() { + T_rem_double_1 t = new T_rem_double_1(); + assertEquals(0d, t.run(1, Double.MIN_VALUE)); + } + + /** + * @title Arguments = Double.MAX_VALUE, -1E-9d + */ + public void testB9() { + T_rem_double_1 t = new T_rem_double_1(); + + assertEquals(1.543905285031139E-10d, t.run(Double.MAX_VALUE, -1E-9d)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_1.java b/jack-tests/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_1.java new file mode 100644 index 0000000..84d2e91 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_double.jm; + +public class T_rem_double_1 { + + public double run(double a, double b) { + return a%b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_3.java b/jack-tests/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_3.java new file mode 100644 index 0000000..fecf035 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_double.jm; + +public class T_rem_double_3 { + + public double run(double a, float b) { + return a%(double)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_4.java b/jack-tests/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_4.java new file mode 100644 index 0000000..b7e1e33 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_double.jm; + +public class T_rem_double_4 { + + public double run(long a, double b) { + return (double)a%b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_float/Test_rem_float.java b/jack-tests/tests/com/android/jack/opcodes/rem_float/Test_rem_float.java new file mode 100644 index 0000000..409a9e8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_float/Test_rem_float.java @@ -0,0 +1,141 @@ +/* + * 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.jack.opcodes.rem_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.rem_float.jm.T_rem_float_1; +import com.android.jack.opcodes.rem_float.jm.T_rem_float_3; +import com.android.jack.opcodes.rem_float.jm.T_rem_float_4; + + +public class Test_rem_float extends DxTestCase { + + /** + * @title Arguments = 2.7f, 3.14f + */ + public void testN1() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(2.7f, t.run(2.7f, 3.14f)); + } + + /** + * @title Dividend = 0 + */ + public void testN2() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(0f, t.run(0, 3.14f)); + } + + /** + * @title Dividend is negative + */ + public void testN3() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(-0.44000006f, t.run(-3.14f, 2.7f)); + } + + /** + * @title Dividend is negative + */ + public void testN4() { + T_rem_float_3 t = new T_rem_float_3(); + assertEquals(-0.44000006f, t.run(-3.14f, 2.7f)); + } + + /** + * @title Dividend is negative + */ + public void testN5() { + T_rem_float_4 t = new T_rem_float_4(); + assertEquals(-0.79999447f, t.run(-314l, 2.7f)); + } + + /** + * @title Arguments = Float.MAX_VALUE, Float.NaN + */ + public void testB1() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(Float.NaN, t.run(Float.MAX_VALUE, Float.NaN)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, + * Float.NEGATIVE_INFINITY + */ + public void testB2() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(Float.NaN, t.run(Float.POSITIVE_INFINITY, + Float.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, -2.7f + */ + public void testB3() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(Float.NaN, t.run(Float.POSITIVE_INFINITY, -2.7f)); + } + + /** + * @title Arguments = -2.7f, Float.NEGATIVE_INFINITY + */ + public void testB4() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(-2.7f, t.run(-2.7f, Float.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(Float.NaN, t.run(0, 0)); + } + + /** + * @title Arguments = 0, -2.7 + */ + public void testB6() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(0f, t.run(0, -2.7f)); + } + + /** + * @title Arguments = -2.7, 0 + */ + public void testB7() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(Float.NaN, t.run(-2.7f, 0)); + } + + /** + * @title Arguments = 1, Float.MAX_VALUE + */ + public void testB8() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(0f, t.run(1, Float.MIN_VALUE)); + } + + /** + * @title Arguments = Float.MAX_VALUE, -1E-9f + */ + public void testB9() { + T_rem_float_1 t = new T_rem_float_1(); + assertEquals(7.2584893E-10f, t.run(Float.MAX_VALUE, -1E-9f)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_1.java b/jack-tests/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_1.java new file mode 100644 index 0000000..dccf75d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_float.jm; + +public class T_rem_float_1 { + + public float run(float a, float b) { + return a%b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_3.java b/jack-tests/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_3.java new file mode 100644 index 0000000..f55af8a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_float.jm; + +public class T_rem_float_3 { + + public float run(float a, double b) { + return a%(float)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_4.java b/jack-tests/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_4.java new file mode 100644 index 0000000..7369c3d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_float.jm; + +public class T_rem_float_4 { + + public float run(long a, float b) { + return (float)a%b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_int/Test_rem_int.java b/jack-tests/tests/com/android/jack/opcodes/rem_int/Test_rem_int.java new file mode 100644 index 0000000..3c699a9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_int/Test_rem_int.java @@ -0,0 +1,153 @@ +/* + * 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.jack.opcodes.rem_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.rem_int.jm.T_rem_int_1; +import com.android.jack.opcodes.rem_int.jm.T_rem_int_3; +import com.android.jack.opcodes.rem_int.jm.T_rem_int_4; + + +public class Test_rem_int extends DxTestCase { + + /** + * @title Arguments = 8, 4 + */ + public void testN1() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(0, t.run(8, 4)); + } + + /** + * @title Arguments = 1073741823, 4 + */ + public void testN2() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(3, t.run(1073741823, 4)); + } + + /** + * @title Dividend = 0 + */ + public void testN3() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(0, t.run(0, 4)); + } + + /** + * @title Dividend is negative + */ + public void testN4() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(-1, t.run(-10, 3)); + } + + /** + * @title Divisor is negative + */ + public void testN5() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(1, t.run(1073741824, -3)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN6() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(-697, t.run(-17895697, -3000)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN7() { + T_rem_int_3 t = new T_rem_int_3(); + assertEquals(-697, t.run(-17895697, -3000)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN8() { + T_rem_int_4 t = new T_rem_int_4(); + assertEquals(-697, t.run(-17895697, -3000)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, -1 + */ + public void testB1() { + T_rem_int_1 t = new T_rem_int_1(); + // result is MIN_VALUE because overflow occurs in this case + assertEquals(0, t.run(Integer.MIN_VALUE, -1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, 1 + */ + public void testB2() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(0, t.run(Integer.MIN_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, 1 + */ + public void testB3() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(0, t.run(Integer.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, Integer.MAX_VALUE + */ + public void testB4() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(-1, t.run(Integer.MIN_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = 1, Integer.MAX_VALUE + */ + public void testB5() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(1, t.run(1, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = 1, Integer.MIN_VALUE + */ + public void testB6() { + T_rem_int_1 t = new T_rem_int_1(); + assertEquals(1, t.run(1, Integer.MIN_VALUE)); + } + + /** + * @title Divisor is 0 + */ + public void testE1() { + T_rem_int_1 t = new T_rem_int_1(); + try { + t.run(1, 0); + fail("expected ArithmeticException"); + } catch (ArithmeticException ae) { + // expected + } + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_1.java b/jack-tests/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_1.java new file mode 100644 index 0000000..5367c8a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_int.jm; + +public class T_rem_int_1 { + + public int run(int a, int b) { + return a%b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_3.java b/jack-tests/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_3.java new file mode 100644 index 0000000..23f7c60 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_int.jm; + +public class T_rem_int_3 { + + public int run(int a, double b) { + return a%(int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_4.java b/jack-tests/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_4.java new file mode 100644 index 0000000..3e7b6e2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_int.jm; + +public class T_rem_int_4 { + + public int run(long a, int b) { + return (int)a%b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_long/Test_rem_long.java b/jack-tests/tests/com/android/jack/opcodes/rem_long/Test_rem_long.java new file mode 100644 index 0000000..955b5fa --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_long/Test_rem_long.java @@ -0,0 +1,155 @@ +/* + * 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.jack.opcodes.rem_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.rem_long.jm.T_rem_long_1; +import com.android.jack.opcodes.rem_long.jm.T_rem_long_3; +import com.android.jack.opcodes.rem_long.jm.T_rem_long_4; +import com.android.jack.opcodes.rem_long.jm.T_rem_long_5; + + +public class Test_rem_long extends DxTestCase { + + /** + * @title Arguments = 10000000000l, 4000000000l + */ + public void testN1() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(2000000000l, t.run(10000000000l, 4000000000l)); + } + + /** + * @title Arguments = 1234567890123l, 123456789l + */ + public void testN2() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(123l, t.run(1234567890123l, 123456789l)); + } + + /** + * @title Dividend = 0 + */ + public void testN3() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(0l, t.run(0l, 1234567890123l)); + } + + /** + * @title Dividend is negative + */ + public void testN4() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(-2000000000l, t.run(-10000000000l, 4000000000l)); + } + + /** + * @title Divisor is negative + */ + public void testN5() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(2000000000l, t.run(10000000000l, -4000000000l)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN6() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(-2000000000l, t.run(-10000000000l, -4000000000l)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN7() { + T_rem_long_3 t = new T_rem_long_3(); + assertEquals(-2000000000l, t.run(-10000000000l, -4000000000l)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN8() { + T_rem_long_4 t = new T_rem_long_4(); + assertEquals(-1000, t.run(-1000, -4000000000l)); + } + + /** + * @title Both Dividend and divisor are negative + */ + public void testN9() { + T_rem_long_5 t = new T_rem_long_5(); + assertEquals(-2000000000l, t.run(-10000000000l, -4000000000l)); + } + + /** + * @title Arguments = Long.MIN_VALUE, -1l + */ + public void testB1() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(0l, t.run(Long.MIN_VALUE, -1l)); + } + /** + * @title Arguments = Long.MIN_VALUE, 1l + */ + public void testB2() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(0l, t.run(Long.MIN_VALUE, 1l)); + } + /** + * @title Arguments = Long.MAX_VALUE, 1l + */ + public void testB3() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(0l, t.run(Long.MAX_VALUE, 1l)); + } + /** + * @title Arguments = Long.MIN_VALUE, Long.MAX_VALUE + */ + public void testB4() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(-1l, t.run(Long.MIN_VALUE, Long.MAX_VALUE)); + } + /** + * @title Arguments = 1l, Long.MAX_VALUE + */ + public void testB5() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(1l, t.run(1l, Long.MAX_VALUE)); + } + /** + * @title Arguments = 1l, Long.MIN_VALUE + */ + public void testB6() { + T_rem_long_1 t = new T_rem_long_1(); + assertEquals(1l, t.run(1l, Long.MIN_VALUE)); + } + + /** + * @title Divisor is 0 + */ + public void testE1() { + T_rem_long_1 t = new T_rem_long_1(); + try { + t.run(1234567890123l, 0l); + fail("expected ArithmeticException"); + } catch (ArithmeticException ae) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_1.java b/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_1.java new file mode 100644 index 0000000..56028a2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_long.jm; + +public class T_rem_long_1 { + + public long run(long a, long b) { + return a % b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_3.java b/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_3.java new file mode 100644 index 0000000..46d2444 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_long.jm; + +public class T_rem_long_3 { + + public long run(long a, double b) { + return (long) (a % b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_4.java b/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_4.java new file mode 100644 index 0000000..c43cb0e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_long.jm; + +public class T_rem_long_4 { + + public long run(int a, long b) { + return a % b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_5.java b/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_5.java new file mode 100644 index 0000000..2953e83 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.rem_long.jm; + +public class T_rem_long_5 { + + public long run(long a, float b) { + return (long) (a % b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/Runner.java b/jack-tests/tests/com/android/jack/opcodes/return_object/Runner.java new file mode 100644 index 0000000..81dcc1b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/Runner.java @@ -0,0 +1,21 @@ +/* + * 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.jack.opcodes.return_object; + +public interface Runner { + public void doit(); +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/RunnerGenerator.java b/jack-tests/tests/com/android/jack/opcodes/return_object/RunnerGenerator.java new file mode 100644 index 0000000..cd17a53 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/RunnerGenerator.java @@ -0,0 +1,21 @@ +/* + * 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.jack.opcodes.return_object; + +public interface RunnerGenerator { + public Runner run(); +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/Test_return_object.java b/jack-tests/tests/com/android/jack/opcodes/return_object/Test_return_object.java new file mode 100644 index 0000000..9ed11ce --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/Test_return_object.java @@ -0,0 +1,139 @@ +/* + * 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.jack.opcodes.return_object; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.return_object.jm.T_return_object_1; +import com.android.jack.opcodes.return_object.jm.T_return_object_12; +import com.android.jack.opcodes.return_object.jm.T_return_object_13; +import com.android.jack.opcodes.return_object.jm.T_return_object_2; +import com.android.jack.opcodes.return_object.jm.T_return_object_6; +import com.android.jack.opcodes.return_object.jm.T_return_object_7; +import com.android.jack.opcodes.return_object.jm.T_return_object_9; + + +public class Test_return_object extends DxTestCase { + + /** + * @title simple + */ + public void testN1() { + T_return_object_1 t = new T_return_object_1(); + assertEquals("hello", t.run()); + } + + /** + * @title simple + */ + public void testN2() { + T_return_object_1 t = new T_return_object_1(); + assertEquals(t, t.run2()); + } + + /** + * @title simple + */ + public void testN3() { + T_return_object_1 t = new T_return_object_1(); + Integer a = 12345; + assertEquals(a, t.run3()); + } + + /** + * @title test for null + */ + public void testN4() { + T_return_object_2 t = new T_return_object_2(); + assertNull(t.run()); + } + + /** + * @title check that frames are discarded and reinstananted correctly + */ + public void testN5() { + T_return_object_6 t = new T_return_object_6(); + assertEquals("hello", t.run()); + } + + /** + * @title check that monitor is released by return_object + */ + public void testN6() { + assertTrue(T_return_object_7.execute()); + } + + /** + * @title assignment compatibility (TChild returned as TSuper) + */ + public void testN7() { + // @uses com.android.jack.opcodes.return_object.jm.TSuper + // @uses com.android.jack.opcodes.return_object.jm.TInterface + // @uses com.android.jack.opcodes.return_object.jm.TChild + T_return_object_12 t = new T_return_object_12(); + assertTrue(t.run()); + } + + /** + * @title assignment compatibility (TChild returned as TInterface) + */ + public void testN8() { + // @uses com.android.jack.opcodes.return_object.jm.TInterface + // @uses com.android.jack.opcodes.return_object.jm.TChild + // @uses com.android.jack.opcodes.return_object.jm.TSuper + T_return_object_13 t = new T_return_object_13(); + assertTrue(t.run()); + } + + /** + * @title Lock structural rule 1 is violated + */ + public void testE2() { + T_return_object_9 t = new T_return_object_9(); + try { + assertEquals("abc", t.run()); + System.out.print("dvmvfe:"); + //fail("expected IllegalMonitorStateException"); + } catch (IllegalMonitorStateException imse) { + // expected + } + } + + /** + * @constraint 4.8.2.14 + * @title assignment incompatible references + */ + @SuppressWarnings("cast") + public void testVFE7() { + // @uses com.android.jack.opcodes.return_object.jm.TSuper2 + // @uses com.android.jack.opcodes.return_object.Runner + // @uses com.android.jack.opcodes.return_object.RunnerGenerator + try { + RunnerGenerator rg = (RunnerGenerator) Class.forName( + "com.android.jack.opcodes.return_object.jm.T_return_object_15").newInstance(); + Runner r = rg.run(); + assertFalse(r instanceof Runner); + assertFalse(Runner.class.isAssignableFrom(r.getClass())); + // only upon invocation of a concrete method, + // a java.lang.IncompatibleClassChangeError is thrown + r.doit(); +// fail("expected a verification exception"); + } catch (Throwable t) { +// DxUtil.checkVerifyException(t); + } + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_1.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_1.java new file mode 100644 index 0000000..2539675 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_1.java @@ -0,0 +1,33 @@ +/* + * 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.jack.opcodes.return_object.jm; + +public class T_return_object_1 { + + public String run() { + return "hello"; + } + + public Object run2() { + return this; + } + + public Integer run3() { + Integer value = new Integer(12345); + return value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_12.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_12.java new file mode 100644 index 0000000..e154bcd --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_12.java @@ -0,0 +1,29 @@ +/* + * 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.jack.opcodes.return_object.jm; + +public class T_return_object_12 { + + private TSuper test() { + return new TChild(); + } + + public boolean run() { + TSuper t = test(); + return (t instanceof TChild); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_13.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_13.java new file mode 100644 index 0000000..6a97d1f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_13.java @@ -0,0 +1,30 @@ +/* + * 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.jack.opcodes.return_object.jm; + + +public class T_return_object_13 { + + private TInterface test() { + return new TChild(); + } + + public boolean run() { + TInterface t = test(); + return (t instanceof TChild); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_15.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_15.java new file mode 100644 index 0000000..dff40a2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_15.java @@ -0,0 +1,31 @@ +/* + * 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.jack.opcodes.return_object.jm; + + +public class T_return_object_15 { + + private TInterface test() { + //return new TSuper2(); + return new TSuper(); + } + + public boolean run() { + TInterface t = test(); + return (t instanceof TSuper); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_2.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_2.java new file mode 100644 index 0000000..c509f43 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.return_object.jm; + +public class T_return_object_2 { + + public Object run() { + return null; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_3.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_3.java new file mode 100644 index 0000000..e15f65b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.return_object.jm; + +public class T_return_object_3 { + + public String run() { + return "hello"; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_6.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_6.java new file mode 100644 index 0000000..5bbd3fa --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_6.java @@ -0,0 +1,31 @@ +/* + * 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.jack.opcodes.return_object.jm; + +public class T_return_object_6 { + + public String run() { + return "hello"; + } + + private static String test() { + String a = "aaa"; + String b = "bbb"; + String c = "ccc"; + return "ddd"; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_7.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_7.java new file mode 100644 index 0000000..ed7d4b8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_7.java @@ -0,0 +1,62 @@ +/* + * 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.jack.opcodes.return_object.jm; + +import com.android.jack.opcodes.return_object.jm.T_return_object_7; + +public class T_return_object_7 implements Runnable { + public final static int CNT = 1000; + Integer value = new Integer(0); + boolean failed = false; + + public void run() { + for(int i = 0; i < CNT; i++) { + test(); + } + } + + private synchronized Integer test() { + Integer c = new Integer(value.intValue() + 1); + + value = c; + Thread.yield(); + if(c != value) + failed = true; + return c; + } + + public static boolean execute() { + T_return_object_7 test = new T_return_object_7(); + Thread t1 = new Thread(test); + Thread t2 = new Thread(test); + + t1.start(); + t2.start(); + + try + { + Thread.sleep(5000); + } + catch(InterruptedException ie) { + return false; + } + + if(test.value.intValue() != CNT * 2) + return false; + return !test.failed; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_9.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_9.java new file mode 100644 index 0000000..ee69b10 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/T_return_object_9.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.return_object.jm; + +public class T_return_object_9 { + + public String run() { + return "abc"; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_object/jm/TetsStubs.java b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/TetsStubs.java new file mode 100644 index 0000000..171b57f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_object/jm/TetsStubs.java @@ -0,0 +1,34 @@ +/* + * 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.jack.opcodes.return_object.jm; + + +interface TInterface{ + +} + +class TSuper implements TInterface { + +} + +class TChild extends TSuper { + +} + +class TSuper2 { + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/Test_return_wide.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/Test_return_wide.java new file mode 100644 index 0000000..681f49a --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/Test_return_wide.java @@ -0,0 +1,132 @@ +/* + * 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.jack.opcodes.return_wide; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_11; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_12; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_13; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_14; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_1; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_10; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_2; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_6; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_7; +import com.android.jack.opcodes.return_wide.jm.T_return_wide_9; + + +public class Test_return_wide extends DxTestCase { + + /** + * @title simple + */ + public void testN1() { + T_return_wide_1 t = new T_return_wide_1(); + assertEquals(123456d, t.run()); + } + + /** + * @title check that frames are discarded and reinstananted correctly + */ + public void testN2() { + T_return_wide_6 t = new T_return_wide_6(); + assertEquals(123456d, t.run()); + } + + /** + * @title check that monitor is released by return_wide + */ + public void testN3() { + assertTrue(T_return_wide_7.execute()); + } + + /** + * @title simple + */ + public void testN4() { + T_return_wide_2 t = new T_return_wide_2(); + assertEquals(0d, t.run()); + } + + /** + * @title simple + */ + public void testN5() { + T_return_wide_10 t = new T_return_wide_10(); + assertEquals(1d, t.run()); + } + + +// /** +// * @title Method is synchronized but thread is not monitor owner +// */ +// public void testE1() { +// T_return_wide_8 t = new T_return_wide_8(); +// try { +// assertTrue(t.run()); +// fail("expected IllegalMonitorStateException"); +// } catch (IllegalMonitorStateException imse) { +// // expected +// } +// } + + /** + * @title Lock structural rule 1 is violated + */ + public void testE2() { + T_return_wide_9 t = new T_return_wide_9(); + try { + assertEquals(1d, t.run()); + System.out.print("dvmvfe:"); + //fail("expected IllegalMonitorStateException"); + } catch (IllegalMonitorStateException imse) { + // expected + } + } + + /** + * @title simple + */ + public void testN1Long() { + T_return_wide_11 t = new T_return_wide_11(); + assertEquals(12345612345l, t.run()); + } + + /** + * @title check that frames are discarded and reinstananted correctly + */ + public void testN2Long() { + T_return_wide_12 t = new T_return_wide_12(); + assertEquals(12345612345l, t.run()); + } + + /** + * @title check that monitor is released by return_wide + */ + public void testN3Long() { + assertTrue(T_return_wide_13.execute()); + } + + + /** + * @title Method is synchronized but thread is not monitor owner + */ + public void testE1Long() { + T_return_wide_14 t = new T_return_wide_14(); + assertTrue(t.run()); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_1.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_1.java new file mode 100644 index 0000000..93680ad --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_1 { + + public double run() { + return 123456d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_10.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_10.java new file mode 100644 index 0000000..966ca3f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_10.java @@ -0,0 +1,29 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_10 { + + private static double test() { + return 1d; + } + + public double run() { + return test(); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_11.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_11.java new file mode 100644 index 0000000..0617e62 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_11.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_11 { + + public long run() { + return 12345612345l; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_12.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_12.java new file mode 100644 index 0000000..8a38a1c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_12.java @@ -0,0 +1,31 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_12 { + + public long run() { + return 12345612345l; + } + + private static long test() { + long a = 11111111111l; + long b = 22222222222l; + long c = 33333333333l; + return 44444444444l; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_13.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_13.java new file mode 100644 index 0000000..78a8306 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_13.java @@ -0,0 +1,60 @@ +/* + * 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.jack.opcodes.return_wide.jm; + + +public class T_return_wide_13 implements Runnable { + public final static int CNT = 1000; + long value = 0; + boolean failed = false; + + public void run() { + for(int i = 0; i < CNT; i++) { + test(); + } + } + + private synchronized long test() { + value++; + long c = value; + Thread.yield(); + if(c != value) + failed = true; + return c; + } + + public static boolean execute() { + T_return_wide_13 test = new T_return_wide_13(); + Thread t1 = new Thread(test); + Thread t2 = new Thread(test); + + t1.start(); + t2.start(); + + try + { + Thread.sleep(5000); + } + catch(InterruptedException ie) { + return false; + } + + if(test.value != CNT * 2) + return false; + return !test.failed; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_14.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_14.java new file mode 100644 index 0000000..c318e32 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_14.java @@ -0,0 +1,30 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_14 { + + private synchronized long test() { + return 0l; + } + + public boolean run() { + test(); + return true; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_2.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_2.java new file mode 100644 index 0000000..e728328 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_2.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_2 { + + public double run() { + return 0d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_6.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_6.java new file mode 100644 index 0000000..b0830a0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_6.java @@ -0,0 +1,31 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_6 { + + public double run() { + return 123456d; + } + + private static double test() { + double a = 1111d; + double b = 2222d; + double c = 3333d; + return 4444d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_7.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_7.java new file mode 100644 index 0000000..84c0395 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_7.java @@ -0,0 +1,60 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_7 implements Runnable { + public final static int CNT = 1000; + double value = 0; + boolean failed = false; + + public void run() { + for(int i = 0; i < CNT; i++) { + test(); + } + } + + private synchronized double test() { + value++; + double c = value; + Thread.yield(); + if(c != value) + failed = true; + return c; + } + + public static boolean execute() { + T_return_wide_7 test = new T_return_wide_7(); + Thread t1 = new Thread(test); + Thread t2 = new Thread(test); + + t1.start(); + t2.start(); + + try + { + Thread.sleep(5000); + } + catch(InterruptedException ie) { + return false; + } + + if(test.value != CNT * 2) + return false; + return !test.failed; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_8.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_8.java new file mode 100644 index 0000000..bce3f50 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_8.java @@ -0,0 +1,30 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_8 { + + private synchronized double test() { + return 0d; + } + + public boolean run() { + test(); + return true; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_9.java b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_9.java new file mode 100644 index 0000000..637fa91 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_9.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.return_wide.jm; + +public class T_return_wide_9 { + + public double run() { + return 1d; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sget/TestStubs.java b/jack-tests/tests/com/android/jack/opcodes/sget/TestStubs.java new file mode 100644 index 0000000..e07ab86 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sget/TestStubs.java @@ -0,0 +1,21 @@ +/* + * 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.jack.opcodes.sget; + +public class TestStubs { + private static int TestStubField = 50; +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sget/Test_sget.java b/jack-tests/tests/com/android/jack/opcodes/sget/Test_sget.java new file mode 100644 index 0000000..877c063 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sget/Test_sget.java @@ -0,0 +1,75 @@ +/* + * 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.jack.opcodes.sget; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.sget.jm.T_sget_1; +import com.android.jack.opcodes.sget.jm.T_sget_11; +import com.android.jack.opcodes.sget.jm.T_sget_2; +import com.android.jack.opcodes.sget.jm.T_sget_5; +import com.android.jack.opcodes.sget.jm.T_sget_9; + + +public class Test_sget extends DxTestCase { + + /** + * @title type - int + */ + public void testN1() { + T_sget_1 t = new T_sget_1(); + assertEquals(35, t.run()); + } + + /** + * @title type - double + */ + public void testN2() { + T_sget_2 t = new T_sget_2(); + assertEquals(123d, t.run()); + } + + /** + * @title access protected field from subclass + */ + public void testN3() { + // @uses com.android.jack.opcodes.sget.jm.T_sget_1 + T_sget_11 t = new T_sget_11(); + assertEquals(10, t.run()); + } + + /** + * @title attempt to access non-static field + */ + public void testN4() { + T_sget_5 t = new T_sget_5(); + assertEquals(5, t.run()); + } + + /** + * @title initialization of referenced class throws exception + */ + public void testE6() { + // @uses com.android.jack.opcodes.sget.jm.StubInitError + T_sget_9 t = new T_sget_9(); + try { + t.run(); + fail("expected Error"); + } catch (Error e) { + // expected + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_1.java b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_1.java new file mode 100644 index 0000000..1c953fa --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_1.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.sget.jm; + +public class T_sget_1 { + public static int i1 = 5; + protected static int p1 = 10; + private static int pvt1 = 20; + + public int run(){ + return i1 + p1 + pvt1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_11.java b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_11.java new file mode 100644 index 0000000..dd42f1b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_11.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sget.jm; + +public class T_sget_11 extends T_sget_1 { + + public int run(){ + return p1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_2.java b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_2.java new file mode 100644 index 0000000..f4912e6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_2.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.sget.jm; + +public class T_sget_2 { + + public static double val = 123.0d; + + public double run() { + return val; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_4.java b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_4.java new file mode 100644 index 0000000..e9134ad --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_4.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.sget.jm; + +public class T_sget_4 { + + public static int i1 = 5; + public int run(){ + return i1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_5.java b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_5.java new file mode 100644 index 0000000..5d2f882 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_5.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.sget.jm; + +public class T_sget_5 { + + public int i1 = 5; + public int run(){ + return i1; + } +} + diff --git a/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_9.java b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_9.java new file mode 100644 index 0000000..57e09e2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sget/jm/T_sget_9.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.sget.jm; + + +public class T_sget_9 { + + public int run(){ + return StubInitError.value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sget/jm/TestStubs.java b/jack-tests/tests/com/android/jack/opcodes/sget/jm/TestStubs.java new file mode 100644 index 0000000..9b871e5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sget/jm/TestStubs.java @@ -0,0 +1,22 @@ +/* + * 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.jack.opcodes.sget.jm; + + +class StubInitError{ + public static int value = 5 / 0; +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shl_int/Test_shl_int.java b/jack-tests/tests/com/android/jack/opcodes/shl_int/Test_shl_int.java new file mode 100644 index 0000000..147b21d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shl_int/Test_shl_int.java @@ -0,0 +1,120 @@ +/* + * 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.jack.opcodes.shl_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.shl_int.jm.T_shl_int_1; +import com.android.jack.opcodes.shl_int.jm.T_shl_int_3; +import com.android.jack.opcodes.shl_int.jm.T_shl_int_4; + + +public class Test_shl_int extends DxTestCase { + + /** + * @title 15 << 1 + */ + public void testN1() { + T_shl_int_1 t = new T_shl_int_1(); + assertEquals(30, t.run(15, 1)); + } + + /** + * @title 33 << 2 + */ + public void testN2() { + T_shl_int_1 t = new T_shl_int_1(); + assertEquals(132, t.run(33, 2)); + } + + /** + * @title -15 << 1 + */ + public void testN3() { + T_shl_int_1 t = new T_shl_int_1(); + assertEquals(-30, t.run(-15, 1)); + } + + /** + * @title Arguments = 1 & -1 + */ + public void testN4() { + T_shl_int_1 t = new T_shl_int_1(); + assertEquals(0x80000000, t.run(1, -1)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 32. + */ + public void testN5() { + T_shl_int_1 t = new T_shl_int_1(); + assertEquals(66, t.run(33, 33)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 32. + */ + public void testN6() { + T_shl_int_3 t = new T_shl_int_3(); + assertEquals(66, t.run(33, 33)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 32. + */ + public void testN7() { + T_shl_int_4 t = new T_shl_int_4(); + assertEquals(66, t.run(33, 33)); + } + + /** + * FIXME: do we need to check that all the shift distances (0..31) works + * fine? + */ + + /** + * @title Arguments = 0 & -1 + */ + public void testB1() { + T_shl_int_1 t = new T_shl_int_1(); + assertEquals(0, t.run(0, -1)); + } + + /** + * @title Arguments = Integer.MAX_VALUE & 1 + */ + public void testB2() { + T_shl_int_1 t = new T_shl_int_1(); + assertEquals(0xfffffffe, t.run(Integer.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE & 1 + */ + public void testB3() { + T_shl_int_1 t = new T_shl_int_1(); + assertEquals(0, t.run(Integer.MIN_VALUE, 1)); + } + + /** + * @title Arguments = 1 & 0 + */ + public void testB4() { + T_shl_int_1 t = new T_shl_int_1(); + assertEquals(1, t.run(1, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_1.java b/jack-tests/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_1.java new file mode 100644 index 0000000..0359425 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shl_int.jm; + +public class T_shl_int_1 { + + public int run(int a, int b) { + return a << b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_3.java b/jack-tests/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_3.java new file mode 100644 index 0000000..81b4b7f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shl_int.jm; + +public class T_shl_int_3 { + + public int run(double a, int b) { + return (int)a << b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_4.java b/jack-tests/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_4.java new file mode 100644 index 0000000..59d606f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shl_int.jm; + +public class T_shl_int_4 { + + public int run(int a, long b) { + return a << (int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shl_long/Test_shl_long.java b/jack-tests/tests/com/android/jack/opcodes/shl_long/Test_shl_long.java new file mode 100644 index 0000000..4cac7eb --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shl_long/Test_shl_long.java @@ -0,0 +1,124 @@ +/* + * 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.jack.opcodes.shl_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.shl_long.jm.T_shl_long_1; +import com.android.jack.opcodes.shl_long.jm.T_shl_long_3; +import com.android.jack.opcodes.shl_long.jm.T_shl_long_4; +import com.android.jack.opcodes.shl_long.jm.T_shl_long_5; + + +public class Test_shl_long extends DxTestCase { + + /** + * @title Arguments = 5000000000l, 3 + */ + public void testN1() { + T_shl_long_1 t = new T_shl_long_1(); + assertEquals(40000000000l, t.run(5000000000l, 3)); + } + + /** + * @title Arguments = 5000000000l, 1 + */ + public void testN2() { + T_shl_long_1 t = new T_shl_long_1(); + assertEquals(10000000000l, t.run(5000000000l, 1)); + } + + /** + * @title Arguments = -5000000000l, 1 + */ + public void testN3() { + T_shl_long_1 t = new T_shl_long_1(); + assertEquals(-10000000000l, t.run(-5000000000l, 1)); + } + + /** + * @title Arguments = 1, -1 + */ + public void testN4() { + T_shl_long_1 t = new T_shl_long_1(); + assertEquals(0x8000000000000000l, t.run(1l, -1)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 64. + */ + public void testN5() { + T_shl_long_1 t = new T_shl_long_1(); + assertEquals(130l, t.run(65l, 65)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 64. + */ + public void testN6() { + T_shl_long_3 t = new T_shl_long_3(); + assertEquals(130l, t.run(65l, 65)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 64. + */ + public void testN7() { + T_shl_long_4 t = new T_shl_long_4(); + assertEquals(130l, t.run(65, 65)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 64. + */ + public void testN8() { + T_shl_long_5 t = new T_shl_long_5(); + assertEquals(130l, t.run(65l, 65)); + } + + /** + * @title Arguments = 0, -1 + */ + public void testB1() { + T_shl_long_1 t = new T_shl_long_1(); + assertEquals(0, t.run(0, -1)); + } + + /** + * @title Arguments = 1, 0 + */ + public void testB2() { + T_shl_long_1 t = new T_shl_long_1(); + assertEquals(1, t.run(1, 0)); + } + + /** + * @title Arguments = Long.MAX_VALUE, 1 + */ + public void testB3() { + T_shl_long_1 t = new T_shl_long_1(); + assertEquals(0xfffffffe, t.run(Long.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Long.MIN_VALUE, 1 + */ + public void testB4() { + T_shl_long_1 t = new T_shl_long_1(); + assertEquals(0l, t.run(Long.MIN_VALUE, 1)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_1.java b/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_1.java new file mode 100644 index 0000000..9154ff0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shl_long.jm; + +public class T_shl_long_1 { + + public long run(long a, int b) { + return a << b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_3.java b/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_3.java new file mode 100644 index 0000000..3148122 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shl_long.jm; + +public class T_shl_long_3 { + + public long run(double a, int b) { + return (long)a << b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_4.java b/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_4.java new file mode 100644 index 0000000..4e1ad56 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shl_long.jm; + +public class T_shl_long_4 { + + public long run(int a, int b) { + return a << b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_5.java b/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_5.java new file mode 100644 index 0000000..05eb274 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shl_long.jm; + +public class T_shl_long_5 { + + public long run(float a, int b) { + return (long)a << b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shr_int/Test_shr_int.java b/jack-tests/tests/com/android/jack/opcodes/shr_int/Test_shr_int.java new file mode 100644 index 0000000..9204f21 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shr_int/Test_shr_int.java @@ -0,0 +1,115 @@ +/* + * 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.jack.opcodes.shr_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.shr_int.jm.T_shr_int_1; +import com.android.jack.opcodes.shr_int.jm.T_shr_int_3; +import com.android.jack.opcodes.shr_int.jm.T_shr_int_4; + + +public class Test_shr_int extends DxTestCase { + + /** + * @title 15 >> 1 + */ + public void testN1() { + T_shr_int_1 t = new T_shr_int_1(); + assertEquals(7, t.run(15, 1)); + } + + /** + * @title 33 >> 2 + */ + public void testN2() { + T_shr_int_1 t = new T_shr_int_1(); + assertEquals(8, t.run(33, 2)); + } + + /** + * @title -15 >> 1 + */ + public void testN3() { + T_shr_int_1 t = new T_shr_int_1(); + assertEquals(-8, t.run(-15, 1)); + } + + /** + * @title Arguments = 1 & -1 + */ + public void testN4() { + T_shr_int_1 t = new T_shr_int_1(); + assertEquals(0, t.run(1, -1)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 32. + */ + public void testN5() { + T_shr_int_1 t = new T_shr_int_1(); + assertEquals(16, t.run(33, 33)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 32. + */ + public void testN6() { + T_shr_int_3 t = new T_shr_int_3(); + assertEquals(16, t.run(33, 33)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 32. + */ + public void testN7() { + T_shr_int_4 t = new T_shr_int_4(); + assertEquals(16, t.run(33, 33)); + } + + /** + * @title Arguments = 0 & -1 + */ + public void testB1() { + T_shr_int_1 t = new T_shr_int_1(); + assertEquals(0, t.run(0, -1)); + } + + /** + * @title Arguments = Integer.MAX_VALUE & 1 + */ + public void testB2() { + T_shr_int_1 t = new T_shr_int_1(); + assertEquals(0x3FFFFFFF, t.run(Integer.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE & 1 + */ + public void testB3() { + T_shr_int_1 t = new T_shr_int_1(); + assertEquals(0xc0000000, t.run(Integer.MIN_VALUE, 1)); + } + + /** + * @title Arguments = 1 & 0 + */ + public void testB4() { + T_shr_int_1 t = new T_shr_int_1(); + assertEquals(1, t.run(1, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_1.java b/jack-tests/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_1.java new file mode 100644 index 0000000..8c45224 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shr_int.jm; + +public class T_shr_int_1 { + + public int run(int a, int b) { + return a >> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_3.java b/jack-tests/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_3.java new file mode 100644 index 0000000..7fc62a6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shr_int.jm; + +public class T_shr_int_3 { + + public int run(double a, int b) { + return (int)a >> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_4.java b/jack-tests/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_4.java new file mode 100644 index 0000000..0f24f41 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shr_int.jm; + +public class T_shr_int_4 { + + public int run(int a, long b) { + return a >> (int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shr_long/Test_shr_long.java b/jack-tests/tests/com/android/jack/opcodes/shr_long/Test_shr_long.java new file mode 100644 index 0000000..7e5cac6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shr_long/Test_shr_long.java @@ -0,0 +1,125 @@ +/* + * 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.jack.opcodes.shr_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.shr_long.jm.T_shr_long_1; +import com.android.jack.opcodes.shr_long.jm.T_shr_long_3; +import com.android.jack.opcodes.shr_long.jm.T_shr_long_4; +import com.android.jack.opcodes.shr_long.jm.T_shr_long_5; + + +public class Test_shr_long extends DxTestCase { + + /** + * @title Arguments = 40000000000l, 3 + */ + public void testN1() { + T_shr_long_1 t = new T_shr_long_1(); + assertEquals(5000000000l, t.run(40000000000l, 3)); + } + + /** + * @title Arguments = 40000000000l, 1 + */ + public void testN2() { + T_shr_long_1 t = new T_shr_long_1(); + assertEquals(20000000000l, t.run(40000000000l, 1)); + } + + /** + * @title Arguments = -40000000000l, 1 + */ + public void testN3() { + T_shr_long_1 t = new T_shr_long_1(); + assertEquals(-20000000000l, t.run(-40000000000l, 1)); + } + + /** + * @title Arguments = 1, -1 + */ + public void testN4() { + T_shr_long_1 t = new T_shr_long_1(); + assertEquals(0l, t.run(1l, -1)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 64. + */ + public void testN5() { + T_shr_long_1 t = new T_shr_long_1(); + assertEquals(32, t.run(65l, 65)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 64. + */ + public void testN6() { + T_shr_long_3 t = new T_shr_long_3(); + assertEquals(32, t.run(65l, 65)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 64. + */ + public void testN7() { + T_shr_long_4 t = new T_shr_long_4(); + assertEquals(32, t.run(65, 65)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 64. + */ + public void testN8() { + T_shr_long_5 t = new T_shr_long_5(); + assertEquals(32, t.run(65l, 65)); + } + + /** + * @title Arguments = 0, -1 + */ + public void testB1() { + T_shr_long_1 t = new T_shr_long_1(); + assertEquals(0l, t.run(0l, -1)); + } + + /** + * @title Arguments = 1, 0 + */ + public void testB2() { + T_shr_long_1 t = new T_shr_long_1(); + assertEquals(1l, t.run(1l, 0)); + } + + /** + * @title Arguments = Long.MAX_VALUE, 1 + */ + public void testB3() { + T_shr_long_1 t = new T_shr_long_1(); + assertEquals(0x3FFFFFFFFFFFFFFFl, t.run(Long.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Long.MIN_VALUE, 1 + */ + public void testB4() { + T_shr_long_1 t = new T_shr_long_1(); + assertEquals(0xc000000000000000l, t.run(Long.MIN_VALUE, 1)); + } + + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_1.java b/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_1.java new file mode 100644 index 0000000..921b951 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shr_long.jm; + +public class T_shr_long_1 { + + public long run(long a, int b) { + return a >> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_3.java b/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_3.java new file mode 100644 index 0000000..bf35179 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shr_long.jm; + +public class T_shr_long_3 { + + public long run(double a, int b) { + return (long)a >> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_4.java b/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_4.java new file mode 100644 index 0000000..69a4c3e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shr_long.jm; + +public class T_shr_long_4 { + + public long run(int a, int b) { + return a >> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_5.java b/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_5.java new file mode 100644 index 0000000..27e20c1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.shr_long.jm; + +public class T_shr_long_5 { + + public long run(float a, int b) { + return (long)a >> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sparse_switch/Test_sparse_switch.java b/jack-tests/tests/com/android/jack/opcodes/sparse_switch/Test_sparse_switch.java new file mode 100644 index 0000000..f44b5d1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sparse_switch/Test_sparse_switch.java @@ -0,0 +1,57 @@ +/* + * 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.jack.opcodes.sparse_switch; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.sparse_switch.jm.T_sparse_switch_1; + + +public class Test_sparse_switch extends DxTestCase { + + /** + * @title normal test + */ + public void testN1() { + T_sparse_switch_1 t = new T_sparse_switch_1(); + assertEquals(2, t.run(-1)); + + assertEquals(-1, t.run(9)); + assertEquals(20, t.run(10)); + assertEquals(-1, t.run(11)); + + assertEquals(-1, t.run(14)); + assertEquals(20, t.run(15)); + assertEquals(-1, t.run(16)); + } + + /** + * @title check Integer.MAX_VALUE + */ + public void testB1() { + T_sparse_switch_1 t = new T_sparse_switch_1(); + assertEquals(-1, t.run(Integer.MAX_VALUE)); + } + + /** + * @title check Integer.MIN_VALUE + */ + public void testB2() { + T_sparse_switch_1 t = new T_sparse_switch_1(); + assertEquals(-1, t.run(Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sparse_switch/jm/T_sparse_switch_1.java b/jack-tests/tests/com/android/jack/opcodes/sparse_switch/jm/T_sparse_switch_1.java new file mode 100644 index 0000000..a435a34 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sparse_switch/jm/T_sparse_switch_1.java @@ -0,0 +1,32 @@ +/* + * 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.jack.opcodes.sparse_switch.jm; + +public class T_sparse_switch_1 { + + public int run(int i) { + switch (i) { + case -1: + return 2; + case 10: + case 15: + return 20; + default: + return -1; + } + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/TestStubs.java b/jack-tests/tests/com/android/jack/opcodes/sput/TestStubs.java new file mode 100644 index 0000000..551d193 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/TestStubs.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.sput; + +public class TestStubs { + // used by testE2 + static int TestStubField = 0; + + // used by testE5 + public static final int TestStubFieldFinal = 0; +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/Test_sput.java b/jack-tests/tests/com/android/jack/opcodes/sput/Test_sput.java new file mode 100644 index 0000000..37d031c --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/Test_sput.java @@ -0,0 +1,112 @@ +/* + * 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.jack.opcodes.sput; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.sput.jm.T_sput_1; +import com.android.jack.opcodes.sput.jm.T_sput_13; +import com.android.jack.opcodes.sput.jm.T_sput_14; +import com.android.jack.opcodes.sput.jm.T_sput_16; +import com.android.jack.opcodes.sput.jm.T_sput_18; +import com.android.jack.opcodes.sput.jm.T_sput_2; +import com.android.jack.opcodes.sput.jm.T_sput_6; + + +public class Test_sput extends DxTestCase { + + /** + * @title type - int + */ + public void testN1() { + T_sput_1 t = new T_sput_1(); + assertEquals(0, T_sput_1.st_i1); + t.run(); + assertEquals(1000000, T_sput_1.st_i1); + } + + /** + * @title type - double + */ + public void testN2() { + T_sput_2 t = new T_sput_2(); + assertEquals(0d, T_sput_2.st_d1); + t.run(); + assertEquals(1000000d, T_sput_2.st_d1); + } + + /** + * @title modification of protected field from subclass + */ + public void testN4() { + // @uses com.android.jack.opcodes.sput.jm.T_sput_1 + T_sput_14 t = new T_sput_14(); + assertEquals(0, T_sput_14.getProtectedField()); + t.run(); + assertEquals(1000000, T_sput_14.getProtectedField()); + } + + /** + * @title assignment compatible references + */ + public void testN5() { + T_sput_16 t = new T_sput_16(); + assertNull(T_sput_16.o); + t.run(); + assertEquals("", (String) T_sput_16.o); + } + + /** + * @title modification of protected field from subclass + */ + public void testN6() { + T_sput_6 t = new T_sput_6(); + assertEquals(null, T_sput_6.s); + try { + t.run(); + fail ("ClassCastException expected"); + } + catch (ClassCastException e) { + // expected + } + assertEquals(null, T_sput_6.s); + } + + /** + * @title modification of protected field from subclass + */ + public void testN7() { + T_sput_18 t = new T_sput_18(); + assertEquals(0, T_sput_18.v); + t.run(); + assertEquals(3, T_sput_18.v); + } + + /** + * @title initialization of referenced class throws exception + */ + public void testE6() { + // @uses com.android.jack.opcodes.sput.jm.StubInitError + T_sput_13 t = new T_sput_13(); + try { + t.run(); + fail("expected Error"); + } catch (Error e) { + // expected + } + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_1.java b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_1.java new file mode 100644 index 0000000..3a7dbb3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_1.java @@ -0,0 +1,32 @@ +/* + * 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.jack.opcodes.sput.jm; + +public class T_sput_1 { + public static int st_i1; + protected static int st_p1; + private static int st_pvt1; + + public void run() { + st_i1 = 1000000; + } + + public static int getPvtField() + { + return st_pvt1; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_13.java b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_13.java new file mode 100644 index 0000000..1dfc6df --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_13.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sput.jm; + +public class T_sput_13 { + + public int run() { + return StubInitError.value; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_14.java b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_14.java new file mode 100644 index 0000000..63edca5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_14.java @@ -0,0 +1,29 @@ +/* + * 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.jack.opcodes.sput.jm; + +public class T_sput_14 extends T_sput_1{ + + public void run() { + T_sput_1.st_p1 = 1000000; + } + + public static int getProtectedField(){ + return T_sput_1.st_p1; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_16.java b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_16.java new file mode 100644 index 0000000..f34d33e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_16.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.sput.jm; + +public class T_sput_16 { + + public static Object o = null; + + public void run() { + String s = new String(""); + o = s; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_18.java b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_18.java new file mode 100644 index 0000000..283c19f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_18.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.sput.jm; + +public class T_sput_18 { + + public static int v; + + public void run() { + v = (int)3.14f; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_2.java b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_2.java new file mode 100644 index 0000000..f2cafe5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_2.java @@ -0,0 +1,26 @@ +/* + * 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.jack.opcodes.sput.jm; + +public class T_sput_2 { + + public static double st_d1; + + public void run() { + st_d1 = 1000000d; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_6.java b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_6.java new file mode 100644 index 0000000..64f0676 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/jm/T_sput_6.java @@ -0,0 +1,27 @@ +/* + * 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.jack.opcodes.sput.jm; + +public class T_sput_6 { + + public static String s; + + public void run() { + Object o = new Object(); + s = (String)o; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sput/jm/TestStubs.java b/jack-tests/tests/com/android/jack/opcodes/sput/jm/TestStubs.java new file mode 100644 index 0000000..55ce04d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sput/jm/TestStubs.java @@ -0,0 +1,22 @@ +/* + * 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.jack.opcodes.sput.jm; + + +class StubInitError{ + public static int value = 5 / 0; +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_double/Test_sub_double.java b/jack-tests/tests/com/android/jack/opcodes/sub_double/Test_sub_double.java new file mode 100644 index 0000000..78d541d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_double/Test_sub_double.java @@ -0,0 +1,151 @@ +/* + * 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.jack.opcodes.sub_double; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.sub_double.jm.T_sub_double_1; +import com.android.jack.opcodes.sub_double.jm.T_sub_double_3; +import com.android.jack.opcodes.sub_double.jm.T_sub_double_4; + + +public class Test_sub_double extends DxTestCase { + + /** + * @title Arguments = 2.7d, 3.14d + */ + public void testN1() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(-0.43999999999999995d, t.run(2.7d, 3.14d)); + } + + /** + * @title Arguments = 0, -3.14d + */ + public void testN2() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(3.14d, t.run(0, -3.14d)); + } + + /** + * @title Arguments = -3.14d, -2.7d + */ + public void testN3() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(-0.43999999999999995d, t.run(-3.14d, -2.7d)); + } + + /** + * @title Arguments = -3.14d, -2.7d + */ + public void testN4() { + T_sub_double_3 t = new T_sub_double_3(); + assertEquals(-0.4400001049041746d, t.run(-3.14f, -2.7d)); + } + + /** + * @title Arguments = -3.14d, -2.7d + */ + public void testN5() { + T_sub_double_4 t = new T_sub_double_4(); + assertEquals(-311.3, t.run(-314l, -2.7d)); + } + + /** + * @title Arguments = Double.MAX_VALUE, Double.NaN + */ + public void testB1() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(Double.NaN, t.run(Double.MAX_VALUE, Double.NaN)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, + * Double.NEGATIVE_INFINITY + */ + public void testB2() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(Double.POSITIVE_INFINITY, t.run(Double.POSITIVE_INFINITY, + Double.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, + * Double.POSITIVE_INFINITY + */ + public void testB3() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(Double.NaN, t.run(Double.POSITIVE_INFINITY, + Double.POSITIVE_INFINITY)); + } + + /** + * @title Arguments = Double.POSITIVE_INFINITY, -2.7d + */ + public void testB4() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(Double.POSITIVE_INFINITY, t.run(Double.POSITIVE_INFINITY, + -2.7d)); + } + + /** + * @title Arguments = +0, -0d + */ + public void testB5() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(+0d, t.run(+0d, -0d)); + } + + /** + * @title Arguments = -0d, -0d + */ + public void testB6() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(0d, t.run(-0d, -0d)); + } + + /** + * @title Arguments = +0d, +0d + */ + public void testB7() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(+0d, t.run(+0d, +0d)); + } + + /** + * @title Arguments = 2.7d, 2.7d + */ + public void testB8() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(0d, t.run(2.7d, 2.7d)); + } + + /** + * @title Arguments = Double.MAX_VALUE, Double.MAX_VALUE + */ + public void testB9() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(0d, t.run(Double.MAX_VALUE, Double.MAX_VALUE)); + } + + /** + * @title Arguments = Double.MIN_VALUE, 4.9E-324 + */ + public void testB10() { + T_sub_double_1 t = new T_sub_double_1(); + assertEquals(0d, t.run(Double.MIN_VALUE, 4.9E-324)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_1.java b/jack-tests/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_1.java new file mode 100644 index 0000000..9fc3e6b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_double.jm; + +public class T_sub_double_1 { + + public double run(double a, double b) { + return a-b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_3.java b/jack-tests/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_3.java new file mode 100644 index 0000000..6d46eba --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_double.jm; + +public class T_sub_double_3 { + + public double run(float a, double b) { + return (double)a-b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_4.java b/jack-tests/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_4.java new file mode 100644 index 0000000..ee5a435 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_double.jm; + +public class T_sub_double_4 { + + public double run(long a, double b) { + return (double)a-b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_float/Test_sub_float.java b/jack-tests/tests/com/android/jack/opcodes/sub_float/Test_sub_float.java new file mode 100644 index 0000000..ce2846d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_float/Test_sub_float.java @@ -0,0 +1,160 @@ +/* + * 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.jack.opcodes.sub_float; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.sub_float.jm.T_sub_float_1; +import com.android.jack.opcodes.sub_float.jm.T_sub_float_3; +import com.android.jack.opcodes.sub_float.jm.T_sub_float_4; + + +public class Test_sub_float extends DxTestCase { + + /** + * @title Arguments = 2.7f, 3.14f + */ + public void testN1() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(-0.44000006f, t.run(2.7f, 3.14f)); + } + + /** + * @title Arguments = 0, -3.14f + */ + public void testN2() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(3.14f, t.run(0, -3.14f)); + } + + /** + * @title Arguments = -3.14f, -2.7f + */ + public void testN3() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(-0.44000006f, t.run(-3.14f, -2.7f)); + } + + /** + * @title Arguments = -3.14f, -2.7f + */ + public void testN4() { + T_sub_float_3 t = new T_sub_float_3(); + assertEquals(-0.44000006f, t.run(-3.14f, -2.7f)); + } + + /** + * @title Arguments = -3.14f, -2.7f + */ + public void testN5() { + T_sub_float_4 t = new T_sub_float_4(); + assertEquals(-311.3f, t.run(-314l, -2.7f)); + } + + /** + * @title Arguments = Float.MAX_VALUE, Float.NaN + */ + public void testB1() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(Float.NaN, t.run(Float.MAX_VALUE, Float.NaN)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, + * Float.NEGATIVE_INFINITY + */ + public void testB2() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(Float.POSITIVE_INFINITY, + Float.NEGATIVE_INFINITY)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, + * Float.POSITIVE_INFINITY + */ + public void testB3() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(Float.NaN, t.run(Float.POSITIVE_INFINITY, + Float.POSITIVE_INFINITY)); + } + + /** + * @title Arguments = Float.POSITIVE_INFINITY, -2.7f + */ + public void testB4() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(Float.POSITIVE_INFINITY, + -2.7f)); + } + + /** + * @title Arguments = +0, -0f + */ + public void testB5() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(+0f, t.run(+0f, -0f)); + } + + /** + * @title Arguments = -0f, -0f + */ + public void testB6() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(0f, t.run(-0f, -0f)); + } + + /** + * @title Arguments = +0f, +0f + */ + public void testB7() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(+0f, t.run(+0f, +0f)); + } + + /** + * @title Arguments = 2.7f, 2.7f + */ + public void testB8() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(0f, t.run(2.7f, 2.7f)); + } + + /** + * @title Arguments = Float.MAX_VALUE, Float.MAX_VALUE + */ + public void testB9() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(0f, t.run(Float.MAX_VALUE, Float.MAX_VALUE)); + } + + /** + * @title Arguments = Float.MIN_VALUE, -1.4E-45f + */ + public void testB10() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(0f, t.run(Float.MIN_VALUE, 1.4E-45f)); + } + + /** + * @title Arguments = Float.MAX_VALUE, -Float.MAX_VALUE + */ + public void testB11() { + T_sub_float_1 t = new T_sub_float_1(); + assertEquals(Float.POSITIVE_INFINITY, t.run(Float.MAX_VALUE, + -3.402823E+38F)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_1.java b/jack-tests/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_1.java new file mode 100644 index 0000000..77745b3 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_float.jm; + +public class T_sub_float_1 { + + public float run(float a, float b) { + return a-b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_3.java b/jack-tests/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_3.java new file mode 100644 index 0000000..b2ecb1f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_float.jm; + +public class T_sub_float_3 { + + public float run(float a, double b) { + return a-(float)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_4.java b/jack-tests/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_4.java new file mode 100644 index 0000000..ce1a01e --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_float.jm; + +public class T_sub_float_4 { + + public float run(long a, float b) { + return (float)a-b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_int/Test_sub_int.java b/jack-tests/tests/com/android/jack/opcodes/sub_int/Test_sub_int.java new file mode 100644 index 0000000..40d8047 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_int/Test_sub_int.java @@ -0,0 +1,147 @@ +/* + * 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.jack.opcodes.sub_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.sub_int.jm.T_sub_int_1; +import com.android.jack.opcodes.sub_int.jm.T_sub_int_3; +import com.android.jack.opcodes.sub_int.jm.T_sub_int_4; + + +public class Test_sub_int extends DxTestCase { + + /** + * @title Arguments = 8, 4 + */ + public void testN1() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(4, t.run(8, 4)); + } + + /** + * @title Arguments = 0, 255 + */ + public void testN2() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(-255, t.run(0, 255)); + } + + /** + * @title Arguments = 0, -65536 + */ + public void testN3() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(65536, t.run(0, -65536)); + } + + /** + * @title Arguments = 0, -2147483647 + */ + public void testN4() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(Integer.MAX_VALUE, t.run(0, -2147483647)); + } + + /** + * @title Arguments = 0, -2147483647 + */ + public void testN5() { + T_sub_int_3 t = new T_sub_int_3(); + assertEquals(Integer.MAX_VALUE, t.run(0, -2147483647)); + } + + /** + * @title Arguments = 0, -2147483647 + */ + public void testN6() { + T_sub_int_4 t = new T_sub_int_4(); + assertEquals(Integer.MAX_VALUE, t.run(0, -2147483647)); + } + + /** + * @title Arguments = 0, Integer.MAX_VALUE + */ + public void testB1() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(-2147483647, t.run(0, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE + */ + public void testB2() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(0, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, -1 + */ + public void testB3() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(Integer.MIN_VALUE, t.run(Integer.MAX_VALUE, -1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE, 1 + */ + public void testB4() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(Integer.MAX_VALUE, t.run(Integer.MIN_VALUE, 1)); + } + + /** + * @title Arguments = 0, 0 + */ + public void testB5() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(0, t.run(0, 0)); + } + + /** + * @title Arguments = 0, -Integer.MIN_VALUE + */ + public void testB6() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(-2147483648, t.run(0, -Integer.MIN_VALUE)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, 1 + */ + public void testB7() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(2147483646, t.run(Integer.MAX_VALUE, 1)); + } + + /** + * @title Arguments = 1, Integer.MIN_VALUE + */ + public void testB8() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(-2147483647, t.run(1, Integer.MIN_VALUE)); + } + + /** + * @title Arguments = Integer.MAX_VALUE, Integer.MIN_VALUE + */ + public void testB9() { + T_sub_int_1 t = new T_sub_int_1(); + assertEquals(-1, t.run(Integer.MAX_VALUE, Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_1.java b/jack-tests/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_1.java new file mode 100644 index 0000000..099faa1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_int.jm; + +public class T_sub_int_1 { + + public int run(int a, int b) { + return a-b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_3.java b/jack-tests/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_3.java new file mode 100644 index 0000000..7ffd5c4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_int.jm; + +public class T_sub_int_3 { + + public int run(int a, double b) { + return a-(int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_4.java b/jack-tests/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_4.java new file mode 100644 index 0000000..e455f86 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_int.jm; + +public class T_sub_int_4 { + + public int run(long a, int b) { + return (int)a-b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_long/Test_sub_long.java b/jack-tests/tests/com/android/jack/opcodes/sub_long/Test_sub_long.java new file mode 100644 index 0000000..e7aef36 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_long/Test_sub_long.java @@ -0,0 +1,118 @@ +/* + * 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.jack.opcodes.sub_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.sub_long.jm.T_sub_long_1; +import com.android.jack.opcodes.sub_long.jm.T_sub_long_3; +import com.android.jack.opcodes.sub_long.jm.T_sub_long_4; +import com.android.jack.opcodes.sub_long.jm.T_sub_long_5; + + +public class Test_sub_long extends DxTestCase { + + /** + * @title Arguments = 1111127348242l, 11111111114l + */ + public void testN1() { + T_sub_long_1 t = new T_sub_long_1(); + assertEquals(1100016237128l, t.run(1111127348242l, 11111111114l)); + } + + /** + * @title Arguments = 0, 1111127348242l + */ + public void testN2() { + T_sub_long_1 t = new T_sub_long_1(); + assertEquals(-1111127348242l, t.run(0, 1111127348242l)); + } + + /** + * @title Arguments = 0, -11111111114l + */ + public void testN3() { + T_sub_long_1 t = new T_sub_long_1(); + assertEquals(11111111114l, t.run(0, -11111111114l)); + } + + /** + * @title Arguments = 0, -11111111114l + */ + public void testN4() { + T_sub_long_3 t = new T_sub_long_3(); + assertEquals(11111111114l, t.run(0, -11111111114l)); + } + + /** + * @title Arguments = 0, -11111111114l + */ + public void testN5() { + T_sub_long_4 t = new T_sub_long_4(); + assertEquals(11111111114l, t.run(0, -11111111114l)); + } + + /** + * @title Arguments = 0, -11111111114l + */ + public void testN6() { + T_sub_long_5 t = new T_sub_long_5(); + assertEquals(11111110656l, t.run(0, -11111111114l)); + } + + /** + * @title Arguments = 0l, Long.MAX_VALUE + */ + public void testB1() { + T_sub_long_1 t = new T_sub_long_1(); + assertEquals(-9223372036854775807L, t.run(0l, Long.MAX_VALUE)); + } + /** + * @title Arguments = 9223372036854775807L, Long.MAX_VALUE + */ + public void testB2() { + T_sub_long_1 t = new T_sub_long_1(); + assertEquals(0l, t.run(9223372036854775807L, Long.MAX_VALUE)); + } + /** + * @title Arguments = Long.MAX_VALUE, -1l + */ + public void testB3() { + T_sub_long_1 t = new T_sub_long_1(); + assertEquals(-9223372036854775808L, t.run(Long.MAX_VALUE, -1l)); + } + /** + * @title Arguments = Long.MIN_VALUE, 1l + */ + public void testB4() { + T_sub_long_1 t = new T_sub_long_1(); + assertEquals(9223372036854775807L, t.run(Long.MIN_VALUE, 1l)); + } + /** + * @title Arguments = 0l, 0l + */ + public void testB5() { + T_sub_long_1 t = new T_sub_long_1(); + assertEquals(0l, t.run(0l, 0l)); + } + /** + * @title Arguments = 0l, -Long.MIN_VALUE + */ + public void testB6() { + T_sub_long_1 t = new T_sub_long_1(); + assertEquals(-9223372036854775808L, t.run(0l, -Long.MIN_VALUE)); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_1.java b/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_1.java new file mode 100644 index 0000000..dacc66d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_1.java @@ -0,0 +1,25 @@ +/* + * 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.jack.opcodes.sub_long.jm; + +public class T_sub_long_1 { + + public long run(long a, long b) { + return a-b; + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_3.java b/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_3.java new file mode 100644 index 0000000..75064c9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_long.jm; + +public class T_sub_long_3 { + + public long run(long a, double b) { + return (long)(a-b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_4.java b/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_4.java new file mode 100644 index 0000000..e9f6b55 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_long.jm; + +public class T_sub_long_4 { + + public long run(int a, long b) { + return a-b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_5.java b/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_5.java new file mode 100644 index 0000000..ce4fed8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.sub_long.jm; + +public class T_sub_long_5 { + + public long run(float a, long b) { + return (long)(a-b); + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/test-opcodes.mk b/jack-tests/tests/com/android/jack/opcodes/test-opcodes.mk new file mode 100644 index 0000000..3d8d47f --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/test-opcodes.mk @@ -0,0 +1,1181 @@ +# Copyright (C) 2012 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. + +### add_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-add_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/add_double/Test_add_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/add_double/jm/T_add_double_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_double/jm/T_add_double_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_double/jm/T_add_double_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.add_double.Test_add_double + +include $(JACK_RUN_TEST) + +### float_to_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-float_to_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_long/Test_float_to_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_long/jm/T_float_to_long_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.float_to_long.Test_float_to_long + +include $(JACK_RUN_TEST) + +### array_length ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-array_length +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/array_length/Test_array_length.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/array_length/jm/T_array_length_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/array_length/jm/T_array_length_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.array_length.Test_array_length + +include $(JACK_RUN_TEST) + +### sub_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-sub_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sub_double/Test_sub_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/sub_double/jm/T_sub_double_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.sub_double.Test_sub_double + +include $(JACK_RUN_TEST) + +### int_to_short ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-int_to_short +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_short/Test_int_to_short.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_short/jm/T_int_to_short_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.int_to_short.Test_int_to_short + +include $(JACK_RUN_TEST) + +### int_to_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-int_to_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_long/Test_int_to_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_long/jm/T_int_to_long_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.int_to_long.Test_int_to_long + +include $(JACK_RUN_TEST) + +### aput ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aput +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput/Test_aput.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput/jm/T_aput_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput/jm/T_aput_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput/jm/T_aput_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput/jm/T_aput_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput/jm/T_aput_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput/jm/T_aput_6.java +JACKTEST_JUNIT := com.android.jack.opcodes.aput.Test_aput + +include $(JACK_RUN_TEST) + +### if_gez ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_gez +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_gez/Test_if_gez.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_gez/jm/T_if_gez_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_gez/jm/T_if_gez_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_gez.Test_if_gez + +include $(JACK_RUN_TEST) + +### check_cast ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-check_cast +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/check_cast/Test_check_cast.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/check_cast/jm/T_check_cast_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.check_cast.Test_check_cast + +include $(JACK_RUN_TEST) + +### cmpl_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-cmpl_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmpl_double/Test_cmpl_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmpl_double/jm/T_cmpl_double_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.cmpl_double.Test_cmpl_double + +include $(JACK_RUN_TEST) + +### double_to_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-double_to_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_int/Test_double_to_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_int/jm/T_double_to_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.double_to_int.Test_double_to_int + +include $(JACK_RUN_TEST) + +### int_to_byte ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-int_to_byte +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_byte/Test_int_to_byte.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_byte/jm/T_int_to_byte_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.int_to_byte.Test_int_to_byte + +include $(JACK_RUN_TEST) + +### shl_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-shl_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/shl_int/Test_shl_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/shl_int/jm/T_shl_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.shl_int.Test_shl_int + +include $(JACK_RUN_TEST) + +### long_to_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-long_to_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_double/Test_long_to_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_double/jm/T_long_to_double_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.long_to_double.Test_long_to_double + +include $(JACK_RUN_TEST) + +### if_ge ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_ge +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_ge/Test_if_ge.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_ge/jm/T_if_ge_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_ge/jm/T_if_ge_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_ge.Test_if_ge + +include $(JACK_RUN_TEST) + +### opc_new ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-opc_new +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_new/Test_opc_new.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_new/jm/TestStubs.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_new/jm/T_opc_new_9.java +JACKTEST_JUNIT := com.android.jack.opcodes.opc_new.Test_opc_new + +include $(JACK_RUN_TEST) + +### add_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-add_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/add_float/Test_add_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/add_float/jm/T_add_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_float/jm/T_add_float_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_float/jm/T_add_float_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.add_float.Test_add_float + +include $(JACK_RUN_TEST) + +### cmp_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-cmp_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmp_long/Test_cmp_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/cmp_long/jm/T_cmp_long_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.cmp_long.Test_cmp_long + +include $(JACK_RUN_TEST) + +### opc_instanceof ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-opc_instanceof +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_instanceof/Test_opc_instanceof.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_instanceof/jm/TestStubs.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_instanceof/jm/T_opc_instanceof_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.opc_instanceof.Test_opc_instanceof + +include $(JACK_RUN_TEST) + +### int_to_char ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-int_to_char +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_char/Test_int_to_char.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_char/jm/T_int_to_char_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.int_to_char.Test_int_to_char + +include $(JACK_RUN_TEST) + +### aget_short ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aget_short +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_short/Test_aget_short.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_short/jm/T_aget_short_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.aget_short.Test_aget_short + +include $(JACK_RUN_TEST) + +### and_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-and_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/and_int/Test_and_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/and_int/jm/T_and_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/and_int/jm/T_and_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/and_int/jm/T_and_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.and_int.Test_and_int + +include $(JACK_RUN_TEST) + +### if_eqz ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_eqz +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_eqz/Test_if_eqz.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_eqz/jm/T_if_eqz_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_eqz.Test_if_eqz + +include $(JACK_RUN_TEST) + +### opc_goto ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-opc_goto +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_goto/Test_opc_goto.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_goto/jm/T_opc_goto_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.opc_goto.Test_opc_goto + +include $(JACK_RUN_TEST) + +### if_gtz ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_gtz +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_gtz/Test_if_gtz.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_gtz/jm/T_if_gtz_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_gtz/jm/T_if_gtz_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_gtz.Test_if_gtz + +include $(JACK_RUN_TEST) + +### or_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-or_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/or_int/Test_or_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/or_int/jm/T_or_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/or_int/jm/T_or_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/or_int/jm/T_or_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.or_int.Test_or_int + +include $(JACK_RUN_TEST) + +### int_to_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-int_to_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_double/Test_int_to_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_double/jm/T_int_to_double_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.int_to_double.Test_int_to_double + +include $(JACK_RUN_TEST) + +### xor_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-xor_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/xor_long/Test_xor_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.xor_long.Test_xor_long + +include $(JACK_RUN_TEST) + +### rem_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-rem_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/rem_int/Test_rem_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/rem_int/jm/T_rem_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.rem_int.Test_rem_int + +include $(JACK_RUN_TEST) + +### opc_throw ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-opc_throw +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_throw/Test_opc_throw.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_12.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_throw/jm/T_opc_throw_8.java +JACKTEST_JUNIT := com.android.jack.opcodes.opc_throw.Test_opc_throw + +include $(JACK_RUN_TEST) + +### shr_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-shr_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/shr_long/Test_shr_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/shr_long/jm/T_shr_long_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.shr_long.Test_shr_long + +include $(JACK_RUN_TEST) + +### cmpg_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-cmpg_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmpg_double/Test_cmpg_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmpg_double/jm/T_cmpg_double_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/cmpg_double/jm/T_cmpg_double_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.cmpg_double.Test_cmpg_double + +include $(JACK_RUN_TEST) + +### mul_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-mul_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/mul_double/Test_mul_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/mul_double/jm/T_mul_double_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.mul_double.Test_mul_double + +include $(JACK_RUN_TEST) + +### cmpg_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-cmpg_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmpg_float/Test_cmpg_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmpg_float/jm/T_cmpg_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/cmpg_float/jm/T_cmpg_float_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.cmpg_float.Test_cmpg_float + +include $(JACK_RUN_TEST) + +### mul_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-mul_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/mul_int/Test_mul_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/mul_int/jm/T_mul_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.mul_int.Test_mul_int + +include $(JACK_RUN_TEST) + +### neg_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-neg_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/neg_float/Test_neg_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/neg_float/jm/T_neg_float_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.neg_float.Test_neg_float + +include $(JACK_RUN_TEST) + +### div_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-div_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/div_double/Test_div_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/div_double/jm/T_div_double_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/div_double/jm/T_div_double_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/div_double/jm/T_div_double_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.div_double.Test_div_double + +include $(JACK_RUN_TEST) + +### monitor_enter ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-monitor_enter +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/monitor_enter/Test_monitor_enter.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/monitor_enter/jm/T_monitor_enter_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.monitor_enter.Test_monitor_enter + +include $(JACK_RUN_TEST) + +### and_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-and_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/and_long/Test_and_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/and_long/jm/T_and_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/and_long/jm/T_and_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/and_long/jm/T_and_long_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.and_long.Test_and_long + +include $(JACK_RUN_TEST) + +### if_ltz ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_ltz +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_ltz/Test_if_ltz.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_ltz/jm/T_if_ltz_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_ltz/jm/T_if_ltz_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_ltz.Test_if_ltz + +include $(JACK_RUN_TEST) + +### sparse_switch ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-sparse_switch +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sparse_switch/Test_sparse_switch.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sparse_switch/jm/T_sparse_switch_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.sparse_switch.Test_sparse_switch + +include $(JACK_RUN_TEST) + +### sget ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-sget +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sget/TestStubs.java $(JACK_PATH)/tests/com/android/jack/opcodes/sget/Test_sget.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sget/jm/TestStubs.java $(JACK_PATH)/tests/com/android/jack/opcodes/sget/jm/T_sget_11.java $(JACK_PATH)/tests/com/android/jack/opcodes/sget/jm/T_sget_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/sget/jm/T_sget_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/sget/jm/T_sget_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/sget/jm/T_sget_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/sget/jm/T_sget_9.java +JACKTEST_JUNIT := com.android.jack.opcodes.sget.Test_sget + +include $(JACK_RUN_TEST) + +### ushr_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-ushr_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/ushr_long/Test_ushr_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.ushr_long.Test_ushr_long + +include $(JACK_RUN_TEST) + +### const_wide ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-const_wide +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/const_wide/Test_const_wide.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_6.java $(JACK_PATH)/tests/com/android/jack/opcodes/const_wide/jm/T_const_wide_7.java +JACKTEST_JUNIT := com.android.jack.opcodes.const_wide.Test_const_wide + +include $(JACK_RUN_TEST) + +### aget ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aget +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget/Test_aget.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget/jm/T_aget_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget/jm/T_aget_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget/jm/T_aget_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget/jm/T_aget_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget/jm/T_aget_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget/jm/T_aget_6.java +JACKTEST_JUNIT := com.android.jack.opcodes.aget.Test_aget + +include $(JACK_RUN_TEST) + +### iput ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-iput +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/iput/Test_iput.java $(JACK_PATH)/tests/com/android/jack/opcodes/iput/TIput.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/iput/jm/TestStubs.java $(JACK_PATH)/tests/com/android/jack/opcodes/iput/jm/T_iput_12.java $(JACK_PATH)/tests/com/android/jack/opcodes/iput/jm/T_iput_14.java $(JACK_PATH)/tests/com/android/jack/opcodes/iput/jm/T_iput_16.java $(JACK_PATH)/tests/com/android/jack/opcodes/iput/jm/T_iput_18.java $(JACK_PATH)/tests/com/android/jack/opcodes/iput/jm/T_iput_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/iput/jm/T_iput_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.iput.Test_iput + +include $(JACK_RUN_TEST) + +### sput ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-sput +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sput/TestStubs.java $(JACK_PATH)/tests/com/android/jack/opcodes/sput/Test_sput.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sput/jm/TestStubs.java $(JACK_PATH)/tests/com/android/jack/opcodes/sput/jm/T_sput_13.java $(JACK_PATH)/tests/com/android/jack/opcodes/sput/jm/T_sput_14.java $(JACK_PATH)/tests/com/android/jack/opcodes/sput/jm/T_sput_16.java $(JACK_PATH)/tests/com/android/jack/opcodes/sput/jm/T_sput_18.java $(JACK_PATH)/tests/com/android/jack/opcodes/sput/jm/T_sput_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/sput/jm/T_sput_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/sput/jm/T_sput_6.java +JACKTEST_JUNIT := com.android.jack.opcodes.sput.Test_sput + +include $(JACK_RUN_TEST) + +### return_object ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-return_object +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/Test_return_object.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/Runner.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/RunnerGenerator.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/T_return_object_12.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/T_return_object_13.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/T_return_object_15.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/T_return_object_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/T_return_object_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/T_return_object_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/T_return_object_6.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/T_return_object_7.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/T_return_object_9.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_object/jm/TetsStubs.java +JACKTEST_JUNIT := com.android.jack.opcodes.return_object.Test_return_object + +include $(JACK_RUN_TEST) + +### invoke_virtual ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-invoke_virtual +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/TProtected.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/Test_invoke_virtual.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/ATest.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_13.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_14.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_17.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_19.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_22.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_23.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/T_invoke_virtual_7.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/TPlain.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/TSuper2.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_virtual/jm/TSuper.java +JACKTEST_JUNIT := com.android.jack.opcodes.invoke_virtual.Test_invoke_virtual + +include $(JACK_RUN_TEST) + +### aget_object ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aget_object +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_object/Test_aget_object.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_6.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_7.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_8.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_object/jm/T_aget_object_9.java +JACKTEST_JUNIT := com.android.jack.opcodes.aget_object.Test_aget_object + +include $(JACK_RUN_TEST) + +### neg_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-neg_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/neg_double/Test_neg_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/neg_double/jm/T_neg_double_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.neg_double.Test_neg_double + +include $(JACK_RUN_TEST) + +### int_to_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-int_to_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_float/Test_int_to_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/int_to_float/jm/T_int_to_float_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.int_to_float.Test_int_to_float + +include $(JACK_RUN_TEST) + +### invoke_static ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-invoke_static +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/TestStubs.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/Test_invoke_static.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/TestClassAbstract.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/TestClassInitError.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/TestClass.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_12.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_13.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_14.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_15.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_18.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_20.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_6.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_7.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_static/jm/T_invoke_static_8.java +JACKTEST_JUNIT := com.android.jack.opcodes.invoke_static.Test_invoke_static + +include $(JACK_RUN_TEST) + +### rem_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-rem_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/rem_long/Test_rem_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/rem_long/jm/T_rem_long_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.rem_long.Test_rem_long + +include $(JACK_RUN_TEST) + +### aget_wide ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aget_wide +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_wide/Test_aget_wide.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/aget_wide/jm/T_aget_wide_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.aget_wide.Test_aget_wide + +include $(JACK_RUN_TEST) + +### float_to_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-float_to_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_double/Test_float_to_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_double/jm/T_float_to_double_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.float_to_double.Test_float_to_double + +include $(JACK_RUN_TEST) + +### if_lt ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_lt +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_lt/Test_if_lt.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_lt/jm/T_if_lt_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_lt/jm/T_if_lt_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_lt.Test_if_lt + +include $(JACK_RUN_TEST) + +### double_to_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-double_to_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_float/Test_double_to_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_float/jm/T_double_to_float_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.double_to_float.Test_double_to_float + +include $(JACK_RUN_TEST) + +### double_to_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-double_to_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_long/Test_double_to_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/double_to_long/jm/T_double_to_long_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.double_to_long.Test_double_to_long + +include $(JACK_RUN_TEST) + +### return_wide ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-return_wide +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/Test_return_wide.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_6.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_7.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_8.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_9.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_10.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_11.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_12.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_13.java $(JACK_PATH)/tests/com/android/jack/opcodes/return_wide/jm/T_return_wide_14.java +JACKTEST_JUNIT := com.android.jack.opcodes.return_wide.Test_return_wide + +include $(JACK_RUN_TEST) + +### add_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-add_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/add_long/Test_add_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/add_long/jm/T_add_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_long/jm/T_add_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_long/jm/T_add_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_long/jm/T_add_long_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.add_long.Test_add_long + +include $(JACK_RUN_TEST) + +### sub_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-sub_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sub_long/Test_sub_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/sub_long/jm/T_sub_long_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.sub_long.Test_sub_long + +include $(JACK_RUN_TEST) + +### shl_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-shl_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/shl_long/Test_shl_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/shl_long/jm/T_shl_long_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.shl_long.Test_shl_long + +include $(JACK_RUN_TEST) + +### aput_byte ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aput_byte +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_byte/Test_aput_byte.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_byte/jm/T_aput_byte_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.aput_byte.Test_aput_byte + +include $(JACK_RUN_TEST) + +### aget_char ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aget_char +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_char/Test_aget_char.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_char/jm/T_aget_char_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.aget_char.Test_aget_char + +include $(JACK_RUN_TEST) + +### const4_16 ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-const4_16 +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/Test_const4_16.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_6.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_7.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_8.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_9.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_10.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_11.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_12.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_13.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_14.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_15.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_16.java $(JACK_PATH)/tests/com/android/jack/opcodes/const4_16/jm/T_const4_16_17.java +JACKTEST_JUNIT := com.android.jack.opcodes.const4_16.Test_const4_16 + +include $(JACK_RUN_TEST) + +### sub_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-sub_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sub_int/Test_sub_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/sub_int/jm/T_sub_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.sub_int.Test_sub_int + +include $(JACK_RUN_TEST) + +### neg_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-neg_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/neg_long/Test_neg_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/neg_long/jm/T_neg_long_6.java +JACKTEST_JUNIT := com.android.jack.opcodes.neg_long.Test_neg_long + +include $(JACK_RUN_TEST) + +### opc_return ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-opc_return +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/Test_opc_return.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_6.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_7.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_8.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_9.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_10.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_11.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_12.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_13.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_14.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_return/jm/T_opc_return_15.java +JACKTEST_JUNIT := com.android.jack.opcodes.opc_return.Test_opc_return + +include $(JACK_RUN_TEST) + +### long_to_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-long_to_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_float/Test_long_to_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_float/jm/T_long_to_float_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.long_to_float.Test_long_to_float + +include $(JACK_RUN_TEST) + +### if_le ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_le +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_le/Test_if_le.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_le/jm/T_if_le_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_le/jm/T_if_le_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_le.Test_if_le + +include $(JACK_RUN_TEST) + +### aget_byte ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aget_byte +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_byte/Test_aget_byte.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aget_byte/jm/T_aget_byte_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.aget_byte.Test_aget_byte + +include $(JACK_RUN_TEST) + +### iget ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-iget +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/iget/Test_iget.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/iget/jm/TestStubs.java $(JACK_PATH)/tests/com/android/jack/opcodes/iget/jm/T_iget_11.java $(JACK_PATH)/tests/com/android/jack/opcodes/iget/jm/T_iget_15.java $(JACK_PATH)/tests/com/android/jack/opcodes/iget/jm/T_iget_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/iget/jm/T_iget_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/iget/jm/T_iget_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/iget/jm/T_iget_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/iget/jm/T_iget_6.java +JACKTEST_JUNIT := com.android.jack.opcodes.iget.Test_iget + +include $(JACK_RUN_TEST) + +### aput_char ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aput_char +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_char/Test_aput_char.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput_char/jm/T_aput_char_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.aput_char.Test_aput_char + +include $(JACK_RUN_TEST) + +### div_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-div_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/div_float/Test_div_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/div_float/jm/T_div_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/div_float/jm/T_div_float_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/div_float/jm/T_div_float_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.div_float.Test_div_float + +include $(JACK_RUN_TEST) + +### if_nez ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_nez +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_nez/Test_if_nez.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_nez/jm/T_if_nez_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_nez.Test_if_nez + +include $(JACK_RUN_TEST) + +### div_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-div_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/div_int/Test_div_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/div_int/jm/T_div_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/div_int/jm/T_div_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/div_int/jm/T_div_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.div_int.Test_div_int + +include $(JACK_RUN_TEST) + +### float_to_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-float_to_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_int/Test_float_to_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/float_to_int/jm/T_float_to_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.float_to_int.Test_float_to_int + +include $(JACK_RUN_TEST) + +### long_to_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-long_to_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_int/Test_long_to_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/long_to_int/jm/T_long_to_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.long_to_int.Test_long_to_int + +include $(JACK_RUN_TEST) + +### cmpl_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-cmpl_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmpl_float/Test_cmpl_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/cmpl_float/jm/T_cmpl_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/cmpl_float/jm/T_cmpl_float_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.cmpl_float.Test_cmpl_float + +include $(JACK_RUN_TEST) + +### shr_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-shr_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/shr_int/Test_shr_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/shr_int/jm/T_shr_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.shr_int.Test_shr_int + +include $(JACK_RUN_TEST) + +### if_eq ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_eq +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_eq/Test_if_eq.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_eq/jm/T_if_eq_3.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_eq.Test_if_eq + +include $(JACK_RUN_TEST) + +### add_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-add_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/Test_add_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/jm/T_add_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/jm/T_add_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/jm/T_add_int_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/jm/T_add_int_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/jm/T_add_int_6.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/jm/T_add_int_7.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/jm/T_add_int_8.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/jm/T_add_int_9.java $(JACK_PATH)/tests/com/android/jack/opcodes/add_int/jm/T_add_int_10.java +JACKTEST_JUNIT := com.android.jack.opcodes.add_int.Test_add_int + +include $(JACK_RUN_TEST) + +### or_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-or_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/or_long/Test_or_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/or_long/jm/T_or_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/or_long/jm/T_or_long_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/or_long/jm/T_or_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/or_long/jm/T_or_long_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.or_long.Test_or_long + +include $(JACK_RUN_TEST) + +### mul_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-mul_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/mul_long/Test_mul_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/mul_long/jm/T_mul_long_6.java +JACKTEST_JUNIT := com.android.jack.opcodes.mul_long.Test_mul_long + +include $(JACK_RUN_TEST) + +### if_lez ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_lez +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_lez/Test_if_lez.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_lez/jm/T_if_lez_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_lez/jm/T_if_lez_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_lez.Test_if_lez + +include $(JACK_RUN_TEST) + +### sub_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-sub_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sub_float/Test_sub_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/sub_float/jm/T_sub_float_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.sub_float.Test_sub_float + +include $(JACK_RUN_TEST) + +### rem_double ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-rem_double +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/rem_double/Test_rem_double.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/rem_double/jm/T_rem_double_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.rem_double.Test_rem_double + +include $(JACK_RUN_TEST) + +### neg_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-neg_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/neg_int/Test_neg_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/neg_int/jm/T_neg_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/neg_int/jm/T_neg_int_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.neg_int.Test_neg_int + +include $(JACK_RUN_TEST) + +### aput_wide ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aput_wide +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_wide/Test_aput_wide.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput_wide/jm/T_aput_wide_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.aput_wide.Test_aput_wide + +include $(JACK_RUN_TEST) + +### div_long ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-div_long +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/div_long/Test_div_long.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/div_long/jm/T_div_long_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/div_long/jm/T_div_long_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/div_long/jm/T_div_long_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/div_long/jm/T_div_long_6.java +JACKTEST_JUNIT := com.android.jack.opcodes.div_long.Test_div_long + +include $(JACK_RUN_TEST) + +### xor_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-xor_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/xor_int/Test_xor_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.xor_int.Test_xor_int + +include $(JACK_RUN_TEST) + +### aput_object ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aput_object +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_object/Test_aput_object.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_object/jm/T_aput_object_10.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput_object/jm/T_aput_object_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.aput_object.Test_aput_object + +include $(JACK_RUN_TEST) + +### new_array ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-new_array +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/new_array/Test_new_array.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/new_array/jm/T_new_array_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/new_array/jm/T_new_array_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/new_array/jm/T_new_array_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/new_array/jm/T_new_array_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/new_array/jm/T_new_array_5.java $(JACK_PATH)/tests/com/android/jack/opcodes/new_array/jm/T_new_array_6.java +JACKTEST_JUNIT := com.android.jack.opcodes.new_array.Test_new_array + +include $(JACK_RUN_TEST) + +### aput_short ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-aput_short +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_short/Test_aput_short.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_4.java $(JACK_PATH)/tests/com/android/jack/opcodes/aput_short/jm/T_aput_short_5.java +JACKTEST_JUNIT := com.android.jack.opcodes.aput_short.Test_aput_short + +include $(JACK_RUN_TEST) + + +### if_ne ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_ne +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_ne/Test_if_ne.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_ne/jm/T_if_ne_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_ne/jm/T_if_ne_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_ne.Test_if_ne + +include $(JACK_RUN_TEST) + +### rem_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-rem_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/rem_float/Test_rem_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/rem_float/jm/T_rem_float_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.rem_float.Test_rem_float + +include $(JACK_RUN_TEST) + +### ushr_int ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-ushr_int +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/ushr_int/Test_ushr_int.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.ushr_int.Test_ushr_int + +include $(JACK_RUN_TEST) + +### invoke_interface ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-invoke_interface +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/Test_invoke_interface.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/ITestImplAbstract.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/ITestImpl.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/ITest.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_12.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_14.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_17.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_19.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_23.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_interface/jm/T_invoke_interface_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.invoke_interface.Test_invoke_interface + +include $(JACK_RUN_TEST) + +### mul_float ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-mul_float +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/mul_float/Test_mul_float.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_3.java $(JACK_PATH)/tests/com/android/jack/opcodes/mul_float/jm/T_mul_float_4.java +JACKTEST_JUNIT := com.android.jack.opcodes.mul_float.Test_mul_float + +include $(JACK_RUN_TEST) + +### if_gt ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-if_gt +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_gt/Test_if_gt.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/if_gt/jm/T_if_gt_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/if_gt/jm/T_if_gt_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.if_gt.Test_if_gt + +include $(JACK_RUN_TEST) + +### packed_switch ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-packed_switch +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/packed_switch/Test_packed_switch.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/packed_switch/jm/T_packed_switch_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.packed_switch.Test_packed_switch + +include $(JACK_RUN_TEST) + +### const_string ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-const_string +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/const_string/Test_const_string.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/const_string/jm/T_const_string_1.java +JACKTEST_JUNIT := com.android.jack.opcodes.const_string.Test_const_string + +include $(JACK_RUN_TEST) + +### opc_const ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-opc_const +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_const/Test_opc_const.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/opc_const/jm/T_opc_const_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/opc_const/jm/T_opc_const_2.java +JACKTEST_JUNIT := com.android.jack.opcodes.opc_const.Test_opc_const + +include $(JACK_RUN_TEST) + +### invoke_super ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-invoke_super +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_super/Test_invoke_super.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_1.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_14.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_15.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_18.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_19.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_super/jm/T_invoke_super_26.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_super/jm/TSuper2.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_super/jm/TSuper.java +JACKTEST_JUNIT := com.android.jack.opcodes.invoke_super.Test_invoke_super + +include $(JACK_RUN_TEST) + +### invoke_direct ### + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := opcode-invoke_direct +JACKTEST_WITHDX_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_direct/Test_invoke_direct.java $(JACK_PATH)/src/com/android/jack/DxTestCase.java +JACKTEST_WITHJACK_SRC := $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_direct/jm/T_invoke_direct_2.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_direct/jm/T_invoke_direct_21.java $(JACK_PATH)/tests/com/android/jack/opcodes/invoke_direct/jm/TSuper.java +JACKTEST_JUNIT := com.android.jack.opcodes.invoke_direct.Test_invoke_direct + +include $(JACK_RUN_TEST) + diff --git a/jack-tests/tests/com/android/jack/opcodes/ushr_int/Test_ushr_int.java b/jack-tests/tests/com/android/jack/opcodes/ushr_int/Test_ushr_int.java new file mode 100644 index 0000000..32d184d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/ushr_int/Test_ushr_int.java @@ -0,0 +1,115 @@ +/* + * 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.jack.opcodes.ushr_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.ushr_int.jm.T_ushr_int_1; +import com.android.jack.opcodes.ushr_int.jm.T_ushr_int_3; +import com.android.jack.opcodes.ushr_int.jm.T_ushr_int_4; + + +public class Test_ushr_int extends DxTestCase { + + /** + * @title 15 >> 1 + */ + public void testN1() { + T_ushr_int_1 t = new T_ushr_int_1(); + assertEquals(7, t.run(15, 1)); + } + + /** + * @title 33 >> 2 + */ + public void testN2() { + T_ushr_int_1 t = new T_ushr_int_1(); + assertEquals(8, t.run(33, 2)); + } + + /** + * @title -15 >> 1 + */ + public void testN3() { + T_ushr_int_1 t = new T_ushr_int_1(); + assertEquals(0x7FFFFFF8, t.run(-15, 1)); + } + + /** + * @title Arguments = 1 & -1 + */ + public void testN4() { + T_ushr_int_1 t = new T_ushr_int_1(); + assertEquals(0, t.run(1, -1)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 32. + */ + public void testN5() { + T_ushr_int_1 t = new T_ushr_int_1(); + assertEquals(16, t.run(33, 33)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 32. + */ + public void testN6() { + T_ushr_int_3 t = new T_ushr_int_3(); + assertEquals(16, t.run(33, 33)); + } + + /** + * @title Verify that shift distance is actually in range 0 to 32. + */ + public void testN7() { + T_ushr_int_4 t = new T_ushr_int_4(); + assertEquals(16, t.run(33, 33)); + } + + /** + * @title Arguments = 0 & -1 + */ + public void testB1() { + T_ushr_int_1 t = new T_ushr_int_1(); + assertEquals(0, t.run(0, -1)); + } + + /** + * @title Arguments = Integer.MAX_VALUE & 1 + */ + public void testB2() { + T_ushr_int_1 t = new T_ushr_int_1(); + assertEquals(0x3FFFFFFF, t.run(Integer.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Integer.MIN_VALUE & 1 + */ + public void testB3() { + T_ushr_int_1 t = new T_ushr_int_1(); + assertEquals(0x40000000, t.run(Integer.MIN_VALUE, 1)); + } + + /** + * @title Arguments = 1 & 0 + */ + public void testB4() { + T_ushr_int_1 t = new T_ushr_int_1(); + assertEquals(1, t.run(1, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_1.java b/jack-tests/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_1.java new file mode 100644 index 0000000..b5f4f85 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.ushr_int.jm; + +public class T_ushr_int_1 { + + public int run(int a, int b) { + return a >>> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_3.java b/jack-tests/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_3.java new file mode 100644 index 0000000..ae65dc6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.ushr_int.jm; + +public class T_ushr_int_3 { + + public int run(double a, int b) { + return (int)a >>> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_4.java b/jack-tests/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_4.java new file mode 100644 index 0000000..139be9d --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/ushr_int/jm/T_ushr_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.ushr_int.jm; + +public class T_ushr_int_4 { + + public int run(int a, long b) { + return a >>> (int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/ushr_long/Test_ushr_long.java b/jack-tests/tests/com/android/jack/opcodes/ushr_long/Test_ushr_long.java new file mode 100644 index 0000000..27c60e5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/ushr_long/Test_ushr_long.java @@ -0,0 +1,132 @@ +/* + * 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.jack.opcodes.ushr_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.ushr_long.jm.T_ushr_long_1; +import com.android.jack.opcodes.ushr_long.jm.T_ushr_long_3; +import com.android.jack.opcodes.ushr_long.jm.T_ushr_long_4; +import com.android.jack.opcodes.ushr_long.jm.T_ushr_long_5; + + +public class Test_ushr_long extends DxTestCase { + + /** + * @title Arguments = 40000000000l, 3 + */ + public void testN1() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(5000000000l, t.run(40000000000l, 3)); + } + + /** + * @title Arguments = 40000000000l, 1 + */ + public void testN2() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(20000000000l, t.run(40000000000l, 1)); + } + + /** + * @title Arguments = -123456789l, 1 + */ + public void testN3() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(0x7FFFFFFFFC521975l, t.run(-123456789l, 1)); + } + + /** + * @title Arguments = 1, -1 + */ + public void testN4() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(0l, t.run(1l, -1)); + } + + /** + * @title Arguments = 123456789l, 64 + */ + public void testN5() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(123456789l, t.run(123456789l, 64)); + } + + /** + * @title Arguments = 123456789l, 63 + */ + public void testN6() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(0l, t.run(123456789l, 63)); + } + + /** + * @title Arguments = 123456789l, 63 + */ + public void testN7() { + T_ushr_long_3 t = new T_ushr_long_3(); + assertEquals(0l, t.run(123456789l, 63)); + } + + /** + * @title Arguments = 123456789l, 63 + */ + public void testN8() { + T_ushr_long_4 t = new T_ushr_long_4(); + assertEquals(0l, t.run(123456789, 63)); + } + + /** + * @title Arguments = 123456789l, 63 + */ + public void testN9() { + T_ushr_long_5 t = new T_ushr_long_5(); + assertEquals(0l, t.run(123456789l, 63)); + } + + /** + * @title Arguments = 0, -1 + */ + public void testB1() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(0l, t.run(0l, -1)); + } + + /** + * @title Arguments = Long.MAX_VALUE, 1 + */ + public void testB2() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(0x3FFFFFFFFFFFFFFFl, t.run(Long.MAX_VALUE, 1)); + } + + /** + * @title Arguments = Long.MIN_VALUE, 1 + */ + public void testB3() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(0x4000000000000000l, t.run(Long.MIN_VALUE, 1)); + } + + /** + * @title Arguments = 1, 0 + */ + public void testB4() { + T_ushr_long_1 t = new T_ushr_long_1(); + assertEquals(1l, t.run(1l, 0)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_1.java b/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_1.java new file mode 100644 index 0000000..079509b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.ushr_long.jm; + +public class T_ushr_long_1 { + + public long run(long a, int b) { + return a >>> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_3.java b/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_3.java new file mode 100644 index 0000000..d2b4a3b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.ushr_long.jm; + +public class T_ushr_long_3 { + + public long run(double a, int b) { + return (long)a >>> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_4.java b/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_4.java new file mode 100644 index 0000000..37ed737 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.ushr_long.jm; + +public class T_ushr_long_4 { + + public long run(int a, int b) { + return a >>> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_5.java b/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_5.java new file mode 100644 index 0000000..44461ec --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/ushr_long/jm/T_ushr_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.ushr_long.jm; + +public class T_ushr_long_5 { + + public long run(float a, int b) { + return (long)a >>> b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/xor_int/Test_xor_int.java b/jack-tests/tests/com/android/jack/opcodes/xor_int/Test_xor_int.java new file mode 100644 index 0000000..aa56f21 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/xor_int/Test_xor_int.java @@ -0,0 +1,83 @@ +/* + * 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.jack.opcodes.xor_int; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.xor_int.jm.T_xor_int_1; +import com.android.jack.opcodes.xor_int.jm.T_xor_int_3; +import com.android.jack.opcodes.xor_int.jm.T_xor_int_4; + + +public class Test_xor_int extends DxTestCase { + + /** + * @title Arguments = 15, 8 + */ + public void testN1() { + T_xor_int_1 t = new T_xor_int_1(); + assertEquals(7, t.run(15, 8)); + } + + /** + * @title Arguments = 0xfffffff8, 0xfffffff1 + */ + public void testN2() { + T_xor_int_1 t = new T_xor_int_1(); + assertEquals(9, t.run(0xfffffff8, 0xfffffff1)); + } + + /** + * @title Arguments = 0xcafe & -1 + */ + public void testN3() { + T_xor_int_1 t = new T_xor_int_1(); + assertEquals(0xFFFF3501, t.run(0xcafe, -1)); + } + + /** + * @title Arguments = 0xcafe & -1 + */ + public void testN4() { + T_xor_int_3 t = new T_xor_int_3(); + assertEquals(0xFFFF3501, t.run(0xcafe, -1)); + } + + /** + * @title Arguments = 0xcafe & -1 + */ + public void testN5() { + T_xor_int_4 t = new T_xor_int_4(); + assertEquals(0xFFFF3501, t.run(0xcafe, -1)); + } + + /** + * @title Arguments = 0 & -1 + */ + public void testB1() { + T_xor_int_1 t = new T_xor_int_1(); + assertEquals(-1, t.run(0, -1)); + } + + /** + * @title Arguments = Integer.MAX_VALUE & Integer.MIN_VALUE + */ + public void testB2() { + T_xor_int_1 t = new T_xor_int_1(); + assertEquals(0xffffffff, t.run(Integer.MAX_VALUE, Integer.MIN_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_1.java b/jack-tests/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_1.java new file mode 100644 index 0000000..6cd1ba0 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.xor_int.jm; + +public class T_xor_int_1 { + + public int run(int a, int b) { + return a ^ b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_3.java b/jack-tests/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_3.java new file mode 100644 index 0000000..101a987 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.xor_int.jm; + +public class T_xor_int_3 { + + public int run(double a, int b) { + return (int)a ^ b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_4.java b/jack-tests/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_4.java new file mode 100644 index 0000000..b1753e5 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/xor_int/jm/T_xor_int_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.xor_int.jm; + +public class T_xor_int_4 { + + public int run(int a, long b) { + return a ^ (int)b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/xor_long/Test_xor_long.java b/jack-tests/tests/com/android/jack/opcodes/xor_long/Test_xor_long.java new file mode 100644 index 0000000..f6245ab --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/xor_long/Test_xor_long.java @@ -0,0 +1,100 @@ +/* + * 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.jack.opcodes.xor_long; + +import com.android.jack.DxTestCase; +import com.android.jack.opcodes.xor_long.jm.T_xor_long_1; +import com.android.jack.opcodes.xor_long.jm.T_xor_long_3; +import com.android.jack.opcodes.xor_long.jm.T_xor_long_4; +import com.android.jack.opcodes.xor_long.jm.T_xor_long_5; + + +public class Test_xor_long extends DxTestCase { + + /** + * @title Arguments = 23423432423777l, 23423432423778l + */ + public void testN1() { + T_xor_long_1 t = new T_xor_long_1(); + assertEquals(3, t.run(23423432423777l, 23423432423778l)); + } + + /** + * @title Arguments = 0xfffffff5, 0xfffffff1 + */ + public void testN2() { + T_xor_long_1 t = new T_xor_long_1(); + assertEquals(4, t.run(0xfffffff5, 0xfffffff1)); + } + + /** + * @title Arguments = 0xABCDEFAB & -1 + */ + public void testN3() { + T_xor_long_1 t = new T_xor_long_1(); + assertEquals(0x54321054, t.run(0xABCDEFAB, -1l)); + } + + /** + * @title Arguments = 0xABCDEFAB & -1 + */ + public void testN4() { + T_xor_long_3 t = new T_xor_long_3(); + assertEquals(0x54321054, t.run(0xABCDEFAB, -1l)); + } + + /** + * @title Arguments = 0xABCDEFAB & -1 + */ + public void testN5() { + T_xor_long_4 t = new T_xor_long_4(); + assertEquals(0x54321054, t.run(0xABCDEFAB, -1l)); + } + + /** + * @title Arguments = 0xABCDEFAB & -1 + */ + public void testN6() { + T_xor_long_5 t = new T_xor_long_5(); + assertEquals(0x5432107F, t.run(0xABCDEFAB, -1l)); + } + + /** + * @title Arguments = 0 & -1 + */ + public void testB1() { + T_xor_long_1 t = new T_xor_long_1(); + assertEquals(-1l, t.run(0l, -1l)); + } + + /** + * @title Arguments = Long.MAX_VALUE & Long.MIN_VALUE + */ + public void testB2() { + T_xor_long_1 t = new T_xor_long_1(); + assertEquals(0xffffffff, t.run(Long.MAX_VALUE, Long.MIN_VALUE)); + } + + /** + * @title Arguments = Long.MAX_VALUE & Long.MAX_VALUE + */ + public void testB3() { + T_xor_long_1 t = new T_xor_long_1(); + assertEquals(0l, t.run(Long.MAX_VALUE, Long.MAX_VALUE)); + } + +} diff --git a/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_1.java b/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_1.java new file mode 100644 index 0000000..5603cc2 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_1.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.xor_long.jm; + +public class T_xor_long_1 { + + public long run(long a, long b) { + return a ^ b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_3.java b/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_3.java new file mode 100644 index 0000000..e7c15af --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_3.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.xor_long.jm; + +public class T_xor_long_3 { + + public long run(double a, long b) { + return (long)a ^ b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_4.java b/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_4.java new file mode 100644 index 0000000..326124b --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_4.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.xor_long.jm; + +public class T_xor_long_4 { + + public long run(int a, long b) { + return a ^ b; + } +} diff --git a/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_5.java b/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_5.java new file mode 100644 index 0000000..32feea6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/opcodes/xor_long/jm/T_xor_long_5.java @@ -0,0 +1,24 @@ +/* + * 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.jack.opcodes.xor_long.jm; + +public class T_xor_long_5 { + + public long run(float a, long b) { + return (long)a ^ b; + } +} |