Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3548345 authored by Nathan Harold's avatar Nathan Harold Committed by Android (Google) Code Review
Browse files

Merge "Update Unit Tests for getBands() as int[]" into rvc-dev

parents 8d1ee4d1 e96ab9ff
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -22,9 +22,7 @@ import android.telephony.CellInfo;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/** Unit tests for {@link CellIdentityLte}. */

@@ -38,7 +36,7 @@ public class CellIdentityLteTest extends AndroidTestCase {
    private static final int TAC = 65535;
    // Absolute RF Channel Number ranges from 0 to 262140.
    private static final int EARFCN = 262140;
    private static final List<Integer> BANDS = Arrays.asList(1, 2);
    private static final int[] BANDS = new int[] {1, 2};
    private static final int MCC = 120;
    private static final int MNC = 260;
    private static final int BANDWIDTH = 5000;  // kHz
@@ -218,7 +216,7 @@ public class CellIdentityLteTest extends AndroidTestCase {
        p.writeInt(PCI);
        p.writeInt(TAC);
        p.writeInt(EARFCN);
        p.writeList(BANDS);
        p.writeIntArray(BANDS);
        p.writeInt(BANDWIDTH);
        p.setDataPosition(0);

@@ -244,7 +242,7 @@ public class CellIdentityLteTest extends AndroidTestCase {
        p.writeInt(PCI);
        p.writeInt(TAC);
        p.writeInt(EARFCN);
        p.writeList(BANDS);
        p.writeIntArray(BANDS);
        p.writeInt(BANDWIDTH);
        p.setDataPosition(0);

+5 −5
Original line number Diff line number Diff line
@@ -26,10 +26,8 @@ import android.test.AndroidTestCase;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class CellIdentityNrTest extends AndroidTestCase {
    private static final String MCC = "310";
@@ -42,8 +40,10 @@ public class CellIdentityNrTest extends AndroidTestCase {
    private static final int PCI = 123;
    private static final int TAC = 32767;
    private static final int NCI = 8675309;
    private static final List<Integer> BANDS = new ArrayList<>(Arrays.asList(
            AccessNetworkConstants.NgranBands.BAND_1, AccessNetworkConstants.NgranBands.BAND_1));
    private static final int[] BANDS = new int[] {
            AccessNetworkConstants.NgranBands.BAND_1,
            AccessNetworkConstants.NgranBands.BAND_2
    };

    @Test
    public void testGetMethod() {
@@ -112,7 +112,7 @@ public class CellIdentityNrTest extends AndroidTestCase {
        assertThat(anotherCellIdentityNr.getNrarfcn()).isEqualTo(NRARFCN);
        assertThat(anotherCellIdentityNr.getPci()).isEqualTo(PCI);
        assertThat(anotherCellIdentityNr.getTac()).isEqualTo(TAC);
        assertThat(anotherCellIdentityNr.getBands()).isEqualTo(BANDS);
        assertTrue(Arrays.equals(anotherCellIdentityNr.getBands(), BANDS));
        assertThat(anotherCellIdentityNr.getOperatorAlphaLong()).isEqualTo(ALPHAL);
        assertThat(anotherCellIdentityNr.getOperatorAlphaShort()).isEqualTo(ALPHAS);
        assertThat(anotherCellIdentityNr.getMccString()).isEqualTo(MCC);
+1 −3
Original line number Diff line number Diff line
@@ -25,9 +25,7 @@ import android.telephony.CellInfo;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class CellIdentityTest extends AndroidTestCase {

@@ -39,7 +37,7 @@ public class CellIdentityTest extends AndroidTestCase {
    private static final int TAC = 65535;
    // Absolute RF Channel Number ranges from 0 to 262140.
    private static final int EARFCN = 262140;
    private static final List<Integer> BANDS = Arrays.asList(1, 2);
    private static final int[] BANDS = new int[] {1, 2};
    private static final int BANDWIDTH = 5000;  // kHz
    private static final int MCC = 120;
    private static final int MNC = 260;
+1 −2
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import androidx.test.filters.SmallTest;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

/** Unit tests for {@link NetworkScanResult}. */
@@ -54,7 +53,7 @@ public class NetworkScanResultTest {
        infos.add(gsm);

        CellIdentityLte cil = new CellIdentityLte(
                10, 5, 200, 2000, Arrays.asList(1, 2), 10000, "001", "01", "test", "tst",
                10, 5, 200, 2000, new int[] {1, 2}, 10000, "001", "01", "test", "tst",
                Collections.emptyList(), null);
        CellSignalStrengthLte cssl = new CellSignalStrengthLte(15, 16, 17, 18, 19, 20);
        CellInfoLte lte = new CellInfoLte();
+5 −5
Original line number Diff line number Diff line
@@ -1190,7 +1190,7 @@ public class RILTest extends TelephonyTest {
        CellInfoLte expected = new CellInfoLte();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        CellIdentityLte cil = new CellIdentityLte(CI, PCI, TAC, EARFCN, Collections.emptyList(),
        CellIdentityLte cil = new CellIdentityLte(CI, PCI, TAC, EARFCN, new int[] {},
                Integer.MAX_VALUE, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT,
                Collections.emptyList(), null);
        CellSignalStrengthLte css = new CellSignalStrengthLte(
@@ -1380,7 +1380,7 @@ public class RILTest extends TelephonyTest {
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        CellIdentityLte cil = new CellIdentityLte(
                CI, PCI, TAC, EARFCN, Collections.emptyList(), BANDWIDTH, MCC_STR, MNC_STR,
                CI, PCI, TAC, EARFCN, new int[] {}, BANDWIDTH, MCC_STR, MNC_STR,
                ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
        CellSignalStrengthLte css = new CellSignalStrengthLte(
                RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
@@ -1401,7 +1401,7 @@ public class RILTest extends TelephonyTest {
        CellInfoLte expected = new CellInfoLte();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        CellIdentityLte cil = new CellIdentityLte(CI, PCI, TAC, EARFCN, Collections.emptyList(),
        CellIdentityLte cil = new CellIdentityLte(CI, PCI, TAC, EARFCN, new int[] {},
                BANDWIDTH, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT,
                Collections.emptyList(), null);
        CellSignalStrengthLte css = new CellSignalStrengthLte(
@@ -1426,7 +1426,7 @@ public class RILTest extends TelephonyTest {
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        CellIdentityLte cil = new CellIdentityLte(
                CI, PCI, TAC, EARFCN, Collections.emptyList(), BANDWIDTH, null, null, ALPHA_LONG,
                CI, PCI, TAC, EARFCN, new int[] {}, BANDWIDTH, null, null, ALPHA_LONG,
                ALPHA_SHORT, Collections.emptyList(), null);
        CellSignalStrengthLte css = new CellSignalStrengthLte(
                RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
@@ -1647,7 +1647,7 @@ public class RILTest extends TelephonyTest {
                (CellSignalStrengthNr) cellInfoNr.getCellSignalStrength();

        CellIdentityNr expectedCellIdentity = new CellIdentityNr(PCI, TAC, NRARFCN,
                Collections.emptyList(), MCC_STR, MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT,
                new int[] {}, MCC_STR, MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT,
                Collections.emptyList());
        CellSignalStrengthNr expectedSignalStrength = new CellSignalStrengthNr(-RSRP, -RSRQ,
                SIGNAL_NOISE_RATIO, -RSRP, -RSRQ, SIGNAL_NOISE_RATIO);
Loading