Merge "Loosen speed check for first GPS location" into oc-dev
This commit is contained in:
commit
dda16e990b
1 changed files with 17 additions and 10 deletions
|
@ -208,10 +208,13 @@ TEST_F(GnssHalTest, SetCallbackCapabilitiesCleanup) {}
|
||||||
* CheckLocation:
|
* CheckLocation:
|
||||||
* Helper function to vet Location fields
|
* Helper function to vet Location fields
|
||||||
*/
|
*/
|
||||||
void CheckLocation(GnssLocation& location, bool checkAccuracies) {
|
void CheckLocation(GnssLocation& location, bool checkAccuracies,
|
||||||
|
bool checkSpeed) {
|
||||||
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
|
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
|
||||||
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
|
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
|
||||||
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
|
if (checkSpeed) {
|
||||||
|
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
|
||||||
|
}
|
||||||
EXPECT_TRUE(location.gnssLocationFlags &
|
EXPECT_TRUE(location.gnssLocationFlags &
|
||||||
GnssLocationFlags::HAS_HORIZONTAL_ACCURACY);
|
GnssLocationFlags::HAS_HORIZONTAL_ACCURACY);
|
||||||
// New uncertainties available in O must be provided,
|
// New uncertainties available in O must be provided,
|
||||||
|
@ -232,12 +235,15 @@ void CheckLocation(GnssLocation& location, bool checkAccuracies) {
|
||||||
EXPECT_LE(location.longitudeDegrees, 180.0);
|
EXPECT_LE(location.longitudeDegrees, 180.0);
|
||||||
EXPECT_GE(location.altitudeMeters, -1000.0);
|
EXPECT_GE(location.altitudeMeters, -1000.0);
|
||||||
EXPECT_LE(location.altitudeMeters, 30000.0);
|
EXPECT_LE(location.altitudeMeters, 30000.0);
|
||||||
EXPECT_GE(location.speedMetersPerSec, 0.0);
|
if (checkSpeed) {
|
||||||
EXPECT_LE(location.speedMetersPerSec, 5.0); // VTS tests are stationary.
|
// VTS tests are stationary. 5.0m/s max allows for measurement noise.
|
||||||
|
EXPECT_GE(location.speedMetersPerSec, 0.0);
|
||||||
|
EXPECT_LE(location.speedMetersPerSec, 5.0);
|
||||||
|
|
||||||
// Non-zero speeds must be reported with an associated bearing
|
// Non-zero speeds must be reported with an associated bearing
|
||||||
if (location.speedMetersPerSec > 0.0) {
|
if (location.speedMetersPerSec > 0.0) {
|
||||||
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
|
EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -299,7 +305,8 @@ bool StartAndGetSingleLocation(GnssHalTest* test, bool checkAccuracies) {
|
||||||
EXPECT_EQ(test->location_called_count_, 1);
|
EXPECT_EQ(test->location_called_count_, 1);
|
||||||
}
|
}
|
||||||
if (test->location_called_count_ > 0) {
|
if (test->location_called_count_ > 0) {
|
||||||
CheckLocation(test->last_location_, checkAccuracies);
|
// don't require speed on first fix
|
||||||
|
CheckLocation(test->last_location_, checkAccuracies, false /* checkSpeed */ );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -340,7 +347,7 @@ TEST_F(GnssHalTest, GetLocation) {
|
||||||
EXPECT_EQ(std::cv_status::no_timeout,
|
EXPECT_EQ(std::cv_status::no_timeout,
|
||||||
wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC));
|
wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC));
|
||||||
EXPECT_EQ(location_called_count_, i + 1);
|
EXPECT_EQ(location_called_count_, i + 1);
|
||||||
CheckLocation(last_location_, checkMoreAccuracies);
|
CheckLocation(last_location_, checkMoreAccuracies, true /* checkSpeed */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,4 +457,4 @@ int main(int argc, char** argv) {
|
||||||
int status = RUN_ALL_TESTS();
|
int status = RUN_ALL_TESTS();
|
||||||
ALOGI("Test result = %d", status);
|
ALOGI("Test result = %d", status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue