| 1 | tim | 1584 | #include <iostream> | 
| 2 |  |  | #include <string> | 
| 3 |  |  |  | 
| 4 | tim | 1578 | #include "io/basic_ifstrstream.hpp" | 
| 5 |  |  | #include "IfstrstreamTestCase.hpp" | 
| 6 | tim | 1584 |  | 
| 7 | tim | 1578 | // Registers the fixture into the 'registry' | 
| 8 | tim | 1584 |  | 
| 9 |  |  | using namespace std; | 
| 10 | tim | 1580 | using namespace oopse; | 
| 11 | tim | 1578 | CPPUNIT_TEST_SUITE_REGISTRATION( IfstrstreamTestCase ); | 
| 12 |  |  |  | 
| 13 |  |  | #ifndef IS_MPI | 
| 14 |  |  | void IfstrstreamTestCase::setUp() { | 
| 15 |  |  |  | 
| 16 | tim | 1584 |  | 
| 17 | tim | 1578 | } | 
| 18 |  |  |  | 
| 19 |  |  | void IfstrstreamTestCase::tearDown() { | 
| 20 |  |  |  | 
| 21 |  |  | } | 
| 22 |  |  |  | 
| 23 |  |  |  | 
| 24 |  |  | void IfstrstreamTestCase::testConstructor() { | 
| 25 | tim | 1584 | ifstrstream fin1; | 
| 26 |  |  | fin1.open("DUFF.frc"); | 
| 27 |  |  | CPPUNIT_ASSERT(fin1.is_open()); | 
| 28 | tim | 1578 |  | 
| 29 | tim | 1584 | 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 | tim | 1578 | } | 
| 39 |  |  |  | 
| 40 |  |  | void IfstrstreamTestCase::testOpen() { | 
| 41 | tim | 1584 | const int MAXLEN = 1024; | 
| 42 |  |  | char buffer[MAXLEN]; | 
| 43 | tim | 1578 |  | 
| 44 | tim | 1584 | 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 | tim | 1578 | } | 
| 53 |  |  |  | 
| 54 |  |  | void IfstrstreamTestCase::testIs_open() { | 
| 55 |  |  |  | 
| 56 |  |  | } | 
| 57 |  |  |  | 
| 58 |  |  | void IfstrstreamTestCase::testClose() { | 
| 59 |  |  |  | 
| 60 |  |  | } | 
| 61 |  |  |  | 
| 62 |  |  | #else | 
| 63 |  |  | void IfstrstreamTestCase::setUp() { | 
| 64 |  |  |  | 
| 65 |  |  | } | 
| 66 |  |  |  | 
| 67 |  |  | void IfstrstreamTestCase::tearDown() { | 
| 68 |  |  |  | 
| 69 |  |  | } | 
| 70 |  |  |  | 
| 71 |  |  | void IfstrstreamTestCase::testMasterConstructor() { | 
| 72 | tim | 1584 | 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 | tim | 1578 | } | 
| 85 |  |  |  | 
| 86 |  |  | void IfstrstreamTestCase::testMasterOpen() { | 
| 87 |  |  |  | 
| 88 |  |  | } | 
| 89 |  |  |  | 
| 90 |  |  | void IfstrstreamTestCase::testMasterIs_open() { | 
| 91 |  |  |  | 
| 92 |  |  | } | 
| 93 |  |  |  | 
| 94 |  |  | void IfstrstreamTestCase::testMasterClose() { | 
| 95 |  |  |  | 
| 96 |  |  |  | 
| 97 |  |  | } | 
| 98 |  |  |  | 
| 99 |  |  | void IfstrstreamTestCase::testSlaveConstructor() { | 
| 100 |  |  |  | 
| 101 |  |  | } | 
| 102 |  |  |  | 
| 103 |  |  | void IfstrstreamTestCase::testSlaveOpen() { | 
| 104 |  |  |  | 
| 105 |  |  | } | 
| 106 |  |  |  | 
| 107 |  |  | void IfstrstreamTestCase::testSlaveIs_open() { | 
| 108 |  |  |  | 
| 109 |  |  | } | 
| 110 |  |  |  | 
| 111 |  |  | void IfstrstreamTestCase::testSlaveClose() { | 
| 112 |  |  |  | 
| 113 |  |  |  | 
| 114 |  |  | } | 
| 115 |  |  | #endif |