diff --git a/src/main_test.cpp b/src/main_test.cpp index 6c8cf42..55ff174 100644 --- a/src/main_test.cpp +++ b/src/main_test.cpp @@ -291,9 +291,8 @@ TEST(IntelHexTest, PaddingWidth) TEST(IntelHexTest, ParseLine) { - auto input = ":1000000000200020C5020008B9020008BB02000859"; Line line{}; - auto b = IntelHex::parseLine(input, line); + auto b = IntelHex::parseLine(":1000000000200020C5020008B9020008BB02000859", line); EXPECT_EQ(1, b); EXPECT_EQ(1, line.length == 0x10); EXPECT_EQ(1, line.address == 0); @@ -302,6 +301,41 @@ TEST(IntelHexTest, ParseLine) EXPECT_EQ(1, line.checksum == 89); } +TEST(IntelHexTest, ParseLineError1) +{ + Line line{}; + auto b = IntelHex::parseLine(":10000000", line); + EXPECT_EQ(0, b); +} + +TEST(IntelHexTest, ParseLineError2) +{ + Line line{}; + auto b = IntelHex::parseLine("0000000000", line); + EXPECT_EQ(0, b); +} + +TEST(IntelHexTest, ParseLineError3) +{ + Line line{}; + auto b = IntelHex::parseLine(":0000000000", line); + EXPECT_EQ(0, b); +} + +TEST(IntelHexTest, ParseLineError4) +{ + Line line{}; + auto b = IntelHex::parseLine(":00000000F6", line); + EXPECT_EQ(0, b); +} + +TEST(IntelHexTest, ParseLineError5) +{ + Line line{}; + auto b = IntelHex::parseLine(":1000000000200020C5020008B9020008BB02000800", line); + EXPECT_EQ(0, b); +} + TEST(IntelHexTest, ConvertLine) { Line line{};