2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

Force assert to be defined in test code

This commit is contained in:
Jay Berkenbilt 2022-03-07 08:46:53 -05:00
parent 066efb69ae
commit 17c0e38c8e
18 changed files with 97 additions and 13 deletions

View File

@ -3,6 +3,11 @@
#include <qpdf/QPDFUsage.hh>
#include <iostream>
#include <cstring>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
class ArgParser

View File

@ -5,9 +5,14 @@
#include <stdlib.h>
#include <stdexcept>
#include <iostream>
#include <cassert>
#include <cstring>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
static unsigned char* uc(char const* s)
{
return QUtil::unsigned_char_pointer(s);

View File

@ -3,7 +3,12 @@
#include <qpdf/Pl_Buffer.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <assert.h>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
static void pipeStringAndFinish(Pipeline* p, std::string const& str)
{

View File

@ -1,5 +1,4 @@
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <functional>
@ -10,6 +9,12 @@
#include <memory>
#include <regex>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
// Functional programming
// Function that returns a callable in the form of a lambda

View File

@ -1,6 +1,11 @@
#include <qpdf/JSON.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <iostream>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
static void check(JSON const& j, std::string const& exp)

View File

@ -2,6 +2,11 @@
#include <qpdf/QUtil.hh>
#include <qpdf/QPDFUsage.hh>
#include <iostream>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
static void print_null(std::string const& path)

View File

@ -1,8 +1,13 @@
#include <qpdf/QPDFMatrix.hh>
#include <qpdf/QUtil.hh>
#include <assert.h>
#include <iostream>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
static void check(QPDFMatrix const& m, std::string const& exp)
{
std::string u = m.unparse();

View File

@ -1,8 +1,13 @@
#include <qpdf/PDFVersion.hh>
#include <cassert>
#include <iostream>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
int main()
{
PDFVersion v1;

View File

@ -6,10 +6,15 @@
#include <iostream>
#include <errno.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
void run(char const* filename, char const* filter,
bool encode, unsigned int columns,
unsigned int bits_per_sample, unsigned int samples_per_pixel)

View File

@ -1,5 +1,10 @@
#include <qpdf/QIntC.hh>
#include <stdint.h>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
#define try_convert(exp_pass, fn, i) \

View File

@ -9,7 +9,6 @@
#include <qpdf/Pl_Buffer.hh>
#include <string.h>
#include <limits.h>
#include <assert.h>
#include <fstream>
#include <locale>
@ -19,6 +18,12 @@
# include <unistd.h>
#endif
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
template <class int_T>
void test_to_number(char const* str, int_T wanted, bool error,
int_T (*fn)(char const*))

View File

@ -7,6 +7,11 @@
#include <string.h>
#include <iostream>
#include <stdlib.h>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
static void other_tests()

View File

@ -1,7 +1,12 @@
#include <qpdf/SparseOHArray.hh>
#include <assert.h>
#include <iostream>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
int main()
{
SparseOHArray a;

View File

@ -9,7 +9,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
static char const* whoami = 0;

View File

@ -1,12 +1,17 @@
#include <qpdf/qpdf-c.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <qpdf/qpdf-config.h> // for LL_FMT -- special case in build
#ifdef NDEBUG
/* We need assert even in a release build for test code. */
# undef NDEBUG
#endif
#include <assert.h>
static char* whoami = 0;
static qpdf_data qpdf = 0;

View File

@ -1,9 +1,14 @@
#include <qpdf/qpdfjob-c.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#ifdef NDEBUG
/* We need assert even in a release build for test code. */
# undef NDEBUG
#endif
#include <assert.h>
#ifndef QPDF_NO_WCHAR_T
static void wide_test()
{

View File

@ -28,10 +28,15 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <map>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
static char const* whoami = 0;
void usage()

View File

@ -13,7 +13,12 @@
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#ifdef NDEBUG
// We need assert even in a release build for test code.
# undef NDEBUG
#endif
#include <cassert>
// Run "test_large_file write small a.pdf" to get a PDF file that you
// can look at in a reader.