Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART_17-18
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bbartels
MicroCART_17-18
Commits
e3e6178a
Commit
e3e6178a
authored
8 years ago
by
bbartels
Browse files
Options
Downloads
Patches
Plain Diff
quad: Refactor regression tests
currently one test is failing
parent
2ed80f9c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
quad/sw/modular_quad_pid/test/test_uart_buff.c
+19
-24
19 additions, 24 deletions
quad/sw/modular_quad_pid/test/test_uart_buff.c
with
19 additions
and
24 deletions
quad/sw/modular_quad_pid/test/test_uart_buff.c
+
19
−
24
View file @
e3e6178a
...
@@ -49,37 +49,31 @@ int failed(char *msg) {
...
@@ -49,37 +49,31 @@ int failed(char *msg) {
return
1
;
return
1
;
}
}
void
add_
VRPN_
packet
()
{
void
add_packet
(
unsigned
char
type
,
unsigned
char
subtype
,
unsigned
short
id
,
unsigned
short
length
,
unsigned
char
*
data
)
{
uart_buff_add_u8
(
0xBE
);
uart_buff_add_u8
(
0xBE
);
uart_buff_add_u8
(
0x04
);
uart_buff_add_u8
(
type
);
uart_buff_add_u8
(
0x00
);
uart_buff_add_u8
(
subtype
);
uart_buff_add_u8
(
0x00
);
uart_buff_add_u8
(
id
);
uart_buff_add_u8
(
0x00
);
uart_buff_add_u8
(
id
>>
8
);
uart_buff_add_u8
(
24
);
uart_buff_add_u8
(
length
);
uart_buff_add_u8
(
0x00
);
uart_buff_add_u8
(
length
>>
8
);
float
arr
[
6
]
=
{
1
.
0
,
1
.
2
,
1
.
4
,
-
1
.
5
,
-
0
.
5
,
-
1
.
1
};
unsigned
char
*
data
=
(
unsigned
char
*
)
&
arr
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
24
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
24
;
i
+=
1
)
{
uart_buff_add_u8
(
data
[
i
]);
uart_buff_add_u8
(
data
[
i
]);
}
}
uart_buff_add_u8
(
0x00
);
// fake checksum
uart_buff_add_u8
(
1
);
}
void
add_VRPN_packet
()
{
float
arr
[
6
]
=
{
1
.
0
,
1
.
2
,
1
.
4
,
-
1
.
5
,
-
0
.
5
,
-
1
.
1
};
unsigned
char
*
data
=
(
unsigned
char
*
)
&
arr
;
add_packet
(
4
,
0
,
0
,
24
,
data
);
}
}
void
add_basic_packet
()
{
void
add_basic_packet
()
{
uart_buff_add_u8
(
0xBE
);
uart_buff_add_u8
(
0x04
);
uart_buff_add_u8
(
0x00
);
uart_buff_add_u8
(
0x00
);
uart_buff_add_u8
(
0x00
);
uart_buff_add_u8
(
6
);
uart_buff_add_u8
(
0x00
);
unsigned
char
data
[
6
]
=
{
0xAA
,
0xBB
,
0xCC
,
0xDD
,
0xEE
,
0xFF
};
unsigned
char
data
[
6
]
=
{
0xAA
,
0xBB
,
0xCC
,
0xDD
,
0xEE
,
0xFF
};
int
i
;
add_packet
(
4
,
0
,
0
,
6
,
data
);
for
(
i
=
0
;
i
<
6
;
i
+=
1
)
{
uart_buff_add_u8
(
data
[
i
]);
}
uart_buff_add_u8
(
0x00
);
}
}
void
add_garbage_data
()
{
void
add_garbage_data
()
{
...
@@ -353,13 +347,14 @@ int test_get_raw() {
...
@@ -353,13 +347,14 @@ int test_get_raw() {
uart_buff_reset
();
uart_buff_reset
();
if
(
!
setup_basic_packet
())
return
failed
(
"FAILED: setup failed"
);
if
(
!
setup_basic_packet
())
return
failed
(
"FAILED: setup failed"
);
unsigned
char
exp
[
15
]
=
unsigned
char
exp
[
15
]
=
{
0xBE
,
0x04
,
0x00
,
0x00
,
0x00
,
0x06
,
0x00
,
0xAA
,
0xBB
,
0xCC
,
0xDD
,
0xEE
,
0xFF
,
0x0
0
};
{
0xBE
,
0x04
,
0x00
,
0x00
,
0x00
,
0x06
,
0x00
,
0xAA
,
0xBB
,
0xCC
,
0xDD
,
0xEE
,
0xFF
,
0x0
1
};
size_t
length
;
size_t
length
;
unsigned
char
*
act
=
(
unsigned
char
*
)
uart_buff_get_raw
(
&
length
);
unsigned
char
*
act
=
(
unsigned
char
*
)
uart_buff_get_raw
(
&
length
);
int
success
=
1
;
int
success
=
1
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
length
;
i
+=
1
)
{
success
&=
(
exp
[
i
]
==
act
[
i
]);
printf
(
"%02X == %02X
\n
"
,
exp
[
i
],
act
[
i
]);
success
=
success
&&
(
exp
[
i
]
==
act
[
i
]);
if
(
!
success
)
{
if
(
!
success
)
{
printf
(
"FAILED"
);
printf
(
"FAILED"
);
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment