poppy_com
0.1
Poppy2.0 communication library
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Enumerations
Enumerator
Pages
test
src
test_mngmnt.c
1
/*
2
* test_mngmnt.c
3
*
4
* Created: 11/02/2015 12:40:48
5
* Author: Nicolas Rabault
6
*/
7
8
#include "test/inc/test_mngmnt.h"
9
#include <stdio.h>
10
11
int
test_nb = 0;
12
int
test_failed = 0;
13
int
test_seq_nb = 0;
14
15
16
unsigned
char
test(
unsigned
char
result) {
17
test_nb++;
18
if
(!result) {
19
test_failed++;
20
printf(
"\x1B[31mtest %d FAIlED\n\x1B[0m"
, ++test_seq_nb);
21
return
1;
22
}
23
printf(
"\x1B[32mtest %d SUCCES\n\x1B[0m"
, ++test_seq_nb);
24
return
0;
25
}
26
27
int
test_end(
void
) {
28
if
(test_failed) {
29
printf(
"\n\x1B[31m%d/%d test failed.\n\x1B[0m"
, test_failed, test_nb);
30
return
1;
31
}
32
printf(
"\n\x1B[32mall %d test pass\n\x1B[0m"
, test_nb);
33
return
0;
34
}
35
36
void
test_sequences(
unsigned
char
(*test_func)(
void
)) {
37
static
int
sequence_nb = 0;
38
test_seq_nb = 0;
39
if
(test_func())
40
printf(
"\x1B[31mSequence number %d failed.\n\x1B[0m"
, sequence_nb++);
41
else
42
printf(
"\x1B[32mSequence number %d succes.\x1B[0m\n"
, sequence_nb++);
43
}
Generated on Fri Aug 5 2016 15:36:17 for poppy_com by
1.8.6