wip(step097): checkpoint B fixes pending native release pairing
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -20,6 +20,10 @@ particle::DecodedFieldPlane plane(uint16_t semantic, particle::FieldValueClass v
|
||||
.contentIdentity = std::move(identity), .storage = std::move(storage)};
|
||||
}
|
||||
|
||||
std::shared_ptr<const std::vector<uint8_t>> fourLittleEndian16BitSamples() {
|
||||
return std::make_shared<const std::vector<uint8_t>>(std::vector<uint8_t>{1, 0, 2, 0, 3, 0, 4, 0});
|
||||
}
|
||||
|
||||
particle::DecodedFieldFrame frame() {
|
||||
const auto numbers = std::make_shared<const std::vector<uint8_t>>(std::vector<uint8_t>{1, 2, 3, 4});
|
||||
const auto bits = std::make_shared<const std::vector<uint8_t>>(std::vector<uint8_t>{0x0F});
|
||||
@@ -126,7 +130,7 @@ TEST(ParticleFieldProfileValidator, EnforcesVelocityDirectionAndValidityCoreRule
|
||||
EXPECT_EQ(particle::FieldUnitNone, 0);
|
||||
EXPECT_EQ(particle::FieldUnitMetersPerSecond, 1);
|
||||
EXPECT_EQ(particle::FieldUnitDegrees, 4);
|
||||
auto c = contract(); auto f = frame(); const auto bytes = f.planes.front().storage;
|
||||
auto c = contract(); auto f = frame(); const auto bytes = fourLittleEndian16BitSamples();
|
||||
f.planes.push_back(plane(100, particle::FieldValueClass::VelocityComponent, particle::FieldUnitMetersPerSecond, 3,
|
||||
particle::FieldComponent::UEast, particle::FieldDType::Int16, false, bytes));
|
||||
EXPECT_EQ(validate(c, f), particle::FieldProfileValidationCode::InvalidVelocityGroup);
|
||||
@@ -153,6 +157,7 @@ TEST(ParticleFieldProfileValidator, EnforcesVelocityDirectionAndValidityCoreRule
|
||||
f.planes.front().scale = 360.0f / 65536.0f;
|
||||
c.requiredPlanes.front().semanticID = 10; c.requiredPlanes.front().valueClass = particle::FieldValueClass::DirectionAngle;
|
||||
c.requiredPlanes.front().unitID = particle::FieldUnitDegrees;
|
||||
f.planes.front().storage = bytes;
|
||||
EXPECT_EQ(validate(c, f), particle::FieldProfileValidationCode::Accepted);
|
||||
f.planes.front().unitID = 2;
|
||||
c.requiredPlanes.front().unitID = 2;
|
||||
@@ -178,7 +183,7 @@ TEST(ParticleFieldProfileValidator, EnforcesReservedCoreSemanticContractsFromPro
|
||||
particle::FieldComponent::UEast, true};
|
||||
f.planes.front() = plane(2, particle::FieldValueClass::VelocityComponent, particle::FieldUnitMetersPerSecond, 4,
|
||||
particle::FieldComponent::UEast, particle::FieldDType::Int16, true,
|
||||
f.planes.front().storage, "u-spoof");
|
||||
fourLittleEndian16BitSamples(), "u-spoof");
|
||||
EXPECT_EQ(validate(c, f), particle::FieldProfileValidationCode::SemanticContractMismatch);
|
||||
|
||||
c = contract(); f = frame();
|
||||
@@ -195,7 +200,7 @@ TEST(ParticleFieldProfileValidator, EnforcesDirectionCircularQuantizationContrac
|
||||
particle::FieldComponent::None, true};
|
||||
f.planes.front() = plane(10, particle::FieldValueClass::DirectionAngle, particle::FieldUnitDegrees, 0,
|
||||
particle::FieldComponent::None, particle::FieldDType::UInt16, true,
|
||||
f.planes.front().storage, "direction");
|
||||
fourLittleEndian16BitSamples(), "direction");
|
||||
f.planes.front().scale = 360.0f / 65536.0f;
|
||||
EXPECT_EQ(validate(c, f), particle::FieldProfileValidationCode::Accepted);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user