#include <istream>
#include <fstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
const char name_01[] = "testsuite/ifstream_members-1.tst";
const char name_02[] = "testsuite/ifstream_members-1.txt";
-// http://sourceware.cygnus.com/ml/libstdc++/2000-06/msg00136.html
+// http://gcc.gnu.org/ml/libstdc++/2000-06/msg00136.html
bool test00()
{
bool test = true;
ifs1.close();
// false as expected:
- test &= !ifs1.is_open();
+ VERIFY( !ifs1.is_open() );
// this is now true:
- test &= !(ifs1);
+ VERIFY( !(ifs1) );
ifs1.open(name_01);
- test &= ifs1.is_open();
+ VERIFY( ifs1.is_open() );
// fail bit still true
- test &= !(ifs1);
- test &= ifs1.rdstate() == std::ios_base::failbit;
+ VERIFY( !(ifs1) );
+ VERIFY( ifs1.rdstate() == std::ios_base::failbit );
ifs1.close();
return test;
}
+// http://gcc.gnu.org/ml/libstdc++/2000-07/msg00004.html
+bool test01()
+{
+ bool test = true;
+ const int more_than_max_open_files = 8200;
+
+ for(int i = 0; ++i < more_than_max_open_files;)
+ {
+ std::ifstream ifs(name_01);
+ VERIFY( static_cast<bool>(ifs) );
+ }
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+
+ return test;
+}
+
+
int main()
{
test00();
+ test01();
}