mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 23:48:30 +00:00
Merge "Add mnc and mcc string check" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
82dc3faca0
@@ -723,6 +723,7 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) {
|
|||||||
// Check the mcc [0, 999] and mnc [0, 999].
|
// Check the mcc [0, 999] and mnc [0, 999].
|
||||||
string hidl_mcc;
|
string hidl_mcc;
|
||||||
string hidl_mnc;
|
string hidl_mnc;
|
||||||
|
bool checkMccMnc = true;
|
||||||
int totalIdentitySizeExpected = 1;
|
int totalIdentitySizeExpected = 1;
|
||||||
::android::hardware::radio::V1_2::CellIdentity cellIdentities =
|
::android::hardware::radio::V1_2::CellIdentity cellIdentities =
|
||||||
radioRsp_v1_2->dataRegResp.cellIdentity;
|
radioRsp_v1_2->dataRegResp.cellIdentity;
|
||||||
@@ -731,6 +732,7 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) {
|
|||||||
if (cellInfoType == CellInfoType::NONE) {
|
if (cellInfoType == CellInfoType::NONE) {
|
||||||
// All the fields are 0
|
// All the fields are 0
|
||||||
totalIdentitySizeExpected = 0;
|
totalIdentitySizeExpected = 0;
|
||||||
|
checkMccMnc = false;
|
||||||
} else if (cellInfoType == CellInfoType::GSM) {
|
} else if (cellInfoType == CellInfoType::GSM) {
|
||||||
EXPECT_EQ(1, cellIdentities.cellIdentityGsm.size());
|
EXPECT_EQ(1, cellIdentities.cellIdentityGsm.size());
|
||||||
::android::hardware::radio::V1_2::CellIdentityGsm cig = cellIdentities.cellIdentityGsm[0];
|
::android::hardware::radio::V1_2::CellIdentityGsm cig = cellIdentities.cellIdentityGsm[0];
|
||||||
@@ -757,6 +759,7 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) {
|
|||||||
// CellIndentityCdma has no mcc and mnc.
|
// CellIndentityCdma has no mcc and mnc.
|
||||||
EXPECT_EQ(CellInfoType::CDMA, cellInfoType);
|
EXPECT_EQ(CellInfoType::CDMA, cellInfoType);
|
||||||
EXPECT_EQ(1, cellIdentities.cellIdentityCdma.size());
|
EXPECT_EQ(1, cellIdentities.cellIdentityCdma.size());
|
||||||
|
checkMccMnc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check only one CellIdentity is size 1, and others must be 0.
|
// Check only one CellIdentity is size 1, and others must be 0.
|
||||||
@@ -765,10 +768,13 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) {
|
|||||||
cellIdentities.cellIdentityLte.size() + cellIdentities.cellIdentityWcdma.size() +
|
cellIdentities.cellIdentityLte.size() + cellIdentities.cellIdentityWcdma.size() +
|
||||||
cellIdentities.cellIdentityTdscdma.size());
|
cellIdentities.cellIdentityTdscdma.size());
|
||||||
|
|
||||||
int mcc = stoi(hidl_mcc);
|
// 32 bit system might return invalid mcc and mnc hidl string "\xff\xff..."
|
||||||
int mnc = stoi(hidl_mnc);
|
if (checkMccMnc && hidl_mcc.size() < 4 && hidl_mnc.size() < 4) {
|
||||||
EXPECT_TRUE(mcc >= 0 && mcc <= 999);
|
int mcc = stoi(hidl_mcc);
|
||||||
EXPECT_TRUE(mnc >= 0 && mnc <= 999);
|
int mnc = stoi(hidl_mnc);
|
||||||
|
EXPECT_TRUE(mcc >= 0 && mcc <= 999);
|
||||||
|
EXPECT_TRUE(mnc >= 0 && mnc <= 999);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user