summaryrefslogtreecommitdiff
path: root/tests/netinet_ether_test.cpp
diff options
context:
space:
mode:
authorJustin DeMartino <jjdemartino@google.com>2020-09-21 13:23:58 -0700
committerJustin DeMartino <jjdemartino@google.com>2020-09-21 13:23:58 -0700
commit7e4fe6a28b718ab97c08811566238af2893ca65b (patch)
tree5413a5ec890b5a1ac4fbbe4548b5014e41a2591b /tests/netinet_ether_test.cpp
parentdcdcb3fa15004669823a3a118189d9d72ff30852 (diff)
parentab08b955a34423d53b28a6210e7530e67241af4a (diff)
Merge SP1A.200921.001
Change-Id: Id2ab019914bb555dadf52c46b8403c0d5fb3c20a
Diffstat (limited to 'tests/netinet_ether_test.cpp')
-rw-r--r--tests/netinet_ether_test.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/netinet_ether_test.cpp b/tests/netinet_ether_test.cpp
index faa3db47f..af020ec93 100644
--- a/tests/netinet_ether_test.cpp
+++ b/tests/netinet_ether_test.cpp
@@ -34,7 +34,7 @@ TEST(netinet_ether, ether_aton__ether_ntoa) {
TEST(netinet_ether, ether_aton_r__ether_ntoa_r) {
ether_addr addr;
memset(&addr, 0, sizeof(addr));
- ether_addr* a = ether_aton_r("12:34:56:78:9a:bc", &addr);
+ ether_addr* a = ether_aton_r("12:34:56:78:9a:Bc", &addr);
ASSERT_EQ(&addr, a);
ASSERT_EQ(0x12, addr.ether_addr_octet[0]);
ASSERT_EQ(0x34, addr.ether_addr_octet[1]);
@@ -49,3 +49,11 @@ TEST(netinet_ether, ether_aton_r__ether_ntoa_r) {
ASSERT_EQ(buf, p);
ASSERT_STREQ("12:34:56:78:9a:bc", buf);
}
+
+TEST(netinet_ether, ether_aton_r_failures) {
+ ether_addr addr;
+ ASSERT_TRUE(ether_aton_r("12:34:56:78:9a;bc", &addr) == nullptr);
+ ASSERT_TRUE(ether_aton_r("12:34:56:78:9a:bc ", &addr) == nullptr);
+ ASSERT_TRUE(ether_aton_r("g2:34:56:78:9a:bc ", &addr) == nullptr);
+ ASSERT_TRUE(ether_aton_r("1G:34:56:78:9a:bc ", &addr) == nullptr);
+}