#include <iostream>

#include <time.h>

#include <oess_1/defs/h/ex.hpp>

#include <oess_1/file/h/file.hpp>

void
do_test( oess_1::file::file_t & to )
	{
		static char buf[ 4096 ];

		clock_t s = clock();

		while( !to.eof() )
			{
				to.read( buf, sizeof( buf ) );
			}

		to.close();
		clock_t f = clock();

		std::cout << "time: " << double( f - s ) / CLOCKS_PER_SEC
			<< std::endl;
	}


int
main( int, char ** )
	{
		const std::string file_name = "test/bench/oess_file/test.dat";

		try
			{
				oess_1::file::file_t	f;
				f.open( file_name, false );

				do_test( f );
			}
		catch( const std::exception & x )
			{
				std::cerr << "### " << x.what() << " ###" << std::endl;
				return 1;
			}

		return 0;
	}

