aboutsummaryrefslogtreecommitdiff
path: root/src/unit/taf.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
committerMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
commitac517a2b7625e0aa0862679e961c6349f859ea3b (patch)
treee3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/unit/taf.cpp
parentf8d4301e9fa4f3709258505941e37fab2eadadc6 (diff)
parentbd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff)
downloadlibbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to '')
-rw-r--r--src/unit/taf.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp
new file mode 100644
index 0000000..5e0e914
--- /dev/null
+++ b/src/unit/taf.cpp
@@ -0,0 +1,48 @@
1#include "unitsuite.h"
2#include "file.h"
3#include "tafreader.h"
4
5#include <string.h>
6#include <unistd.h>
7
8class Unit : public Bu::UnitSuite
9{
10public:
11 Unit()
12 {
13 setName("taf");
14 addTest( Unit::read1 );
15 }
16
17 virtual ~Unit()
18 {
19 }
20
21 void read1()
22 {
23#define FN_TMP ("/tmp/tmpXXXXXXXX")
24 Bu::FString sFnTmp(FN_TMP);
25 Bu::File fOut = Bu::File::tempFile( sFnTmp, "wb" );
26 const char *data =
27"{test: name=\"Bob\"}"
28;
29 fOut.write(data,strlen(data));
30 fOut.close();
31
32 Bu::File fIn(sFnTmp.c_str(), "rb");
33 Bu::TafReader tr(fIn);
34
35 Bu::TafGroup *tn = tr.readGroup();
36 unitTest( !strcmp("Bob", tn->getProperty("name").c_str()) );
37 delete tn;
38
39 unlink(sFnTmp.c_str());
40#undef FN_TMP
41 }
42};
43
44int main( int argc, char *argv[] )
45{
46 return Unit().run( argc, argv );
47}
48