Commit c7acc822 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer

(Re)add test for libsz.

parent 95fb0b33
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
......
#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,
......
#!/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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment