This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
PATCH: DG-style test case for libstdc++/12048, as installed
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- To: libstdc++ at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 26 Aug 2003 06:49:05 -0500 (CDT)
- Subject: PATCH: DG-style test case for libstdc++/12048, as installed
- Reply-to: rittle at labs dot mot dot com
Thanks Petur, you reminded me of the freopen trick. I also see that
you (and others?) advanced the ability to test pipe-style.
* testsuite/data/cin_unget-1.txt: New.
1234
* testsuite/27_io/objects/char/12048.cc: New.
// Derived from libstdc++/12048 by LJR <ljrittle@acm.org> with
// reminder from Petur Runolfsson <peturr02@ru.is>.
// <FSF copyright>
#include <iostream>
#include <testsuite_hooks.h>
void
test01()
{
std::freopen("cin_unget-1.txt", "r", stdin);
char c1;
char c2;
std::cin.get(c1);
std::cin.unget();
std::cin.get(c2);
VERIFY (c1 == c2);
}
int main(void)
{
test01();
return 0;
}