+ /* See the code comment at the functions' return statement above. */
+ int fd, r;
+ char * buffer = malloc( 13 );
+ TESTCASE( buffer != NULL );
+ strcpy( buffer, "Test output\n" );
+ /* Writing string to file */
+ TESTCASE( ( fd = open( "testfile", O_CREAT | O_TRUNC | O_WRONLY, S_IRWXU ) ) != -1 );
+ struct _PDCLIB_file_t file = { fd, { 0, 0 }, buffer, BUFSIZ, 12, 0, 0, NULL };
+ TESTCASE( _PDCLIB_write( &file, file.buffer, 12 ) == 12 );
+ TESTCASE( close( file.handle ) != -1 );
+ /* Reading file back in */
+ TESTCASE( ( fd = open( "testfile", O_RDONLY ) ) != -1 );
+ memset( buffer, '\0', 13 );
+ TESTCASE( ( r = read( file.handle, (void *)buffer, 12 ) ) == 12 );
+ TESTCASE( strcmp( buffer, "Test output\n" ) == 0 );
+ TESTCASE( close( fd ) != -1 );
+ TESTCASE( unlink( "testfile" ) != -1 );