Skip to content

Commit 5d4e194

Browse files
committed
Adding test code for IPAddress::operator()
1 parent e1c65ce commit 5d4e194

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ set(TEST_SRCS
3333
src/IPAddress/test_IPAddress.cpp
3434
src/IPAddress/test_operator_assignment.cpp
3535
src/IPAddress/test_operator_comparison.cpp
36+
src/IPAddress/test_operator_parentheses.cpp
3637
src/IPAddress/test_printTo.cpp
3738
src/Print/test_clearWriteError.cpp
3839
src/Print/test_getWriteError.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2020 Arduino. All rights reserved.
3+
*/
4+
5+
/**************************************************************************************
6+
* INCLUDE
7+
**************************************************************************************/
8+
9+
#include <catch.hpp>
10+
11+
#include <IPAddress.h>
12+
13+
/**************************************************************************************
14+
* TEST CODE
15+
**************************************************************************************/
16+
17+
TEST_CASE ("Testing IPAddress::operator uint32_t() const", "[IPAddress-Operator-()-01]")
18+
{
19+
arduino::IPAddress ip(129,168,1,2);
20+
uint32_t const val_expected = ip;
21+
uint32_t const val_actual = (129 | (168 << 8) | (1 << 16) | (2 << 24));
22+
REQUIRE(val_expected == val_actual);
23+
}

0 commit comments

Comments
 (0)