diff options
Diffstat (limited to '')
-rw-r--r-- | src/tests/myriadfs.cpp | 24 | ||||
-rw-r--r-- | src/tests/uuid.cpp | 1 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/tests/myriadfs.cpp b/src/tests/myriadfs.cpp index fd96c02..5946b27 100644 --- a/src/tests/myriadfs.cpp +++ b/src/tests/myriadfs.cpp | |||
@@ -8,19 +8,41 @@ using namespace Bu; | |||
8 | 8 | ||
9 | int main( int argc, char *argv[] ) | 9 | int main( int argc, char *argv[] ) |
10 | { | 10 | { |
11 | Bu::MemBuf mb; | 11 | // Bu::MemBuf mb; |
12 | Bu::File mb("store.myr", File::Read|File::Write|File::Create ); | ||
12 | Bu::MyriadFs mfs( mb, 512 ); | 13 | Bu::MyriadFs mfs( mb, 512 ); |
13 | 14 | ||
15 | sio << "Creating dirs..." << sio.nl; | ||
16 | mfs.create("/etc", Bu::MyriadFs::typeDir|0755 ); | ||
17 | mfs.create("/dev", Bu::MyriadFs::typeDir|0755 ); | ||
18 | mfs.create("/usr", Bu::MyriadFs::typeDir|0755 ); | ||
19 | |||
20 | mfs.create("/dev/null", Bu::MyriadFs::typeChrDev|0666, 1, 3 ); | ||
21 | mfs.create("/dev/zero", Bu::MyriadFs::typeChrDev|0666, 1, 5 ); | ||
22 | mfs.create("/dev/sda", Bu::MyriadFs::typeBlkDev|0660, 8, 0 ); | ||
23 | |||
24 | sio << "Creating files..." << sio.nl; | ||
14 | { | 25 | { |
15 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); | 26 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); |
16 | ms.write("world!"); | 27 | ms.write("world!"); |
17 | } | 28 | } |
29 | { | ||
30 | Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); | ||
31 | ms.write("world, again!"); | ||
32 | } | ||
18 | 33 | ||
34 | sio << "Reading files..." << sio.nl; | ||
19 | { | 35 | { |
20 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); | 36 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); |
21 | char buf[512]; | 37 | char buf[512]; |
22 | buf[ms.read( buf, 512 )] = '\0'; | 38 | buf[ms.read( buf, 512 )] = '\0'; |
23 | sio << "read: '" << buf << "'" << sio.nl; | 39 | sio << "read: '" << buf << "'" << sio.nl; |
24 | } | 40 | } |
41 | { | ||
42 | Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); | ||
43 | char buf[512]; | ||
44 | buf[ms.read( buf, 512 )] = '\0'; | ||
45 | sio << "read: '" << buf << "'" << sio.nl; | ||
46 | } | ||
25 | } | 47 | } |
26 | 48 | ||
diff --git a/src/tests/uuid.cpp b/src/tests/uuid.cpp index b6470fa..d2f67b1 100644 --- a/src/tests/uuid.cpp +++ b/src/tests/uuid.cpp | |||
@@ -15,6 +15,7 @@ int main() | |||
15 | Uuid i = Uuid::gen(); | 15 | Uuid i = Uuid::gen(); |
16 | 16 | ||
17 | sio << i.toString() << sio.nl; | 17 | sio << i.toString() << sio.nl; |
18 | sio << "Version: " << i.getVersion() << sio.nl; | ||
18 | 19 | ||
19 | return 0; | 20 | return 0; |
20 | } | 21 | } |