test-l500-mfr.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3 
4 // Unit Test Goals:
5 // Test the get_manufacture_work_week function
6 
7 //#cmake:add-file ../../../common/utilities/time/work_week.h
8 //#cmake:add-file ../../../common/utilities/time/work_week.cpp
9 //#cmake:add-file ../../../common/utilities/time/l500/get-mfr-ww.h
10 //#cmake:add-file ../../../common/utilities/time/l500/get-mfr-ww.cpp
11 
12 
13 #include "common.h"
14 #include "../common/utilities/time/work_week.h"
15 #include "../common/utilities/time/l500/get-mfr-ww.h"
16 
17 #define INVALID_MESSAGE( serial, invalid ) "Invalid serial number \"" + serial + "\" " + invalid
18 
19 using namespace utilities::time;
20 
21 // Test description:
22 // > Test error throws fron the get_manufacture_work_week function
23 TEST_CASE( "test get_manufacture_work_week", "[work_week]" )
24 {
25  std::string serial = "xxx";
27  INVALID_MESSAGE( serial, "length" ) );
28 
29  serial = "xxxxxxxx";
31  INVALID_MESSAGE( serial, "year" ) );
32 
33  serial = "x9xxxxxx";
35  INVALID_MESSAGE( serial, "work week" ) );
36 
37  serial = "x92xxxxx";
39  INVALID_MESSAGE( serial, "work week" ) );
40 
41  serial = "x9x5xxxx";
43  INVALID_MESSAGE( serial, "work week" ) );
44 
45  serial = "x962xxxx";
47  INVALID_MESSAGE( serial, "work week" ) );
48 
49  serial = "x955xxxx";
51  INVALID_MESSAGE( serial, "work week" ) );
52 
53  serial = "x925xxxx";
54  work_week mfr(0,1);
56  CHECK(mfr.get_work_week() == 25);
57  CHECK(mfr.get_year() == 2019);
58 }
#define CHECK_THROWS_WITH(expr, matcher)
Definition: catch.hpp:17417
#define INVALID_MESSAGE(serial, invalid)
utilities::time::work_week get_manufacture_work_week(const std::string &serial)
Definition: get-mfr-ww.cpp:17
GLsizei const GLchar *const * string
unsigned get_year() const
Definition: work_week.cpp:72
#define CHECK_NOTHROW(...)
Definition: catch.hpp:17421
TEST_CASE("test get_manufacture_work_week","[work_week]")
unsigned get_work_week() const
Definition: work_week.cpp:77
#define CHECK(condition)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:11