-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathtest_operator_assignment.cpp
36 lines (28 loc) · 1.04 KB
/
test_operator_assignment.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* Copyright (c) 2020 Arduino. All rights reserved.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include <catch.hpp>
#include <api/IPAddress.h>
/**************************************************************************************
* TEST CODE
**************************************************************************************/
TEST_CASE ("Testing IPAddress::operator = (const uint8_t * a)", "[IPAddress-Operator-=-01]")
{
arduino::IPAddress ip1;
uint8_t const ip2[] = {192,168,1,2};
ip1 = ip2;
REQUIRE(ip1 == arduino::IPAddress(192,168,1,2));
}
TEST_CASE ("Testing IPAddress::operator = (uint32_t a)", "[IPAddress-Operator-=-02]")
{
arduino::IPAddress ip1;
uint32_t const ip2 = 192 | (168 << 8) | (1 << 16) | (2 << 24);
ip1 = ip2;
// NOTE: Only correct on little-endian systems
REQUIRE(ip1 == arduino::IPAddress(192,168,1,2));
}