blob: 7b593f44445105256093ef96df8b5c0ed33aa329 [file] [log] [blame]
David Brazdil11edec72016-03-24 12:40:52 +00001/*
2 * Copyright (C) 2016 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
17import java.lang.reflect.Field;
18import java.lang.reflect.Method;
19import java.lang.reflect.InvocationTargetException;
20
21public class Main {
22 // Workaround for b/18051191.
23 class Inner {}
24
25 public static boolean field0;
26 public static boolean field1;
27 public static boolean field2;
28
29 public static void assertTrue(boolean result) {
30 if (!result) {
31 throw new Error("Expected true");
32 }
33 }
34
35 public static void assertFalse(boolean result) {
36 if (result) {
37 throw new Error("Expected false");
38 }
39 }
40
41 public static void main(String[] args) throws Throwable {
42 System.loadLibrary(args[0]);
43 Class<?> c = Class.forName("TestCase");
44 Method m = c.getMethod("testCase");
45
46 try {
47 field0 = true;
48 field1 = false;
49 assertTrue((Boolean) m.invoke(null, null));
50
51 field0 = true;
52 field1 = true;
53 assertTrue((Boolean) m.invoke(null, null));
54
55 field0 = false;
56 field1 = false;
57 assertFalse((Boolean) m.invoke(null, null));
58 } catch (Exception e) {
59 throw new Error(e);
60 }
61 }
62}