Able to test combine script; minor tidy
This commit is contained in:
parent
d760e35ebc
commit
ea8f6d2a07
@ -3,9 +3,9 @@ sh_test(
|
|||||||
visibility=['PUBLIC'],
|
visibility=['PUBLIC'],
|
||||||
test='combine.sh',
|
test='combine.sh',
|
||||||
args=[
|
args=[
|
||||||
'-r', '../../lib',
|
'-r', 'lib',
|
||||||
'-r', '../../lib/common',
|
'-r', 'lib/common',
|
||||||
'-r', '../../lib/decompress',
|
'-r', 'lib/decompress',
|
||||||
'-o', 'zstddeclib.c',
|
'-o', 'contrib/declib/zstddeclib.c',
|
||||||
'zstddeclib-in.c']
|
'contrib/declib/zstddeclib-in.c']
|
||||||
)
|
)
|
||||||
|
@ -45,11 +45,15 @@ function write_line {
|
|||||||
function add_file {
|
function add_file {
|
||||||
# Match the path
|
# Match the path
|
||||||
local file=
|
local file=
|
||||||
for root in $ROOTS; do
|
if [ -f "$1" ]; then
|
||||||
if test -f "$root/$1"; then
|
file="$1"
|
||||||
file="$root/$1"
|
else
|
||||||
fi
|
for root in $ROOTS; do
|
||||||
done
|
if test -f "$root/$1"; then
|
||||||
|
file="$root/$1"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
if [ -n "$file" ]; then
|
if [ -n "$file" ]; then
|
||||||
# Read the file
|
# Read the file
|
||||||
local line
|
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',
|
name='simple',
|
||||||
srcs=['simple.c'],
|
srcs=['simple.c'],
|
||||||
|
preprocessor_flags=['-UZSTD_LEGACY_SUPPORT'],
|
||||||
deps=['//contrib/declib:combine']
|
deps=['//contrib/declib:combine']
|
||||||
)
|
)
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
* \file simple.c
|
* \file simple.c
|
||||||
* Simple standalone example of using the single-file \c zstddeclib.
|
* Simple standalone example of using the single-file \c zstddeclib.
|
||||||
*/
|
*/
|
||||||
#include "../zstddeclib.c"
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "stdio.h"
|
#include "../zstddeclib.c"
|
||||||
#include "string.h"
|
|
||||||
|
|
||||||
//************************* Test Data (DXT texture) **************************/
|
//************************* 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() {
|
int main() {
|
||||||
size_t size = ZSTD_decompress(dstDxt1, sizeof dstDxt1, srcZstd, sizeof srcZstd);
|
size_t size = ZSTD_decompress(dstDxt1, sizeof dstDxt1, srcZstd, sizeof srcZstd);
|
||||||
int compare = memcmp(rawDxt1, dstDxt1, sizeof dstDxt1);
|
int compare = memcmp(rawDxt1, dstDxt1, sizeof dstDxt1);
|
||||||
printf("Decompressed size: %ld (expected %ld)\n", size, sizeof dstDxt1);
|
printf("Decompressed size: %s\n", (size == sizeof dstDxt1) ? "OK" : "FAILED");
|
||||||
printf("Byte comparison: %s\n", (compare) ? "failed" : "succeeded");
|
printf("Byte comparison: %s\n", (compare == 0) ? "OK" : "FAILED");
|
||||||
if (size == sizeof dstDxt1 && compare == 0) {
|
if (size == sizeof dstDxt1 && compare == 0) {
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user