Implement document saving and loading
[ipdf/code.git] / src / tests / saveload.cpp
diff --git a/src/tests/saveload.cpp b/src/tests/saveload.cpp
new file mode 100644 (file)
index 0000000..a2d58cb
--- /dev/null
@@ -0,0 +1,32 @@
+#include "../common.h"
+
+#include "../document.h"
+#include "../view.h"
+
+using namespace std;
+using namespace IPDF;
+
+unsigned test_objects = 4;
+
+int main(int argc, char ** argv)
+{
+       srand(time(NULL));
+       Document doc;
+       for (unsigned id = 0; id < test_objects; ++id)
+       {
+               doc.Add(Random(), Random(), Random(), Random());
+       }
+       doc.Save("test.ipdf");
+
+       Document equ("test.ipdf");
+       //doc.Add(Random(), Random(), Random(), Random());
+       if (doc != equ || equ != doc)
+       {
+               Error("Loaded document is not equivelant to saved document!");
+               doc.DebugDumpObjects();
+               equ.DebugDumpObjects();
+       }
+       
+
+       return 0;
+}

UCC git Repository :: git.ucc.asn.au