Skip to content

Commit 04af185

Browse files
committedAug 5, 2024
Add unit test for IPAddress::FromString method
- 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.
1 parent d31f7be commit 04af185

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/transport/raw/tests/TestPeerAddress.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,12 @@ TEST(TestPeerAddress, TestToString)
101101
}
102102
}
103103

104+
TEST(TestPeerAddress, TestFromString)
105+
{
106+
chip::Inet::IPAddress ipAddress;
107+
const char *ipStrBuf = "192.168.1.8";
108+
bool result = chip::Inet::IPAddress::FromString(ipStrBuf, ipAddress);
109+
EXPECT_TRUE(result);
110+
}
111+
104112
} // namespace

0 commit comments

Comments
 (0)