/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) // // See accompanying file COPYING.TXT file for licensing details. // /////////////////////////////////////////////////////////////////////////////// //#define DEBUG_FILE_BUFFER #include "http_file_buffer.h" #include "test.h" #include #include #include #include char cfpos(int c) { return '0' + c % 10; } void test_read(std::istream &is,int &oldpos,int size) { //static_cast(is.rdbuf())->status("Before"); for(int i=oldpos;i size * 2) limit = size * 2; for(int i=0;i size) { chunk = size - pos; } switch(i%4) { case 0: is.seekg(pos); break; case 1: is.seekg(pos,std::ios_base::beg); break; case 2: is.seekg(pos - size,std::ios_base::end); break; case 3: is.seekg(pos - oldpos,std::ios_base::cur); break; } TEST(int(is.tellg()) == pos); for(int j=0;j 0) { int back = rand() % oldpos + 1; for(int i=0;i size * 2) limit = size * 2; for(int i=0;i size) chunk = size - csize; for(int i=0;i