PATCH: DG-style test case for libstdc++/12048, as installed

Loren James Rittle rittle@latour.rsch.comm.mot.com
Tue Aug 26 11:49:00 GMT 2003


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;
}



More information about the Libstdc++ mailing list