forked from arduino/ArduinoCore-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_isStandardId.cpp
33 lines (25 loc) · 1.1 KB
/
test_isStandardId.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
/*
* Copyright (c) 2020 Arduino. All rights reserved.
*/
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include <catch.hpp>
#include <api/CanMsg.h>
/**************************************************************************************
* NAMESPACE
**************************************************************************************/
using namespace arduino;
/**************************************************************************************
* TEST CODE
**************************************************************************************/
TEST_CASE ("\"isStandardId\" should return true for standard CAN ID", "[CanMsg-isStandardId-01]")
{
CanMsg const msg_std_id(CanStandardId(0x020), 0, nullptr);
REQUIRE(msg_std_id.isStandardId() == true);
}
TEST_CASE ("\"isStandardId\" should return false for extended CAN ID", "[CanMsg-isStandardId-02]")
{
CanMsg const msg_ext_id(CanExtendedId(0x020), 0, nullptr);
REQUIRE(msg_ext_id.isStandardId() == false);
}