Skip to content

Commit 5841c06

Browse files
committed
Adding test code for 'makeWord' and 'word'
1 parent 3541f60 commit 5841c06

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

test/CMakeLists.txt

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

2626
set(TEST_SRCS
27+
src/Common/test_makeWord.cpp
2728
src/Common/test_max.cpp
2829
src/Common/test_min.cpp
2930
src/WCharacter/test_isHexadecimalDigit.cpp

test/src/Common/test_makeWord.cpp

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2020 Arduino. All rights reserved.
3+
*/
4+
5+
/**************************************************************************************
6+
* INCLUDE
7+
**************************************************************************************/
8+
9+
#include <catch.hpp>
10+
11+
#include <Common.h>
12+
13+
/**************************************************************************************
14+
* TEST CODE
15+
**************************************************************************************/
16+
17+
TEST_CASE ("Calling 'makeWord(w)'", "[makeWord-01]")
18+
{
19+
REQUIRE(makeWord(0xDEAD) == 0xDEAD);
20+
REQUIRE(makeWord(0xDE) == 0x00DE);
21+
}
22+
23+
TEST_CASE ("Calling 'makeWord(h,l)'", "[makeWord-02]")
24+
{
25+
REQUIRE(makeWord(0xDE, 0xAD) == 0xDEAD);
26+
}
27+
28+
TEST_CASE ("Calling 'word(...)'", "[makeWord-03]")
29+
{
30+
REQUIRE(word(0xDEAD) == 0xDEAD);
31+
REQUIRE(word(0xDE, 0xAD) == 0xDEAD);
32+
}

0 commit comments

Comments
 (0)