aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-12-11 21:24:13 +0000
committerMike Buland <eichlan@xagasoft.com>2007-12-11 21:24:13 +0000
commitf20a251240d72281565564ae54e3c7f3314a5030 (patch)
treeaf928e4281a5254ae5d613a12c7ec2a4abf090ca /src/tests
parent5808ca2e7422b58ad12436658ede52d61503426e (diff)
downloadlibbu++-f20a251240d72281565564ae54e3c7f3314a5030.tar.gz
libbu++-f20a251240d72281565564ae54e3c7f3314a5030.tar.bz2
libbu++-f20a251240d72281565564ae54e3c7f3314a5030.tar.xz
libbu++-f20a251240d72281565564ae54e3c7f3314a5030.zip
Fixed the bu directory, now the code should compile and be usable even
installed. That was odd. Anyway, also set props on the bu, unit, and test directories so that the contents won't be listed on svn status.
Diffstat (limited to '')
-rw-r--r--src/tests/archive.cpp4
-rw-r--r--src/tests/archive2.cpp95
2 files changed, 97 insertions, 2 deletions
diff --git a/src/tests/archive.cpp b/src/tests/archive.cpp
index b2778f1..10bb834 100644
--- a/src/tests/archive.cpp
+++ b/src/tests/archive.cpp
@@ -5,8 +5,8 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include "archive.h" 8#include "bu/archive.h"
9#include "file.h" 9#include "bu/file.h"
10 10
11using namespace Bu; 11using namespace Bu;
12 12
diff --git a/src/tests/archive2.cpp b/src/tests/archive2.cpp
new file mode 100644
index 0000000..6d3c2c1
--- /dev/null
+++ b/src/tests/archive2.cpp
@@ -0,0 +1,95 @@
1#include "bu/archive.h"
2#include "bu/archival.h"
3#include "bu/file.h"
4
5int giId = 0;
6
7class A : public Bu::Archival
8{
9public:
10 A() :
11 iId( giId++ )
12 {
13 }
14
15 virtual ~A()
16 {
17 }
18
19 virtual void archive( Bu::Archive &ar )
20 {
21 ar && iId;
22 }
23
24 int iId;
25};
26
27class B : public Bu::Archival
28{
29public:
30 B() :
31 iId( giId++ ),
32 a1( new A ),
33 a2( new A )
34 {
35 }
36
37 virtual ~B()
38 {
39 delete a1;
40 delete a2;
41 }
42
43 virtual void archive( Bu::Archive &ar )
44 {
45 //ar && iId && a1 && a2;
46 ar << iId << a1 << a2;
47 }
48
49 int iId;
50 A *a1, *a2;
51};
52
53class C : public Bu::Archival
54{
55public:
56 C() :
57 iId( giId++ ),
58 a( new A ),
59 b( new B )
60 {
61 }
62
63 virtual ~C()
64 {
65 delete a;
66 delete b;
67 }
68
69 virtual void archive( Bu::Archive &ar )
70 {
71 //ar && iId && a && b;
72 ar << iId;
73 ar << a << b;
74 }
75
76 int iId;
77 A *a;
78 B *b;
79};
80
81void write()
82{
83 C *c = new C;
84
85 Bu::File f( "test.archive", "wb");
86 Bu::Archive ar( f, Bu::Archive::save );
87 ar << c;
88}
89
90int main()
91{
92 write();
93
94}
95