esp32_BNO08x 1.4 C++ BNO08x IMU driver component for esp-idf.

BNO08xTestSuite.hpp
Go to the documentation of this file.
1
6#pragma once
7
8// esp-idf includes
9#include "unity.h"
10// in-house includes
11#include "BNO08xTestHelper.hpp"
12
18 class BNO08xTestSuite
19{
20
21 private:
22 static void print_begin_tests_banner(const char* test_set_name)
23 {
24 printf("####################### BEGIN TESTS: %s #######################\n\r", test_set_name);
25 }
26
27 static void print_end_tests_banner(const char* test_set_name)
28 {
29 printf("####################### END TESTS: %s #######################\n\r", test_set_name);
30 }
31
32 public:
33 static void run_all_tests()
34 {
35 UNITY_BEGIN();
36 run_init_deinit_tests(false);
37 run_single_report_tests(false);
38 run_multi_report_tests(false);
39 run_callback_tests(false);
40 run_feature_tests(false);
41 UNITY_END();
42 }
43
44 static void run_init_deinit_tests(bool call_unity_end_begin = true)
45 {
46 print_begin_tests_banner("init_denit_tests");
47
48 if (call_unity_end_begin)
49 UNITY_BEGIN();
50
51 unity_run_tests_by_tag("[InitComprehensive]", false);
52 unity_run_tests_by_tag("[DeinitComprehensive]", false);
53 unity_run_tests_by_tag("[InitDenit]", false);
54
55 if (call_unity_end_begin)
56 UNITY_END();
57
58 print_end_tests_banner("init_denit_tests");
59 }
60
61 static void run_single_report_tests(bool call_unity_end_begin = true)
62 {
63 print_begin_tests_banner("single_report_enable_disable_tests");
64
65 if (call_unity_end_begin)
66 UNITY_BEGIN();
67
68 unity_run_tests_by_tag("[SingleReportEnableDisable]", false);
69
70 if (call_unity_end_begin)
71 UNITY_END();
72
73 print_end_tests_banner("single_report_enable_disable_tests");
74 }
75
76 static void run_multi_report_tests(bool call_unity_end_begin = true)
77 {
78 print_begin_tests_banner("multi_report_enable_disable_tests");
79
80 if (call_unity_end_begin)
81 UNITY_BEGIN();
82
83 unity_run_tests_by_tag("[MultiReportEnableDisable]", false);
84
85 if (call_unity_end_begin)
86 UNITY_END();
87
88 print_end_tests_banner("multi_report_enable_disable_tests");
89 }
90
91 static void run_callback_tests(bool call_unity_end_begin = true)
92 {
93 print_begin_tests_banner("callback_tests");
94
95 if (call_unity_end_begin)
96 UNITY_BEGIN();
97
98 unity_run_tests_by_tag("[CallbackAllReportVoidInputParam]", false);
99 unity_run_tests_by_tag("[CallbackAllReportIDInputParam]", false);
100 unity_run_tests_by_tag("[CallbackSingleReportVoidInputParam]", false);
101
102 if (call_unity_end_begin)
103 UNITY_END();
104
105 print_end_tests_banner("callback_tests");
106 }
107
108 static void run_feature_tests(bool call_unity_end_begin = true)
109 {
110 print_begin_tests_banner("feature_tests");
111
112 if (call_unity_end_begin)
113 UNITY_BEGIN();
114
115 unity_run_tests_by_tag("[FeatureTests]", false);
116
117 if (call_unity_end_begin)
118 UNITY_END();
119
120 print_end_tests_banner("feature_tests");
121 }
122};
BNO08xTestHelper.hpp
BNO08xTestSuite
BNO08x unit test launch point class.
Definition: BNO08xTestSuite.hpp:19
BNO08xTestSuite::run_single_report_tests
static void run_single_report_tests(bool call_unity_end_begin=true)
Definition: BNO08xTestSuite.hpp:61
BNO08xTestSuite::run_init_deinit_tests
static void run_init_deinit_tests(bool call_unity_end_begin=true)
Definition: BNO08xTestSuite.hpp:44
BNO08xTestSuite::run_feature_tests
static void run_feature_tests(bool call_unity_end_begin=true)
Definition: BNO08xTestSuite.hpp:108
BNO08xTestSuite::run_callback_tests
static void run_callback_tests(bool call_unity_end_begin=true)
Definition: BNO08xTestSuite.hpp:91
BNO08xTestSuite::run_multi_report_tests
static void run_multi_report_tests(bool call_unity_end_begin=true)
Definition: BNO08xTestSuite.hpp:76
BNO08xTestSuite::run_all_tests
static void run_all_tests()
Definition: BNO08xTestSuite.hpp:33