• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.jni.cts;
18 
19 /**
20  * Class with a bunch of static methods that get called from native
21  * code. See {@code macroized_tests.c} in {@code libjnitest} for more
22  * details.
23  */
24 public class InstanceFromNative {
25     /** convenient instance */
26     public static final InstanceFromNative theOne = new InstanceFromNative();
27 
28     /**
29      * Constructs an instance.
30      */
InstanceFromNative()31     public InstanceFromNative() {
32         // This space intentionally left blank.
33     }
34 
nop()35     public void nop() {
36         // This space intentionally left blank.
37     }
38 
returnBoolean()39     public boolean returnBoolean() {
40         return true;
41     }
42 
returnByte()43     public byte returnByte() {
44         return (byte) 14;
45     }
46 
returnShort()47     public short returnShort() {
48         return (short) -608;
49     }
50 
returnChar()51     public char returnChar() {
52         return (char) 9000;
53     }
54 
returnInt()55     public int returnInt() {
56         return 4004004;
57     }
58 
returnLong()59     public long returnLong() {
60         return -80080080087L;
61     }
62 
returnFloat()63     public float returnFloat() {
64         return 2.5e22f;
65     }
66 
returnDouble()67     public double returnDouble() {
68         return 7.503e100;
69     }
70 
returnString()71     public String returnString() {
72         return "muffins";
73     }
74 
takeOneOfEach(double v0, float v1, long v2, int v3, char v4, short v5, byte v6, boolean v7, String v8)75     public boolean takeOneOfEach(double v0, float v1, long v2, int v3,
76             char v4, short v5, byte v6, boolean v7, String v8) {
77         return (v0 == 0.0) && (v1 == 1.0f) && (v2 == 2L) && (v3 == 3)
78             && (v4 == 4) && (v5 == 5) && (v6 == 6) && v7 &&
79             v8.equals("biscuits");
80     }
81 
takeCoolHandLuke( int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15, int v16, int v17, int v18, int v19, int v20, int v21, int v22, int v23, int v24, int v25, int v26, int v27, int v28, int v29, int v30, int v31, int v32, int v33, int v34, int v35, int v36, int v37, int v38, int v39, int v40, int v41, int v42, int v43, int v44, int v45, int v46, int v47, int v48, int v49, int v50)82     public boolean takeCoolHandLuke(
83             int v1, int v2, int v3, int v4,
84             int v5, int v6, int v7, int v8, int v9,
85             int v10, int v11, int v12, int v13, int v14,
86             int v15, int v16, int v17, int v18, int v19,
87             int v20, int v21, int v22, int v23, int v24,
88             int v25, int v26, int v27, int v28, int v29,
89             int v30, int v31, int v32, int v33, int v34,
90             int v35, int v36, int v37, int v38, int v39,
91             int v40, int v41, int v42, int v43, int v44,
92             int v45, int v46, int v47, int v48, int v49,
93             int v50) {
94         return (v1 == 1) && (v2 == 2) && (v3 == 3) &&
95             (v4 == 4) && (v5 == 5) && (v6 == 6) && (v7 == 7) &&
96             (v8 == 8) && (v9 == 9) &&
97             (v10 == 10) && (v11 == 11) && (v12 == 12) && (v13 == 13) &&
98             (v14 == 14) && (v15 == 15) && (v16 == 16) && (v17 == 17) &&
99             (v18 == 18) && (v19 == 19) &&
100             (v20 == 20) && (v21 == 21) && (v22 == 22) && (v23 == 23) &&
101             (v24 == 24) && (v25 == 25) && (v26 == 26) && (v27 == 27) &&
102             (v28 == 28) && (v29 == 29) &&
103             (v30 == 30) && (v31 == 31) && (v32 == 32) && (v33 == 33) &&
104             (v34 == 34) && (v35 == 35) && (v36 == 36) && (v37 == 37) &&
105             (v38 == 38) && (v39 == 39) &&
106             (v40 == 40) && (v41 == 41) && (v42 == 42) && (v43 == 43) &&
107             (v44 == 44) && (v45 == 45) && (v46 == 46) && (v47 == 47) &&
108             (v48 == 48) && (v49 == 49) &&
109             (v50 == 50);
110     }
111 }
112