int main( void )
{
- TESTCASE( NO_TESTDRIVER );
+ /* No testdriver */
return TEST_RESULTS;
}
#ifdef TEST
#include <_PDCLIB_test.h>
+#include <string.h>
int main( void )
{
- TESTCASE( NO_TESTDRIVER );
+ FILE * fh;
+ fpos_t pos1, pos2;
+ TESTCASE( ( fh = fopen( testfile, "wb+" ) ) != NULL );
+ TESTCASE( fgetpos( fh, &pos1 ) == 0 );
+ TESTCASE( fwrite( teststring, 1, strlen( teststring ), fh ) == strlen( teststring ) );
+ TESTCASE( fgetpos( fh, &pos2 ) == 0 );
+ TESTCASE( fsetpos( fh, &pos1 ) == 0 );
+ TESTCASE( ftell( fh ) == 0 );
+ TESTCASE( fsetpos( fh, &pos2 ) == 0 );
+ TESTCASE( (size_t)ftell( fh ) == strlen( teststring ) );
+ TESTCASE( fclose( fh ) == 0 );
+ remove( testfile );
return TEST_RESULTS;
}
int main( void )
{
- TESTCASE( NO_TESTDRIVER );
+ /* fsetpos() tested together with fsetpos(). */
return TEST_RESULTS;
}
#ifdef TEST
#include <_PDCLIB_test.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
int main( void )
{
- TESTCASE( NO_TESTDRIVER );
+ FILE * fh;
+ unsigned long long max = ULLONG_MAX;
+ char buffer[100];
+ sprintf( buffer, "%llu", max );
+ TESTCASE( ( fh = freopen( testfile, "wb+", stderr ) ) != NULL );
+ TESTCASE( strtol( buffer, NULL, 10 ) == LONG_MAX );
+ perror( "Test" );
+ rewind( fh );
+ TESTCASE( fread( buffer, 1, 7, fh ) == 7 );
+ TESTCASE( memcmp( buffer, "Test: ", 6 ) == 0 );
+ TESTCASE( fclose( fh ) == 0 );
+ remove( testfile );
return TEST_RESULTS;
}