diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-02-18 00:19:07 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-02-18 00:19:07 +0000 |
commit | 80c8dd155a164c186fd11e3e3f66e8f3cfdf19fe (patch) | |
tree | 643035830a426afaf98de508e4c9c65b859f8cf1 | |
parent | bcfb40dde37a69139ef7ea2748ccfa642d3bee53 (diff) | |
download | libbu++-80c8dd155a164c186fd11e3e3f66e8f3cfdf19fe.tar.gz libbu++-80c8dd155a164c186fd11e3e3f66e8f3cfdf19fe.tar.bz2 libbu++-80c8dd155a164c186fd11e3e3f66e8f3cfdf19fe.tar.xz libbu++-80c8dd155a164c186fd11e3e3f66e8f3cfdf19fe.zip |
Hey, a nifty little test for myriadfs.
Diffstat (limited to '')
-rw-r--r-- | src/tests/myriadfs.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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 @@ | |||
1 | #include "bu/file.h" | ||
2 | #include "bu/membuf.h" | ||
3 | #include "bu/myriadfs.h" | ||
4 | #include "bu/myriadstream.h" | ||
5 | #include "bu/sio.h" | ||
6 | |||
7 | using namespace Bu; | ||
8 | |||
9 | int main( int argc, char *argv[] ) | ||
10 | { | ||
11 | Bu::MemBuf mb; | ||
12 | Bu::MyriadFs mfs( mb, 512 ); | ||
13 | |||
14 | { | ||
15 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); | ||
16 | ms.write("world!"); | ||
17 | } | ||
18 | |||
19 | { | ||
20 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); | ||
21 | char buf[512]; | ||
22 | buf[ms.read( buf, 512 )] = '\0'; | ||
23 | sio << "read: '" << buf << "'" << sio.nl; | ||
24 | } | ||
25 | } | ||
26 | |||