mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 16:32:11 +01:00
66 lines
2.1 KiB
C
66 lines
2.1 KiB
C
// Copyright 2017 The Wuffs Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
/*
|
|
This test program is typically run indirectly, by the "wuffs test" or "wuffs
|
|
bench" commands. These commands take an optional "-mimic" flag to check that
|
|
Wuffs' output mimics (i.e. exactly matches) other libraries' output, such as
|
|
giflib for GIF, libpng for PNG, etc.
|
|
|
|
To manually run this test:
|
|
|
|
for cc in clang gcc; do
|
|
$cc -std=c99 -Wall -Werror zlib.c && ./a.out
|
|
rm -f a.out
|
|
done
|
|
|
|
Each edition should print "PASS", amongst other information, and exit(0).
|
|
|
|
Add the "wuffs mimic cflags" (everything after the colon below) to the C
|
|
compiler flags (after the .c file) to run the mimic tests.
|
|
|
|
To manually run the benchmarks, replace "-Wall -Werror" with "-O3" and replace
|
|
the first "./a.out" with "./a.out -bench". Combine these changes with the
|
|
"wuffs mimic cflags" to run the mimic benchmarks.
|
|
*/
|
|
|
|
// !! wuffs mimic cflags: -DWUFFS_MIMIC -lz
|
|
|
|
// If building this program in an environment that doesn't easily accomodate
|
|
// relative includes, you can use the script/inline-c-relative-includes.go
|
|
// program to generate a stand-alone C file.
|
|
#include "../../../gen/c/std/flate.c"
|
|
#include "../../../gen/c/std/zlib.c"
|
|
#include "../testlib/testlib.c"
|
|
#ifdef WUFFS_MIMIC
|
|
#include "../mimiclib/flate.c"
|
|
#endif
|
|
|
|
// ---------------- Manifest
|
|
|
|
// The empty comments forces clang-format to place one element per line.
|
|
proc tests[] = {
|
|
NULL,
|
|
};
|
|
|
|
// The empty comments forces clang-format to place one element per line.
|
|
proc benches[] = {
|
|
NULL,
|
|
};
|
|
|
|
int main(int argc, char** argv) {
|
|
proc_filename = "std/zlib.c";
|
|
return test_main(argc, argv, tests, benches);
|
|
}
|