Skip to content

Commit

Permalink
Add unit test for IPAddress::FromString method
Browse files Browse the repository at this point in the history
- Added a new test case `TestFromString` in `TestPeerAddress`.
- The test verifies that the `FromString` method correctly parses the IP
  address "192.168.1.8" into an `IPAddress` object.
- Ensured that the `FromString` method returns true for valid IP address
  strings.
  • Loading branch information
swan-amazon committed Aug 5, 2024
1 parent d31f7be commit f561c7e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/transport/raw/tests/TestPeerAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,12 @@ TEST(TestPeerAddress, TestToString)
}
}

TEST(TestPeerAddress, TestFromString)
{
chip::Inet::IPAddress ipAddress;
const char * ipStrBuf = "192.168.1.8";
bool result = chip::Inet::IPAddress::FromString(ipStrBuf, ipAddress);
EXPECT_TRUE(result);
}

} // namespace

0 comments on commit f561c7e

Please sign in to comment.