Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Keidan committed Apr 14, 2024
1 parent d7930f3 commit 090e6bb
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions src/main_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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{};
Expand Down

0 comments on commit 090e6bb

Please sign in to comment.