22
22
#include " mbed.h"
23
23
24
24
#if !defined(MBED_THREAD_STATS_ENABLED)
25
- #warning [NOT_SUPPORTED] test not supported
25
+ #error [NOT_SUPPORTED] test not supported
26
26
#endif
27
27
28
28
using namespace utest ::v1;
@@ -54,16 +54,15 @@ void test_case_single_thread_stats()
54
54
{
55
55
mbed_stats_thread_t *stats = new mbed_stats_thread_t [MAX_THREAD_STATS];
56
56
int old_count = mbed_stats_thread_get_each (stats, MAX_THREAD_STATS);
57
-
58
57
Thread t1 (osPriorityNormal, TEST_STACK_SIZE, NULL , " Th1" );
59
58
t1.start (increment_with_delay);
60
59
61
60
// Read stats
62
61
int count = mbed_stats_thread_get_each (stats, MAX_THREAD_STATS);
63
- TEST_ASSERT_EQUAL (1 , (count- old_count));
62
+ TEST_ASSERT_EQUAL (1 , (count - old_count));
64
63
65
- for (int i = 0 ; i < count; i++) {
66
- if (0 == strcmp (stats[i].name , " Th1" )) {
64
+ for (int i = 0 ; i < count; i++) {
65
+ if (0 == strcmp (stats[i].name , " Th1" )) {
67
66
TEST_ASSERT_EQUAL (TEST_STACK_SIZE, stats[i].stack_size );
68
67
TEST_ASSERT_EQUAL (osPriorityNormal, stats[i].priority );
69
68
break ;
@@ -96,13 +95,13 @@ void test_case_multi_threads_blocked()
96
95
// Read stats
97
96
98
97
int count = mbed_stats_thread_get_each (stats, MAX_THREAD_STATS);
99
- TEST_ASSERT_EQUAL (2 , (count- old_count));
100
- for (int i = 0 ; i < count; i++) {
101
- if (0 == strcmp (stats[i].name , " Th2" )) {
98
+ TEST_ASSERT_EQUAL (2 , (count - old_count));
99
+ for (int i = 0 ; i < count; i++) {
100
+ if (0 == strcmp (stats[i].name , " Th2" )) {
102
101
TEST_ASSERT_EQUAL (TEST_STACK_SIZE, stats[i].stack_size );
103
102
TEST_ASSERT_EQUAL (osPriorityNormal1, stats[i].priority );
104
103
TEST_ASSERT_EQUAL (osThreadBlocked, stats[i].state );
105
- } else if (0 == strcmp (stats[i].name , " Th1" )) {
104
+ } else if (0 == strcmp (stats[i].name , " Th1" )) {
106
105
TEST_ASSERT_EQUAL (TEST_STACK_SIZE, stats[i].stack_size );
107
106
TEST_ASSERT_EQUAL (osPriorityNormal, stats[i].priority );
108
107
}
@@ -115,7 +114,7 @@ void test_case_multi_threads_blocked()
115
114
Thread::wait (100 );
116
115
117
116
count = mbed_stats_thread_get_each (stats, MAX_THREAD_STATS);
118
- TEST_ASSERT_EQUAL (1 , (count- old_count));
117
+ TEST_ASSERT_EQUAL (1 , (count - old_count));
119
118
120
119
t1.terminate ();
121
120
delete[] stats;
@@ -134,13 +133,13 @@ void test_case_multi_threads_terminate()
134
133
// Read stats
135
134
136
135
int count = mbed_stats_thread_get_each (stats, MAX_THREAD_STATS);
137
- TEST_ASSERT_EQUAL (2 , (count- old_count));
136
+ TEST_ASSERT_EQUAL (2 , (count - old_count));
138
137
139
- for (int i = 0 ; i < count; i++) {
140
- if (0 == strcmp (stats[i].name , " Th2" )) {
138
+ for (int i = 0 ; i < count; i++) {
139
+ if (0 == strcmp (stats[i].name , " Th2" )) {
141
140
TEST_ASSERT_EQUAL (TEST_STACK_SIZE, stats[i].stack_size );
142
141
TEST_ASSERT_EQUAL (osPriorityNormal2, stats[i].priority );
143
- } else if (0 == strcmp (stats[i].name , " Th1" )) {
142
+ } else if (0 == strcmp (stats[i].name , " Th1" )) {
144
143
TEST_ASSERT_EQUAL (TEST_STACK_SIZE, stats[i].stack_size );
145
144
TEST_ASSERT_EQUAL (osPriorityNormal1, stats[i].priority );
146
145
TEST_ASSERT_EQUAL (osThreadBlocked, stats[i].state );
0 commit comments