27 #include "boost/iostreams/flush.hpp"
28 #include <boost/filesystem/operations.hpp>
31 using namespace pwiz::util;
37 const char*
textBrown_ =
"The quick brown fox jumps over the lazy dog";
38 const char*
hashBrown_ =
"2fd4e1c67a2d28fced849ee1bb76e7391b93eb12";
47 string hash = sha1os.
hash();
50 if (
os_) *
os_ <<
"str: " << oss.str() << endl
51 <<
"hash: " << hash << endl;
61 if (
os_) *
os_ <<
"str: " << oss.str() << endl
62 <<
"hash: " << hash << endl;
71 string filename =
"SHA1_ostream.temp.txt";
72 ofstream ofs(filename.c_str(), ios::binary);
76 string hashStream = sha1os.hash();
78 sha1os.explicitFlush();
81 if (
os_) *
os_ <<
"stream: " << hashStream << endl
82 <<
"file : " << hashFile << endl;
85 unit_assert(hashStream ==
"a159e6cde4e50e51713700d1fe4d0ce553eace87");
87 boost::filesystem::remove(filename);
91 int main(
int argc,
char* argv[])
97 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;