Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FileIO.hh"
- #include <cxxtest/TestSuite.h>
- using namespace FileIO;
- class MyTestSuite15 : public CxxTest::TestSuite
- {
- FileIO<64> *test;
- public:
- void setUp()
- {
- this->test=new FileIO<64>((char *)"TestIO.data", (char *)"r+b");
- }
- void tearDown()
- {
- delete this->test;
- }
- void test_StackRead()
- {
- TS_ASSERT_EQUALS(test->StackRead(), (char *)"1 Hello World\n");
- for(int i=1; i < 5; i++)
- {
- test->StackRead();
- std::cout << ".";
- }
- TS_ASSERT(test->isEOF()==true);
- }
- void testHeapRead()
- {
- delete this->test;
- this->test=new FileIO<64>((char *)"TestIO.data", (char *)"r+b", 64);
- TS_ASSERT_EQUALS(test->HeapRead(), (char *)"1 Hello World\n");
- for(int i=1; i < 5; i++)
- {
- test->HeapRead();
- std::cout << ".";
- }
- TS_ASSERT(test->isEOF()==true);
- }
- void test_EOF()
- {
- for(int i=1; i < 5; i++)
- {
- test->StackRead();
- std::cout << ".";
- }
- TS_ASSERT(test->isEOF()==true);
- }
- //FileExists...
- void test_FileExistsTHIS_TRUE()
- {
- TS_ASSERT(test->file_exists()==true);
- }
- void test_FileExistsSTATIC_TRUE()
- {
- TS_ASSERT(FileIO<1>::file_exists((char *)"FileIO.hh")==true);
- }
- void test_FileExistsSTATIC_FALSE()
- {
- TS_ASSERT(FileIO<1>::file_exists((char *)"blablubxy<z1234.aewawsd")==false);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement