This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]