-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathtest_operator_comparison.cpp
53 lines (43 loc) · 1.8 KB
/
test_operator_comparison.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright (c) 2020 Arduino. All rights reserved.
*/
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include <catch.hpp>
#include <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);
}