From 80c8dd155a164c186fd11e3e3f66e8f3cfdf19fe Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 18 Feb 2011 00:19:07 +0000 Subject: Hey, a nifty little test for myriadfs. --- src/tests/myriadfs.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/tests/myriadfs.cpp (limited to 'src') diff --git a/src/tests/myriadfs.cpp b/src/tests/myriadfs.cpp new file mode 100644 index 0000000..fd96c02 --- /dev/null +++ b/src/tests/myriadfs.cpp @@ -0,0 +1,26 @@ +#include "bu/file.h" +#include "bu/membuf.h" +#include "bu/myriadfs.h" +#include "bu/myriadstream.h" +#include "bu/sio.h" + +using namespace Bu; + +int main( int argc, char *argv[] ) +{ + Bu::MemBuf mb; + Bu::MyriadFs mfs( mb, 512 ); + + { + Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); + ms.write("world!"); + } + + { + Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); + char buf[512]; + buf[ms.read( buf, 512 )] = '\0'; + sio << "read: '" << buf << "'" << sio.nl; + } +} + -- cgit v1.2.3