Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathis Rosenhauer
libaec
Commits
c7acc822
Commit
c7acc822
authored
Jul 24, 2014
by
Mathis Rosenhauer
Browse files
(Re)add test for libsz.
parent
95fb0b33
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/Makefile.am
View file @
c7acc822
AUTOMAKE_OPTIONS
=
color-tests
AM_CPPFLAGS
=
-I
$(top_srcdir)
/src
TESTS
=
check_code_options check_buffer_sizes check_long_fs sampledata.sh
TESTS
=
check_code_options check_buffer_sizes check_long_fs
\
szcomp.sh sampledata.sh
TEST_EXTENSIONS
=
.sh
check_LTLIBRARIES
=
libcheck_aec.la
libcheck_aec_la_SOURCES
=
check_aec.c check_aec.h
check_PROGRAMS
=
check_code_options check_buffer_sizes check_long_fs
check_PROGRAMS
=
check_code_options check_buffer_sizes check_long_fs
\
check_szcomp
check_code_options_SOURCES
=
check_code_options.c check_aec.h
\
$(top_builddir)
/src/libaec.h
...
...
@@ -13,8 +17,13 @@ $(top_builddir)/src/libaec.h
check_long_fs_SOURCES
=
check_long_fs.c check_aec.h
\
$(top_builddir)
/src/libaec.h
check_szcomp_SOURCES
=
check_szcomp.c
$(top_builddir)
/src/szlib.h
LDADD
=
libcheck_aec.la
$(top_builddir)
/src/libaec.la
EXTRA_DIST
=
sampledata.sh benc.sh bdec.sh CMakeLists.txt
check_szcomp_LDADD
=
$(top_builddir)
/src/libsz.la
EXTRA_DIST
=
sampledata.sh szcomp.sh benc.sh bdec.sh CMakeLists.txt
szcomp.log
:
sampledata.log
bench
:
benc bdec
benc
:
$(srcdir)
/benc.sh
...
...
tests/check_szcomp.c
View file @
c7acc822
#include
<stdio.h>
#include
<unistd.h>
#include
<stdlib.h>
#include
<string.h>
#include
"szlib.h"
#define OPTIONS_MASK
(SZ_RAW_OPTION_MASK
\
| SZ_MSB_OPTION_MASK
\
| SZ_NN_OPTION_MASK)
#define PIXELS_PER_BLOCK
(8)
#define OPTIONS_MASK (SZ_RAW_OPTION_MASK \
| SZ_MSB_OPTION_MASK \
| SZ_NN_OPTION_MASK)
#define PIXELS_PER_BLOCK (8)
#define PIXELS_PER_SCANLINE (PIXELS_PER_BLOCK*128)
int
main
(
int
argc
,
char
*
argv
[])
...
...
@@ -18,18 +17,25 @@ int main(int argc, char *argv[])
size_t
destLen
,
dest1Len
,
sourceLen
;
FILE
*
fp
;
if
(
argc
<
3
)
{
fprintf
(
stderr
,
"Usage: %s buffer_size file
\n
"
,
argv
[
0
]);
if
(
argc
<
2
)
{
fprintf
(
stderr
,
"Usage: %s file
\n
"
,
argv
[
0
]);
return
1
;
}
if
((
fp
=
fopen
(
argv
[
1
],
"rb"
))
==
NULL
)
{
fprintf
(
stderr
,
"Can't open %s
\n
"
,
argv
[
1
]);
return
1
;
}
fseek
(
fp
,
0L
,
SEEK_END
);
sourceLen
=
ftell
(
fp
);
fseek
(
fp
,
0L
,
SEEK_SET
);
destLen
=
sourceLen
+
sourceLen
/
10
;
sz_param
.
options_mask
=
OPTIONS_MASK
;
sz_param
.
bits_per_pixel
=
64
;
sz_param
.
pixels_per_block
=
PIXELS_PER_BLOCK
;
sz_param
.
pixels_per_scanline
=
PIXELS_PER_SCANLINE
;
sourceLen
=
destLen
=
atoi
(
argv
[
1
]);
source
=
(
unsigned
char
*
)
malloc
(
sourceLen
);
dest
=
(
unsigned
char
*
)
malloc
(
destLen
);
dest1
=
(
unsigned
char
*
)
malloc
(
destLen
);
...
...
@@ -37,12 +43,6 @@ int main(int argc, char *argv[])
if
(
source
==
NULL
||
dest
==
NULL
||
dest1
==
NULL
)
return
1
;
if
((
fp
=
fopen
(
argv
[
2
],
"r"
))
==
NULL
)
{
fprintf
(
stderr
,
"Can't open %s
\n
"
,
argv
[
2
]);
exit
(
-
1
);
}
sourceLen
=
fread
(
source
,
1
,
sourceLen
,
fp
);
status
=
SZ_BufftoBuffCompress
(
dest
,
&
destLen
,
...
...
tests/szcomp.sh
0 → 100755
View file @
c7acc822
#!/bin/sh
set
-e
testfile
=
121B2TestData/ExtendedParameters/sar32bit.dat
if
[
!
-f
$testfile
]
;
then
echo
"ERROR: sample data not found."
exit
-1
fi
./check_szcomp
$testfile
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment