mirror of
https://github.com/facebook/zstd.git
synced 2024-11-24 01:16:46 +08:00
Able to test combine script; minor tidy
This commit is contained in:
parent
d760e35ebc
commit
ea8f6d2a07
@ -3,9 +3,9 @@ sh_test(
|
||||
visibility=['PUBLIC'],
|
||||
test='combine.sh',
|
||||
args=[
|
||||
'-r', '../../lib',
|
||||
'-r', '../../lib/common',
|
||||
'-r', '../../lib/decompress',
|
||||
'-o', 'zstddeclib.c',
|
||||
'zstddeclib-in.c']
|
||||
'-r', 'lib',
|
||||
'-r', 'lib/common',
|
||||
'-r', 'lib/decompress',
|
||||
'-o', 'contrib/declib/zstddeclib.c',
|
||||
'contrib/declib/zstddeclib-in.c']
|
||||
)
|
||||
|
@ -45,11 +45,15 @@ function write_line {
|
||||
function add_file {
|
||||
# Match the path
|
||||
local file=
|
||||
for root in $ROOTS; do
|
||||
if test -f "$root/$1"; then
|
||||
file="$root/$1"
|
||||
fi
|
||||
done
|
||||
if [ -f "$1" ]; then
|
||||
file="$1"
|
||||
else
|
||||
for root in $ROOTS; do
|
||||
if test -f "$root/$1"; then
|
||||
file="$root/$1"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ -n "$file" ]; then
|
||||
# Read the file
|
||||
local line
|
||||
|
@ -1,5 +1,7 @@
|
||||
cxx_test(
|
||||
# Note: we need to undef ZSTD_LEGACY_SUPPORT since Buck defines it elsewhere
|
||||
cxx_binary(
|
||||
name='simple',
|
||||
srcs=['simple.c'],
|
||||
preprocessor_flags=['-UZSTD_LEGACY_SUPPORT'],
|
||||
deps=['//contrib/declib:combine']
|
||||
)
|
||||
|
@ -2,10 +2,11 @@
|
||||
* \file simple.c
|
||||
* Simple standalone example of using the single-file \c zstddeclib.
|
||||
*/
|
||||
#include "../zstddeclib.c"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "../zstddeclib.c"
|
||||
|
||||
//************************* Test Data (DXT texture) **************************/
|
||||
|
||||
@ -3387,8 +3388,8 @@ size_t ZSTD_decompress(void* dst, size_t dstLen, const void* src, size_t srcLen)
|
||||
int main() {
|
||||
size_t size = ZSTD_decompress(dstDxt1, sizeof dstDxt1, srcZstd, sizeof srcZstd);
|
||||
int compare = memcmp(rawDxt1, dstDxt1, sizeof dstDxt1);
|
||||
printf("Decompressed size: %ld (expected %ld)\n", size, sizeof dstDxt1);
|
||||
printf("Byte comparison: %s\n", (compare) ? "failed" : "succeeded");
|
||||
printf("Decompressed size: %s\n", (size == sizeof dstDxt1) ? "OK" : "FAILED");
|
||||
printf("Byte comparison: %s\n", (compare == 0) ? "OK" : "FAILED");
|
||||
if (size == sizeof dstDxt1 && compare == 0) {
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user