• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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.car.hardware.property;
18 
19 import static com.google.common.truth.Truth.assertThat;
20 
21 import androidx.test.filters.SmallTest;
22 
23 import com.android.compatibility.common.util.ApiTest;
24 
25 import org.junit.Test;
26 import org.junit.runner.RunWith;
27 import org.junit.runners.Parameterized;
28 
29 import java.util.Arrays;
30 import java.util.Collection;
31 
32 @SmallTest
33 @RunWith(Parameterized.class)
34 public final class VehicleIgnitionStateUnitTest {
35     private final int mJavaConstantValue;
36     private final int mHalConstantValue;
37 
VehicleIgnitionStateUnitTest(int javaConstantValue, int halConstantValue)38     public VehicleIgnitionStateUnitTest(int javaConstantValue, int halConstantValue) {
39         mJavaConstantValue = javaConstantValue;
40         mHalConstantValue = halConstantValue;
41     }
42 
43     @Parameterized.Parameters
constantValues()44     public static Collection constantValues() {
45         return Arrays.asList(new Object[][]{
46                 {android.car.VehicleIgnitionState.UNDEFINED,
47                         android.hardware.automotive.vehicle.VehicleIgnitionState.UNDEFINED},
48                 {android.car.VehicleIgnitionState.LOCK,
49                         android.hardware.automotive.vehicle.VehicleIgnitionState.LOCK},
50                 {android.car.VehicleIgnitionState.OFF,
51                         android.hardware.automotive.vehicle.VehicleIgnitionState.OFF},
52                 {android.car.VehicleIgnitionState.ACC,
53                         android.hardware.automotive.vehicle.VehicleIgnitionState.ACC},
54                 {android.car.VehicleIgnitionState.ON,
55                         android.hardware.automotive.vehicle.VehicleIgnitionState.ON},
56                 {android.car.VehicleIgnitionState.START,
57                         android.hardware.automotive.vehicle.VehicleIgnitionState.START}
58         });
59     }
60 
61     @Test
62     @ApiTest(apis = {"android.car.VehicleIgnitionState#UNDEFINED",
63             "android.car.VehicleIgnitionState#LOCK", "android.car.VehicleIgnitionState#OFF",
64             "android.car.VehicleIgnitionState#ACC", "android.car.VehicleIgnitionState#ON",
65             "android.car.VehicleIgnitionState#START"})
testMatchWithVehicleHal()66     public void testMatchWithVehicleHal() {
67         assertThat(mJavaConstantValue).isEqualTo(mHalConstantValue);
68     }
69 }
70