| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: t_fmemopen.c,v 1.4 2013/10/19 17:45:00 christos Exp $ */ | | 1 | /* $NetBSD: t_fmemopen.c,v 1.5 2021/07/10 07:50:33 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c)2010 Takehiko NOZAKI, | | 4 | * Copyright (c)2010 Takehiko NOZAKI, |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -954,27 +954,28 @@ ATF_TC_BODY(test19, tc) | | | @@ -954,27 +954,28 @@ ATF_TC_BODY(test19, tc) |
954 | for (i = 0; i < t->n; ++i) { | | 954 | for (i = 0; i < t->n; ++i) { |
955 | ATF_CHECK(ftello(fp) == (off_t)i); | | 955 | ATF_CHECK(ftello(fp) == (off_t)i); |
956 | ATF_CHECK(fputc(t->s[i], fp) == t->s[i]); | | 956 | ATF_CHECK(fputc(t->s[i], fp) == t->s[i]); |
957 | ATF_CHECK(buf[i] == t->s[i]); | | 957 | ATF_CHECK(buf[i] == t->s[i]); |
958 | ATF_CHECK(ftello(fp) == (off_t)i + 1); | | 958 | ATF_CHECK(ftello(fp) == (off_t)i + 1); |
959 | ATF_CHECK(buf[i] == t->s[i]); | | 959 | ATF_CHECK(buf[i] == t->s[i]); |
960 | #if !defined(__GLIBC__) | | 960 | #if !defined(__GLIBC__) |
961 | ATF_CHECK(buf[i + 1] == '\0'); | | 961 | ATF_CHECK(buf[i + 1] == '\0'); |
962 | #endif | | 962 | #endif |
963 | } | | 963 | } |
964 | | | 964 | |
965 | /* don't accept non nul character at end of buffer */ | | 965 | /* don't accept non nul character at end of buffer */ |
966 | ATF_CHECK(fputc(0x1, fp) == EOF); | | 966 | ATF_CHECK(fputc(0x1, fp) == EOF); |
967 | ATF_CHECK(ftello(fp) == (off_t)t->n); | | 967 | ATF_CHECK_MSG(ftello(fp) == (off_t)t->n, |
| | | 968 | "%td != %td", ftello(fp), (off_t)t->n); |
968 | ATF_CHECK(feof(fp) == 0); | | 969 | ATF_CHECK(feof(fp) == 0); |
969 | | | 970 | |
970 | /* accept nul character at end of buffer */ | | 971 | /* accept nul character at end of buffer */ |
971 | ATF_CHECK(fputc('\0', fp) == '\0'); | | 972 | ATF_CHECK(fputc('\0', fp) == '\0'); |
972 | ATF_CHECK(ftello(fp) == (off_t)t->n + 1); | | 973 | ATF_CHECK(ftello(fp) == (off_t)t->n + 1); |
973 | ATF_CHECK(feof(fp) == 0); | | 974 | ATF_CHECK(feof(fp) == 0); |
974 | | | 975 | |
975 | /* reach EOF */ | | 976 | /* reach EOF */ |
976 | ATF_CHECK(fputc('\0', fp) == EOF); | | 977 | ATF_CHECK(fputc('\0', fp) == EOF); |
977 | ATF_CHECK(ftello(fp) == (off_t)t->n + 1); | | 978 | ATF_CHECK(ftello(fp) == (off_t)t->n + 1); |
978 | | | 979 | |
979 | /* compare */ | | 980 | /* compare */ |
980 | ATF_CHECK(memcmp(&buf[0], t->s, t->n) == 0); | | 981 | ATF_CHECK(memcmp(&buf[0], t->s, t->n) == 0); |