Repository navigation
Expand file tree
/
Copy pathtest_operator_comparison.cpp
More file actions
55 lines (45 loc) · 1.88 KB
/
Copy pathtest_operator_comparison.cpp
File metadata and controls
55 lines (45 loc) · 1.88 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Copyright (c) 2020 Arduino. All rights reserved.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include <catch2/catch_test_macros.hpp>
#include <api/IPAddress.h>
/**************************************************************************************
* TEST CODE
**************************************************************************************/
TEST_CASE ("Testing IPAddress::operator == (IPAddress ip1, IPAddress ip2) with ip1 == ip2", "[IPAddress-Operator-==-01]")
{
arduino::IPAddress ip1(129,168,1,2), ip2(129,168,1,2);
REQUIRE((ip1 == ip2) == true);
}
TEST_CASE ("Testing IPAddress::operator == (IPAddress ip1, IPAddress ip2) with ip1 != ip2", "[IPAddress-Operator-==-02]")
{
arduino::IPAddress ip1(129,168,1,2), ip2(10,0,0,1);
REQUIRE((ip1 == ip2) == false);
}
TEST_CASE ("Testing IPAddress::operator == (IPAddress ip1, uint8_t const * ip2) with ip1 == ip2", "[IPAddress-Operator-==-03]")
{
arduino::IPAddress ip1(129,168,1,2);
uint8_t const ip2[] = {129,168,1,2};
REQUIRE((ip1 == ip2) == true);
}
TEST_CASE ("Testing IPAddress::operator == (IPAddress ip1, uint8_t const * ip2) with ip1 != ip2", "[IPAddress-Operator-==-04]")
{
arduino::IPAddress ip1(129,168,1,2);
uint8_t const ip2[] = {10,0,0,1};
REQUIRE((ip1 == ip2) == false);
}
TEST_CASE ("Testing IPAddress::operator != (IPAddress ip1, uint8_t const * ip2) with ip1 != ip2", "[IPAddress-Operator-==-05]")
{
arduino::IPAddress ip1(129,168,1,2), ip2(10,0,0,1);
REQUIRE((ip1 != ip2) == true);
}
TEST_CASE ("Testing IPAddress::operator != (IPAddress ip1, uint8_t const * ip2) with ip1 == ip2", "[IPAddress-Operator-==-05]")
{
arduino::IPAddress ip1(129,168,1,2), ip2(129,168,1,2);
REQUIRE((ip1 != ip2) == false);
}