Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
3990a292
Commit
3990a292
authored
May 05, 2019
by
Loic Hausammann
Browse files
Logger: fix test
parent
051c53e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/testLogger.c
View file @
3990a292
...
...
@@ -33,7 +33,7 @@
#include "swift.h"
void
test_log_parts
(
struct
logger
*
log
)
{
struct
dump
*
d
=
log
->
dump
;
struct
dump
*
d
=
&
log
->
dump
;
/* Write several copies of a part to the dump. */
struct
part
p
;
...
...
@@ -46,21 +46,27 @@ void test_log_parts(struct logger *log) {
/* Write the full part. */
logger_log_part
(
log
,
&
p
,
logger_mask_x
|
logger_mask_v
|
logger_mask_a
|
logger_mask_u
|
logger_mask_h
|
logger_mask_rho
|
logger_mask_consts
,
logger_mask_data
[
logger_x
].
mask
|
logger_mask_data
[
logger_v
].
mask
|
logger_mask_data
[
logger_a
].
mask
|
logger_mask_data
[
logger_u
].
mask
|
logger_mask_data
[
logger_h
].
mask
|
logger_mask_data
[
logger_rho
].
mask
|
logger_mask_data
[
logger_consts
].
mask
,
&
offset
);
printf
(
"Wrote part at offset %#016zx.
\n
"
,
offset
);
/* Write only the position. */
p
.
x
[
0
]
=
2
.
0
;
logger_log_part
(
log
,
&
p
,
logger_mask_
x
,
&
offset
);
logger_log_part
(
log
,
&
p
,
logger_mask_
data
[
logger_x
].
mask
,
&
offset
);
printf
(
"Wrote part at offset %#016zx.
\n
"
,
offset
);
/* Write the position and velocity. */
p
.
x
[
0
]
=
3
.
0
;
p
.
v
[
0
]
=
0
.
3
;
logger_log_part
(
log
,
&
p
,
logger_mask_x
|
logger_mask_v
,
&
offset
);
logger_log_part
(
log
,
&
p
,
logger_mask_data
[
logger_x
].
mask
|
logger_mask_data
[
logger_v
].
mask
,
&
offset
);
printf
(
"Wrote part at offset %#016zx.
\n
"
,
offset
);
/* Recover the last part from the dump. */
...
...
@@ -104,7 +110,7 @@ void test_log_parts(struct logger *log) {
}
void
test_log_gparts
(
struct
logger
*
log
)
{
struct
dump
*
d
=
log
->
dump
;
struct
dump
*
d
=
&
log
->
dump
;
/* Write several copies of a part to the dump. */
struct
gpart
p
;
...
...
@@ -117,20 +123,24 @@ void test_log_gparts(struct logger *log) {
/* Write the full part. */
logger_log_gpart
(
log
,
&
p
,
logger_mask_x
|
logger_mask_v
|
logger_mask_a
|
logger_mask_h
|
logger_mask_consts
,
logger_mask_data
[
logger_x
].
mask
|
logger_mask_data
[
logger_v
].
mask
|
logger_mask_data
[
logger_a
].
mask
|
logger_mask_data
[
logger_h
].
mask
|
logger_mask_data
[
logger_consts
].
mask
,
&
offset
);
printf
(
"Wrote gpart at offset %#016zx.
\n
"
,
offset
);
/* Write only the position. */
p
.
x
[
0
]
=
2
.
0
;
logger_log_gpart
(
log
,
&
p
,
logger_mask_
x
,
&
offset
);
logger_log_gpart
(
log
,
&
p
,
logger_mask_
data
[
logger_x
].
mask
,
&
offset
);
printf
(
"Wrote gpart at offset %#016zx.
\n
"
,
offset
);
/* Write the position and velocity. */
p
.
x
[
0
]
=
3
.
0
;
p
.
v_full
[
0
]
=
0
.
3
;
logger_log_gpart
(
log
,
&
p
,
logger_mask_x
|
logger_mask_v
,
&
offset
);
logger_log_gpart
(
log
,
&
p
,
logger_mask_data
[
logger_x
].
mask
|
logger_mask_data
[
logger_v
].
mask
,
&
offset
);
printf
(
"Wrote gpart at offset %#016zx.
\n
"
,
offset
);
/* Recover the last part from the dump. */
...
...
@@ -174,7 +184,7 @@ void test_log_gparts(struct logger *log) {
}
void
test_log_timestamps
(
struct
logger
*
log
)
{
struct
dump
*
d
=
log
->
dump
;
struct
dump
*
d
=
&
log
->
dump
;
/* The timestamp to log. */
unsigned
long
long
int
t
=
10
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment