only:Simplify `testNewMessage006` test case (#7061)

This commit is contained in:
kifir23917 2024-11-11 17:13:00 +02:00 committed by GitHub
parent 0b8759ea29
commit 9312458526
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 8 deletions

View File

@ -226,6 +226,8 @@ namespace {
}
TEST_F(MotorolaDbcTest, testNewMessage006) {
std::array<uint8_t, 8> data { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
const int bitStart = 13;
const int length = 8;
@ -243,12 +245,14 @@ namespace {
// u 6 |
// m 7 |
// . 8 |
EXPECT_EQ(getBitRangeMoto(getTestDataPtr(), bitStart, length), 0x00); // 0000
EXPECT_EQ(getBitRangeMoto(data.data(), bitStart, length), 0x00); // 0000
const int testValue = 0xB3; // 1011 0011
setBitRangeMoto(data.data(), bitStart, length, testValue);
ASSERT_EQ(22, motorolaMagicFromDbc(bitStart, length));
setBitRangeMoto(getTestDataPtr(), bitStart, length, testValue);
const std::array<uint8_t, 8> unexpectedData = { 0x00, 0x00, 0xC2, 0x00, 0x00, 0x00, 0x00, 0x00 };
EXPECT_THAT(data, testing::ElementsAreArray(unexpectedData)); // TODO: this check shouldn't pass!!!
EXPECT_EQ(getBitRangeMoto(data.data(), bitStart, length), 0x03); // TODO: this check shouldn't pass!!!
//// | Bit Positions
//// | 7 6 5 4 3 2 1 0
@ -263,11 +267,8 @@ namespace {
//// m 7 | 0 0 0 0 0 0 0 0
//// . 8 | 0 0 0 0 0 0 0 0
//const std::array<uint8_t, 8> expectedData = { 0x00, 0x00, 0x2C, 0xC0, 0x00, 0x00, 0x00, 0x00 }; // TODO: these are expected data!!!
//EXPECT_THAT(testData, testing::ElementsAreArray(expectedData)); // TODO: this check shouldn't fail!!!
//EXPECT_EQ(getBitRangeMoto(getTestDataPtr(), bitStart, length), testValue); // TODO: this check shouldn't fail!!!
const std::array<uint8_t, 8> unexpectedData = { 0x00, 0x00, 0xC2, 0x00, 0x00, 0x00, 0x00, 0x00 };
EXPECT_THAT(testData, testing::ElementsAreArray(unexpectedData)); // TODO: this check shouldn't pass!!!
//EXPECT_THAT(data, testing::ElementsAreArray(expectedData)); // TODO: this check shouldn't fail!!!
//EXPECT_EQ(getBitRangeMoto(data.data(), bitStart, length), testValue); // TODO: this check shouldn't fail!!!
// checkRange(
// /* bitStart = */ 13,