Skip to content

Commit e35d969

Browse files
committed
Adding test code for 'isSpace'
1 parent 2efc193 commit e35d969

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ set(TEST_TARGET ${CMAKE_PROJECT_NAME})
2525

2626
set(TEST_SRCS
2727
src/WCharacter/test_isHexadecimalDigit.cpp
28+
src/WCharacter/test_isSpace.cpp
2829
src/WCharacter/test_isUpperCase.cpp
2930
)
3031

test/src/WCharacter/test_isSpace.cpp

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2020 Arduino. All rights reserved.
3+
*/
4+
5+
/**************************************************************************************
6+
* INCLUDE
7+
**************************************************************************************/
8+
9+
#include <catch.hpp>
10+
11+
#include <vector>
12+
13+
#include <WCharacter.h>
14+
15+
/**************************************************************************************
16+
* CONSTANTS
17+
**************************************************************************************/
18+
19+
std::vector<char> const VALID_SPACE_VECT = {' ', '\t', '\n', '\v', '\f', '\r'};
20+
21+
/**************************************************************************************
22+
* TEST CODE
23+
**************************************************************************************/
24+
25+
TEST_CASE ("isSpace(...) is called with a valid white space character", "[isSpace-01]")
26+
{
27+
std::for_each(std::begin(VALID_SPACE_VECT),
28+
std::end (VALID_SPACE_VECT),
29+
[](char const c)
30+
{
31+
REQUIRE(arduino::isSpace(c) == true);
32+
});
33+
}
34+
35+
TEST_CASE ("isSpace(...) is called with a invalid white space character", "[isSpace-02]")
36+
{
37+
REQUIRE(arduino::isSpace('{') == false);
38+
}

0 commit comments

Comments
 (0)