Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathis Rosenhauer
libaec
Commits
254c9a6e
Commit
254c9a6e
authored
Nov 13, 2012
by
Mathis Rosenhauer
Committed by
Thomas Jahns
Feb 19, 2013
Browse files
run checks with small and with large buffers
parent
488d5431
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/check_code_options.c
View file @
254c9a6e
...
@@ -192,63 +192,81 @@ int check_bps(struct test_state *state)
...
@@ -192,63 +192,81 @@ int check_bps(struct test_state *state)
return
0
;
return
0
;
}
}
int
main
(
void
)
int
check_byte_orderings
(
struct
test_state
*
state
)
{
{
int
status
;
int
status
;
struct
aec_stream
strm
;
struct
test_state
state
;
state
.
buf_len
=
state
.
ibuf_len
=
BUF_SIZE
;
state
.
cbuf_len
=
2
*
BUF_SIZE
;
state
.
ubuf
=
(
unsigned
char
*
)
malloc
(
state
.
buf_len
);
state
.
cbuf
=
(
unsigned
char
*
)
malloc
(
state
.
cbuf_len
);
state
.
obuf
=
(
unsigned
char
*
)
malloc
(
state
.
buf_len
);
if
(
!
state
.
ubuf
||
!
state
.
cbuf
||
!
state
.
obuf
)
{
printf
(
"Not enough memory.
\n
"
);
return
99
;
}
strm
.
flags
=
AEC_DATA_PREPROCESS
;
state
.
strm
=
&
strm
;
state
.
codec
=
encode_decode_small
;
printf
(
"----------------------------
\n
"
);
printf
(
"----------------------------
\n
"
);
printf
(
"Checking LSB first, unsigned
\n
"
);
printf
(
"Checking LSB first, unsigned
\n
"
);
printf
(
"----------------------------
\n
"
);
printf
(
"----------------------------
\n
"
);
status
=
check_bps
(
&
state
);
status
=
check_bps
(
state
);
if
(
status
)
if
(
status
)
goto
DESTRUCT
;
return
status
;
printf
(
"--------------------------
\n
"
);
printf
(
"--------------------------
\n
"
);
printf
(
"Checking LSB first, signed
\n
"
);
printf
(
"Checking LSB first, signed
\n
"
);
printf
(
"--------------------------
\n
"
);
printf
(
"--------------------------
\n
"
);
st
rm
.
flags
|=
AEC_DATA_SIGNED
;
st
ate
->
strm
->
flags
|=
AEC_DATA_SIGNED
;
status
=
check_bps
(
&
state
);
status
=
check_bps
(
state
);
if
(
status
)
if
(
status
)
goto
DESTRUCT
;
return
status
;
st
rm
.
flags
&=
~
AEC_DATA_SIGNED
;
st
ate
->
strm
->
flags
&=
~
AEC_DATA_SIGNED
;
st
rm
.
flags
|=
AEC_DATA_MSB
;
st
ate
->
strm
->
flags
|=
AEC_DATA_MSB
;
printf
(
"----------------------------
\n
"
);
printf
(
"----------------------------
\n
"
);
printf
(
"Checking MSB first, unsigned
\n
"
);
printf
(
"Checking MSB first, unsigned
\n
"
);
printf
(
"----------------------------
\n
"
);
printf
(
"----------------------------
\n
"
);
status
=
check_bps
(
&
state
);
status
=
check_bps
(
state
);
if
(
status
)
if
(
status
)
goto
DESTRUCT
;
return
status
;
printf
(
"--------------------------
\n
"
);
printf
(
"--------------------------
\n
"
);
printf
(
"Checking MSB first, signed
\n
"
);
printf
(
"Checking MSB first, signed
\n
"
);
printf
(
"--------------------------
\n
"
);
printf
(
"--------------------------
\n
"
);
strm
.
flags
|=
AEC_DATA_SIGNED
;
state
->
strm
->
flags
|=
AEC_DATA_SIGNED
;
status
=
check_bps
(
state
);
if
(
status
)
return
status
;
}
int
main
(
void
)
{
int
status
;
struct
aec_stream
strm
;
struct
test_state
state
;
state
.
buf_len
=
state
.
ibuf_len
=
BUF_SIZE
;
state
.
cbuf_len
=
2
*
BUF_SIZE
;
state
.
ubuf
=
(
unsigned
char
*
)
malloc
(
state
.
buf_len
);
state
.
cbuf
=
(
unsigned
char
*
)
malloc
(
state
.
cbuf_len
);
state
.
obuf
=
(
unsigned
char
*
)
malloc
(
state
.
buf_len
);
status
=
check_bps
(
&
state
);
if
(
!
state
.
ubuf
||
!
state
.
cbuf
||
!
state
.
obuf
)
{
printf
(
"Not enough memory.
\n
"
);
return
99
;
}
strm
.
flags
=
AEC_DATA_PREPROCESS
;
state
.
strm
=
&
strm
;
printf
(
"***************************
\n
"
);
printf
(
"Checking with small buffers
\n
"
);
printf
(
"***************************
\n
"
);
state
.
codec
=
encode_decode_small
;
status
=
check_byte_orderings
(
&
state
);
if
(
status
)
if
(
status
)
goto
DESTRUCT
;
goto
DESTRUCT
;
printf
(
"***************************
\n
"
);
printf
(
"Checking with large buffers
\n
"
);
printf
(
"***************************
\n
"
);
state
.
codec
=
encode_decode_large
;
status
=
check_byte_orderings
(
&
state
);
DESTRUCT:
DESTRUCT:
free
(
state
.
ubuf
);
free
(
state
.
ubuf
);
free
(
state
.
cbuf
);
free
(
state
.
cbuf
);
...
...
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