print_test.c revision 46ee7c3260725be660e4db900ad792ae186b33fc
/*
* Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <config.h>
#include <atf-c.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
* Workout if we need to force the inclusion of print.c so we can test
* it on all platforms even if we don't include it in libisc.
*/
#include <isc/platform.h>
#if !defined(ISC_PLATFORM_NEEDPRINTF) && \
!defined(ISC_PLATFORM_NEEDFPRINTF) && \
!defined(ISC_PLATFORM_NEEDSPRINTF) && \
!defined(ISC_PLATFORM_NEEDVSNPRINTF)
#define ISC__PRINT_SOURCE
#include "../print.c"
#else
#if !defined(ISC_PLATFORM_NEEDPRINTF) || \
!defined(ISC_PLATFORM_NEEDFPRINTF) || \
!defined(ISC_PLATFORM_NEEDSPRINTF) || \
!defined(ISC_PLATFORM_NEEDVSNPRINTF)
#define ISC__PRINT_SOURCE
#endif
#endif
}
char buf[10000];
int n;
/*
* 4294967296 <= 8589934592 < 1000000000^2 to verify fix for
* RT#36505.
*/
ATF_CHECK_EQ(n, 10);
ATF_CHECK_EQ(n, 10);
size = 1000;
ATF_CHECK_EQ(n, 4);
size = 1000;
ATF_CHECK_EQ(n, 3);
size = 1000;
ATF_CHECK_EQ(n, 4);
}
}
FILE *f;
int n;
char buf[10000];
ATF_REQUIRE(f != NULL);
size = 1000;
ATF_CHECK_EQ(n, 4);
rewind(f);
ATF_CHECK_EQ(n, 4);
fclose(f);
}
/*
* Main
*/
ATF_TP_ADD_TCS(tp) {
return (atf_no_error());
}