forked from arduino/ArduinoCore-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_isPunct.cpp
More file actions
40 lines (31 loc) · 1.33 KB
/
Copy pathtest_isPunct.cpp
File metadata and controls
40 lines (31 loc) · 1.33 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
/*
* Copyright (c) 2020 Arduino. All rights reserved.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include <catch.hpp>
#include <vector>
#include <api/WCharacter.h>
/**************************************************************************************
* CONSTANTS
**************************************************************************************/
std::vector<char> const VALID_PUNCT_VECT = {'!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',':',';','<','=','>','?','@','[','\\',']','^','_','`','{','|','}','~'};
/**************************************************************************************
* TEST CODE
**************************************************************************************/
TEST_CASE ("isPunct('.') is called with a valid punct character", "[isPunct-01]")
{
std::for_each(std::begin(VALID_PUNCT_VECT),
std::end (VALID_PUNCT_VECT),
[](char const c)
{
REQUIRE(arduino::isPunct(c) == true);
});
}
TEST_CASE ("isPunct(...) is called with a invalid punct character", "[isPunct-02]")
{
REQUIRE(arduino::isPunct('a') == false);
}