diff options
3 files changed, 0 insertions, 259 deletions
diff --git a/location/tests/locationtests/src/android/location/GnssMeasurementCorrectionsTest.java b/location/tests/locationtests/src/android/location/GnssMeasurementCorrectionsTest.java deleted file mode 100644 index ae5ca4069e5c..000000000000 --- a/location/tests/locationtests/src/android/location/GnssMeasurementCorrectionsTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.location; - -import android.os.Parcel; - -import junit.framework.TestCase; - -import java.util.ArrayList; -import java.util.List; - -/** Unit tests for {@link GnssMeasurementCorrections}. */ -public class GnssMeasurementCorrectionsTest extends TestCase { - public void testDescribeContents() { - GnssMeasurementCorrections measurementCorrections = - new GnssMeasurementCorrections.Builder().build(); - measurementCorrections.describeContents(); - } - - public void testWriteToParcel() { - GnssMeasurementCorrections.Builder measurementCorrections = - new GnssMeasurementCorrections.Builder(); - setTestValues(measurementCorrections); - Parcel parcel = Parcel.obtain(); - measurementCorrections.build().writeToParcel(parcel, 0); - parcel.setDataPosition(0); - GnssMeasurementCorrections newMeasurementCorrection = - GnssMeasurementCorrections.CREATOR.createFromParcel(parcel); - verifyTestValues(newMeasurementCorrection); - parcel.recycle(); - } - - private static void verifyTestValues(GnssMeasurementCorrections measurementCorrections) { - assertEquals(37.386051, measurementCorrections.getLatitudeDegrees()); - assertEquals(-122.083855, measurementCorrections.getLongitudeDegrees()); - assertEquals(32.0, measurementCorrections.getAltitudeMeters()); - assertEquals(9.25, measurementCorrections.getHorizontalPositionUncertaintyMeters()); - assertEquals(2.3, measurementCorrections.getVerticalPositionUncertaintyMeters()); - assertEquals(604000000000000L, measurementCorrections.getToaGpsNanosecondsOfWeek()); - - GnssSingleSatCorrection singleSatCorrection = - measurementCorrections.getSingleSatelliteCorrectionList().get(0); - GnssSingleSatCorrectionsTest.verifyTestValues(singleSatCorrection); - - singleSatCorrection = measurementCorrections.getSingleSatelliteCorrectionList().get(1); - assertEquals(15, singleSatCorrection.getSingleSatelliteCorrectionFlags()); - assertEquals(GnssStatus.CONSTELLATION_GPS, singleSatCorrection.getConstellationType()); - assertEquals(11, singleSatCorrection.getSatelliteId()); - assertEquals(1575430000f, singleSatCorrection.getCarrierFrequencyHz()); - assertEquals(0.9f, singleSatCorrection.getProbabilityLineOfSight()); - assertEquals(50.0f, singleSatCorrection.getExcessPathLengthMeters()); - assertEquals(55.0f, singleSatCorrection.getExcessPathLengthUncertaintyMeters()); - GnssReflectingPlane reflectingPlane = singleSatCorrection.getReflectingPlane(); - assertEquals(37.386054, reflectingPlane.getLatitudeDegrees()); - assertEquals(-122.083855, reflectingPlane.getLongitudeDegrees()); - assertEquals(120.0, reflectingPlane.getAltitudeMeters()); - assertEquals(153.0, reflectingPlane.getAzimuthDegrees()); - } - - private static void setTestValues(GnssMeasurementCorrections.Builder measurementCorrections) { - measurementCorrections - .setLatitudeDegrees(37.386051) - .setLongitudeDegrees(-122.083855) - .setAltitudeMeters(32) - .setHorizontalPositionUncertaintyMeters(9.25) - .setVerticalPositionUncertaintyMeters(2.3) - .setToaGpsNanosecondsOfWeek(604000000000000L); - List<GnssSingleSatCorrection> singleSatCorrectionList = new ArrayList<>(); - singleSatCorrectionList.add(GnssSingleSatCorrectionsTest.generateTestSingleSatCorrection()); - singleSatCorrectionList.add(generateTestSingleSatCorrection()); - measurementCorrections.setSingleSatelliteCorrectionList(singleSatCorrectionList); - } - - private static GnssSingleSatCorrection generateTestSingleSatCorrection() { - GnssSingleSatCorrection.Builder singleSatCorrection = new GnssSingleSatCorrection.Builder(); - singleSatCorrection - .setSingleSatelliteCorrectionFlags(8) - .setConstellationType(GnssStatus.CONSTELLATION_GPS) - .setSatelliteId(11) - .setCarrierFrequencyHz(1575430000f) - .setProbabilityLineOfSight(0.9f) - .setExcessPathLengthMeters(50.0f) - .setExcessPathLengthUncertaintyMeters(55.0f) - .setReflectingPlane(generateTestReflectingPlane()); - return singleSatCorrection.build(); - } - - private static GnssReflectingPlane generateTestReflectingPlane() { - GnssReflectingPlane.Builder reflectingPlane = - new GnssReflectingPlane.Builder() - .setLatitudeDegrees(37.386054) - .setLongitudeDegrees(-122.083855) - .setAltitudeMeters(120.0) - .setAzimuthDegrees(153); - return reflectingPlane.build(); - } -} diff --git a/location/tests/locationtests/src/android/location/GnssReflectingPlaneTest.java b/location/tests/locationtests/src/android/location/GnssReflectingPlaneTest.java deleted file mode 100644 index d7a3378e5a12..000000000000 --- a/location/tests/locationtests/src/android/location/GnssReflectingPlaneTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.location; - -import android.os.Parcel; - -import junit.framework.TestCase; - -/** Unit tests for {@link GnssReflectingPlane}. */ -public class GnssReflectingPlaneTest extends TestCase { - public void testDescribeContents() { - GnssReflectingPlane reflectingPlane = new GnssReflectingPlane.Builder().build(); - reflectingPlane.describeContents(); - } - - public void testWriteToParcel() { - GnssReflectingPlane.Builder reflectingPlane = new GnssReflectingPlane.Builder(); - setTestValues(reflectingPlane); - Parcel parcel = Parcel.obtain(); - reflectingPlane.build().writeToParcel(parcel, 0); - parcel.setDataPosition(0); - GnssReflectingPlane newReflectingPlane = - GnssReflectingPlane.CREATOR.createFromParcel(parcel); - verifyTestValues(newReflectingPlane); - parcel.recycle(); - } - - public static void verifyTestValues(GnssReflectingPlane reflectingPlane) { - assertEquals(37.386052, reflectingPlane.getLatitudeDegrees()); - assertEquals(-122.083853, reflectingPlane.getLongitudeDegrees()); - assertEquals(100.0, reflectingPlane.getAltitudeMeters()); - assertEquals(123.0, reflectingPlane.getAzimuthDegrees()); - } - - private static void setTestValues(GnssReflectingPlane.Builder reflectingPlane) { - GnssReflectingPlane refPlane = generateTestReflectingPlane(); - reflectingPlane - .setLatitudeDegrees(refPlane.getLatitudeDegrees()) - .setLongitudeDegrees(refPlane.getLongitudeDegrees()) - .setAltitudeMeters(refPlane.getAltitudeMeters()) - .setAzimuthDegrees(refPlane.getAzimuthDegrees()); - } - - public static GnssReflectingPlane generateTestReflectingPlane() { - GnssReflectingPlane.Builder reflectingPlane = - new GnssReflectingPlane.Builder() - .setLatitudeDegrees(37.386052) - .setLongitudeDegrees(-122.083853) - .setAltitudeMeters(100.0) - .setAzimuthDegrees(123.0); - return reflectingPlane.build(); - } -} diff --git a/location/tests/locationtests/src/android/location/GnssSingleSatCorrectionsTest.java b/location/tests/locationtests/src/android/location/GnssSingleSatCorrectionsTest.java deleted file mode 100644 index 60f33f07c170..000000000000 --- a/location/tests/locationtests/src/android/location/GnssSingleSatCorrectionsTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.location; - -import android.os.Parcel; - -import junit.framework.TestCase; - -/** Unit tests for {@link GnssSingleSatCorrection}. */ -public class GnssSingleSatCorrectionsTest extends TestCase { - public void testDescribeContents() { - GnssSingleSatCorrection singleSatCorrection = new GnssSingleSatCorrection.Builder().build(); - singleSatCorrection.describeContents(); - } - - public void testWriteToParcel() { - GnssSingleSatCorrection.Builder singleSatCorrection = new GnssSingleSatCorrection.Builder(); - setTestValues(singleSatCorrection); - Parcel parcel = Parcel.obtain(); - singleSatCorrection.build().writeToParcel(parcel, 0); - parcel.setDataPosition(0); - GnssSingleSatCorrection newSingleSatCorrection = - GnssSingleSatCorrection.CREATOR.createFromParcel(parcel); - verifyTestValues(newSingleSatCorrection); - parcel.recycle(); - } - - public static void verifyTestValues(GnssSingleSatCorrection singleSatCorrection) { - assertEquals(15, singleSatCorrection.getSingleSatelliteCorrectionFlags()); - assertEquals(GnssStatus.CONSTELLATION_GALILEO, singleSatCorrection.getConstellationType()); - assertEquals(12, singleSatCorrection.getSatelliteId()); - assertEquals(1575420000f, singleSatCorrection.getCarrierFrequencyHz()); - assertEquals(0.1f, singleSatCorrection.getProbabilityLineOfSight()); - assertEquals(10.0f, singleSatCorrection.getExcessPathLengthMeters()); - assertEquals(5.0f, singleSatCorrection.getExcessPathLengthUncertaintyMeters()); - GnssReflectingPlane reflectingPlane = singleSatCorrection.getReflectingPlane(); - GnssReflectingPlaneTest.verifyTestValues(reflectingPlane); - } - - private static void setTestValues(GnssSingleSatCorrection.Builder singleSatCorrection) { - GnssSingleSatCorrection singleSatCor = generateTestSingleSatCorrection(); - singleSatCorrection - .setSingleSatelliteCorrectionFlags(singleSatCor.getSingleSatelliteCorrectionFlags()) - .setConstellationType(singleSatCor.getConstellationType()) - .setSatelliteId(singleSatCor.getSatelliteId()) - .setCarrierFrequencyHz(singleSatCor.getCarrierFrequencyHz()) - .setProbabilityLineOfSight(singleSatCor.getProbabilityLineOfSight()) - .setExcessPathLengthMeters(singleSatCor.getExcessPathLengthMeters()) - .setExcessPathLengthUncertaintyMeters( - singleSatCor.getExcessPathLengthUncertaintyMeters()) - .setReflectingPlane(singleSatCor.getReflectingPlane()); - } - - public static GnssSingleSatCorrection generateTestSingleSatCorrection() { - GnssSingleSatCorrection.Builder singleSatCorrection = - new GnssSingleSatCorrection.Builder() - .setSingleSatelliteCorrectionFlags(15) - .setConstellationType(GnssStatus.CONSTELLATION_GALILEO) - .setSatelliteId(12) - .setCarrierFrequencyHz(1575420000f) - .setProbabilityLineOfSight(0.1f) - .setExcessPathLengthMeters(10.0f) - .setExcessPathLengthUncertaintyMeters(5.0f) - .setReflectingPlane(GnssReflectingPlaneTest.generateTestReflectingPlane()); - return singleSatCorrection.build(); - } -} |