10 #include <mimetic/os/os.h>
16 class TEST_CLASS( test_file )
18 std::string m_text_fqn, m_bin_fqn;
21 : m_text_fqn("t.file.h"), m_bin_fqn("file.bin")
24 void TEST_FUNCTION( testFileStdFile )
27 File::iterator beg = a.begin(), end = a.end();
28 StdFile in(m_text_fqn);
29 StdFile::iterator _fbeg = in.begin(), _fend = in.end();
30 StdFile::iterator fbeg = _fbeg, fend = _fend;
31 for(; beg != end; ++beg, ++fbeg)
34 { // I don't want all bytes to be counted as test..
35 TEST_ASSERT_EQUALS_P(*beg, *fbeg);
38 TEST_ASSERT(beg == end && fbeg == fend);
40 void TEST_FUNCTION( testBinFileStdFile )
43 File::iterator beg = a.begin(), end = a.end();
44 StdFile in(m_bin_fqn);
45 StdFile::iterator fbeg = in.begin(), fend = in.end();
46 for(; beg != end; ++beg, ++fbeg)
49 { // I don't want all bytes to be counted as test..
50 TEST_ASSERT_EQUALS_P(*beg, *fbeg);
53 TEST_ASSERT(beg == end && fbeg == fend);
55 void TEST_FUNCTION( testStdFile )
57 std::ifstream ifs(m_text_fqn.c_str());
58 std::istreambuf_iterator<char> beg(ifs), end;
59 StdFile in(m_text_fqn);
60 StdFile::iterator fbeg = in.begin(), fend = in.end();
61 for(; beg != end; ++beg, ++fbeg)
64 { // I don't want all bytes to be counted as test..
65 TEST_ASSERT_EQUALS_P(*beg, *fbeg);
68 TEST_ASSERT(beg == end && fbeg == fend);
70 void TEST_FUNCTION( testFileIterator )
72 std::ifstream ifs(m_text_fqn.c_str());
73 std::istreambuf_iterator<char> beg(ifs), end;
75 File::iterator fbeg = in.begin(), fend = in.end();
76 for(; beg != end; ++beg, ++fbeg)
79 { // I don't want all bytes to be counted as test..
80 TEST_ASSERT_EQUALS_P(*beg, *fbeg);
83 TEST_ASSERT(beg == end && fbeg == fend);
85 void TEST_FUNCTION( testFileConstIterator )
87 std::ifstream ifs(m_text_fqn.c_str());
88 std::istreambuf_iterator<char> beg(ifs), end;
89 const File in(m_text_fqn);
90 File::const_iterator fbeg = in.begin(), fend = in.end();
91 for(; beg != end; ++beg, ++fbeg)
94 { // I don't want all bytes to be counted as test..
95 TEST_ASSERT_EQUALS_P(*beg, *fbeg);
98 TEST_ASSERT(beg == end && fbeg == fend);
100 void TEST_FUNCTION( testBinFileIterator )
102 std::ifstream ifs(m_bin_fqn.c_str());
103 std::istreambuf_iterator<char> beg(ifs), end;
105 File::iterator fbeg = in.begin(), fend = in.end();
106 for(; beg != end; ++beg, ++fbeg)
109 { // I don't want all bytes to be counted as test..
110 TEST_ASSERT_EQUALS_P(*beg, *fbeg);
113 TEST_ASSERT(beg == end && fbeg == fend);
115 void TEST_FUNCTION( testBinFileConstIterator )
117 std::ifstream ifs(m_bin_fqn.c_str());
118 std::istreambuf_iterator<char> beg(ifs), end;
119 const File in(m_bin_fqn);
120 File::const_iterator fbeg = in.begin(), fend = in.end();
121 for(; beg != end; ++beg, ++fbeg)
124 { // I don't want all bytes to be counted as test..
125 TEST_ASSERT_EQUALS_P(*beg, *fbeg);
128 TEST_ASSERT(beg == end && fbeg == fend);