From f20a251240d72281565564ae54e3c7f3314a5030 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 11 Dec 2007 21:24:13 +0000 Subject: 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. --- src/tests/archive.cpp | 4 +-- src/tests/archive2.cpp | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 src/tests/archive2.cpp (limited to 'src/tests') 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 @@ * terms of the license contained in the file LICENSE. */ -#include "archive.h" -#include "file.h" +#include "bu/archive.h" +#include "bu/file.h" using namespace Bu; 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 @@ +#include "bu/archive.h" +#include "bu/archival.h" +#include "bu/file.h" + +int giId = 0; + +class A : public Bu::Archival +{ +public: + A() : + iId( giId++ ) + { + } + + virtual ~A() + { + } + + virtual void archive( Bu::Archive &ar ) + { + ar && iId; + } + + int iId; +}; + +class B : public Bu::Archival +{ +public: + B() : + iId( giId++ ), + a1( new A ), + a2( new A ) + { + } + + virtual ~B() + { + delete a1; + delete a2; + } + + virtual void archive( Bu::Archive &ar ) + { + //ar && iId && a1 && a2; + ar << iId << a1 << a2; + } + + int iId; + A *a1, *a2; +}; + +class C : public Bu::Archival +{ +public: + C() : + iId( giId++ ), + a( new A ), + b( new B ) + { + } + + virtual ~C() + { + delete a; + delete b; + } + + virtual void archive( Bu::Archive &ar ) + { + //ar && iId && a && b; + ar << iId; + ar << a << b; + } + + int iId; + A *a; + B *b; +}; + +void write() +{ + C *c = new C; + + Bu::File f( "test.archive", "wb"); + Bu::Archive ar( f, Bu::Archive::save ); + ar << c; +} + +int main() +{ + write(); + +} + -- cgit v1.2.3