forked from arduino/ArduinoCore-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_isDigit.cpp
More file actions
41 lines (32 loc) · 1.26 KB
/
Copy pathtest_isDigit.cpp
File metadata and controls
41 lines (32 loc) · 1.26 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
/*
* Copyright (c) 2020 Arduino. All rights reserved.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include <catch2/catch_test_macros.hpp>
#include <algorithm>
#include <vector>
#include <api/WCharacter.h>
/**************************************************************************************
* CONSTANTS
**************************************************************************************/
std::vector<char> const VALID_DIGIT_VECT = {'0','1','2','3','4','5','6','7','8','9'};
/**************************************************************************************
* TEST CODE
**************************************************************************************/
TEST_CASE ("isDigit(...) is called with valid digits", "[isDigit-01]")
{
std::for_each(std::begin(VALID_DIGIT_VECT),
std::end (VALID_DIGIT_VECT),
[](char const c)
{
REQUIRE(arduino::isDigit(c) == true);
});
}
TEST_CASE ("isDigit(...) is called with non digit", "[isDigit-02]")
{
REQUIRE(arduino::isDigit('z') == false);
}