ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/test/io/IfstrstreamTestCase.cpp
(Generate patch)

Comparing trunk/OOPSE-4/test/io/IfstrstreamTestCase.cpp (file contents):
Revision 1580 by tim, Fri Oct 15 20:34:21 2004 UTC vs.
Revision 1584 by tim, Fri Oct 15 21:11:35 2004 UTC

# Line 1 | Line 1
1 + #include <iostream>
2 + #include <string>
3 +
4   #include "io/basic_ifstrstream.hpp"
5   #include "IfstrstreamTestCase.hpp"
6 +
7   // Registers the fixture into the 'registry'
8 +
9 + using namespace std;
10   using namespace oopse;
11   CPPUNIT_TEST_SUITE_REGISTRATION( IfstrstreamTestCase );
12  
13   #ifndef IS_MPI
14   void IfstrstreamTestCase::setUp() {
15  
16 +    
17   }
18  
19   void IfstrstreamTestCase::tearDown() {
# Line 15 | Line 22 | void IfstrstreamTestCase::testConstructor() {
22  
23  
24   void IfstrstreamTestCase::testConstructor() {
25 +    ifstrstream fin1;
26 +    fin1.open("DUFF.frc");
27 +    CPPUNIT_ASSERT(fin1.is_open());
28  
29 +    ifstrstream fin2;
30 +    fin2.open("NonExistFile");
31 +    CPPUNIT_ASSERT(!fin2.is_open());
32 +
33 +    ifstrstream fin3("DUFF.frc");
34 +    CPPUNIT_ASSERT(fin3.is_open());
35 +
36 +    ifstrstream fin4("NonExistFile");
37 +    CPPUNIT_ASSERT(!fin4.is_open());
38   }
39  
40   void IfstrstreamTestCase::testOpen() {
41 +    const int MAXLEN = 1024;
42 +    char buffer[MAXLEN];
43  
44 +    string firstLine = "! This is the forcefield file for the Dipolar Unified-atom Force Field (DUFF).";
45 +
46 +    ifstrstream fin1;
47 +    fin1.open("DUFF.frc");
48 +
49 +    fin1.getline(buffer, MAXLEN);
50 +    CPPUNIT_ASSERT(buffer == firstLine);
51 +    cout << buffer;
52   }
53  
54   void IfstrstreamTestCase::testIs_open() {
# Line 40 | Line 69 | void IfstrstreamTestCase::testMasterConstructor() {
69   }
70  
71   void IfstrstreamTestCase::testMasterConstructor() {
72 <    ifstrstream in;
72 >    const int MAXLEN = 1024;
73 >    char buffer[MAXLEN];
74 >
75 >    string firstLine = "! This is the forcefield file for the Dipolar Unified-atom Force Field (DUFF).";
76 >
77 >    ifstrstream fin1;
78 >    fin1.open("DUFF.frc");
79 >
80 >    fin1.getline(buffer, MAXLEN);
81 >    CPPUNIT_ASSERT(buffer == firstLine);
82 >    cout << buffer;
83 >    
84   }    
85  
86   void IfstrstreamTestCase::testMasterOpen() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines