fmemopen2_test.c (291840) | fmemopen2_test.c (291870) |
---|---|
1/*- 2Copyright (C) 2013 Pietro Cerutti <gahr@FreeBSD.org> 3 4Redistribution and use in source and binary forms, with or without 5modification, are permitted provided that the following conditions 6are met: 71. Redistributions of source code must retain the above copyright 8 notice, this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24*/ 25 26/* 27 * Test basic FILE * functions (fread, fwrite, fseek, fclose) against 28 * a FILE * retrieved using fmemopen() 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2Copyright (C) 2013 Pietro Cerutti <gahr@FreeBSD.org> 3 4Redistribution and use in source and binary forms, with or without 5modification, are permitted provided that the following conditions 6are met: 71. Redistributions of source code must retain the above copyright 8 notice, this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24*/ 25 26/* 27 * Test basic FILE * functions (fread, fwrite, fseek, fclose) against 28 * a FILE * retrieved using fmemopen() 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: stable/10/lib/libc/tests/stdio/fmemopen2_test.c 291840 2015-12-05 04:17:40Z ngie $"); | 32__FBSDID("$FreeBSD: stable/10/lib/libc/tests/stdio/fmemopen2_test.c 291870 2015-12-05 21:49:35Z ngie $"); |
33 34#include <errno.h> 35#include <stdio.h> 36#include <string.h> 37#include <strings.h> 38 39#include <atf-c.h> 40 --- 58 unchanged lines hidden (view full) --- 99 /* Check that the string was not modified after the first 4 bytes. */ 100 ATF_REQUIRE(strcmp(str, str3) == 0); 101} 102 103ATF_TC_WITHOUT_HEAD(test_autoalloc); 104ATF_TC_BODY(test_autoalloc, tc) 105{ 106 /* Let fmemopen allocate the buffer. */ | 33 34#include <errno.h> 35#include <stdio.h> 36#include <string.h> 37#include <strings.h> 38 39#include <atf-c.h> 40 --- 58 unchanged lines hidden (view full) --- 99 /* Check that the string was not modified after the first 4 bytes. */ 100 ATF_REQUIRE(strcmp(str, str3) == 0); 101} 102 103ATF_TC_WITHOUT_HEAD(test_autoalloc); 104ATF_TC_BODY(test_autoalloc, tc) 105{ 106 /* Let fmemopen allocate the buffer. */ |
107 char str[] = "A quick test"; | |
108 FILE *fp; 109 long pos; | 107 FILE *fp; 108 long pos; |
110 size_t nofw, nofr, i; | 109 size_t nofw, i; |
111 int rc; 112 113 /* Open a FILE * using fmemopen. */ 114 fp = fmemopen(NULL, 512, "w+"); 115 ATF_REQUIRE(fp != NULL); 116 117 /* fill the buffer */ 118 for (i = 0; i < 512; i++) { --- 168 unchanged lines hidden --- | 110 int rc; 111 112 /* Open a FILE * using fmemopen. */ 113 fp = fmemopen(NULL, 512, "w+"); 114 ATF_REQUIRE(fp != NULL); 115 116 /* fill the buffer */ 117 for (i = 0; i < 512; i++) { --- 168 unchanged lines hidden --- |