Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
libaec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
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
Mathis Rosenhauer
libaec
Commits
254c9a6e
Commit
254c9a6e
authored
12 years ago
by
Mathis Rosenhauer
Committed by
Thomas Jahns
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
run checks with small and with large buffers
parent
488d5431
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/check_code_options.c
+48
-30
48 additions, 30 deletions
tests/check_code_options.c
with
48 additions
and
30 deletions
tests/check_code_options.c
+
48
−
30
View file @
254c9a6e
...
...
@@ -192,63 +192,81 @@ int check_bps(struct test_state *state)
return
0
;
}
int
main
(
void
)
int
check_byte_orderings
(
struct
test_state
*
state
)
{
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
(
"Checking LSB first, unsigned
\n
"
);
printf
(
"----------------------------
\n
"
);
status
=
check_bps
(
&
state
);
status
=
check_bps
(
state
);
if
(
status
)
goto
DESTRUCT
;
return
status
;
printf
(
"--------------------------
\n
"
);
printf
(
"Checking LSB first, signed
\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
)
goto
DESTRUCT
;
return
status
;
st
rm
.
flags
&=
~
AEC_DATA_SIGNED
;
st
rm
.
flags
|=
AEC_DATA_MSB
;
st
ate
->
strm
->
flags
&=
~
AEC_DATA_SIGNED
;
st
ate
->
strm
->
flags
|=
AEC_DATA_MSB
;
printf
(
"----------------------------
\n
"
);
printf
(
"Checking MSB first, unsigned
\n
"
);
printf
(
"----------------------------
\n
"
);
status
=
check_bps
(
&
state
);
status
=
check_bps
(
state
);
if
(
status
)
goto
DESTRUCT
;
return
status
;
printf
(
"--------------------------
\n
"
);
printf
(
"Checking MSB first, signed
\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
)
goto
DESTRUCT
;
printf
(
"***************************
\n
"
);
printf
(
"Checking with large buffers
\n
"
);
printf
(
"***************************
\n
"
);
state
.
codec
=
encode_decode_large
;
status
=
check_byte_orderings
(
&
state
);
DESTRUCT:
free
(
state
.
ubuf
);
free
(
state
.
cbuf
);
...
...
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