git.ucc.asn.au
/
ipdf
/
code.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
It works on the lab machines now, I swear.
[ipdf/code.git]
/
src
/
tests
/
saveload.cpp
diff --git
a/src/tests/saveload.cpp
b/src/tests/saveload.cpp
index
a2d58cb
..
60bfda6
100644
(file)
--- a/
src/tests/saveload.cpp
+++ b/
src/tests/saveload.cpp
@@
-1,32
+1,46
@@
-#include "../common.h"
-
-#include "../document.h"
-#include "../view.h"
-
-using namespace std;
-using namespace IPDF;
-
+#include "main.h"
+#include <unistd.h>
unsigned test_objects = 4;
unsigned test_objects = 4;
+void Cleanup()
+{
+ unlink("saveload.ipdf");
+}
+
int main(int argc, char ** argv)
{
int main(int argc, char ** argv)
{
+ Debug("TEST STARTING %s", argv[0]);
+ atexit(Cleanup);
srand(time(NULL));
Document doc;
for (unsigned id = 0; id < test_objects; ++id)
{
srand(time(NULL));
Document doc;
for (unsigned id = 0; id < test_objects; ++id)
{
- doc.Add(
Random(), Random(), Random(), Random(
));
+ doc.Add(
(ObjectType)(rand() % 2), Rect(Random(), Random(), Random(), Random()
));
}
}
- doc.Save("
test
.ipdf");
+ doc.Save("
saveload
.ipdf");
- Document equ("
test
.ipdf");
+ Document equ("
saveload
.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();
//doc.Add(Random(), Random(), Random(), Random());
if (doc != equ || equ != doc)
{
Error("Loaded document is not equivelant to saved document!");
doc.DebugDumpObjects();
equ.DebugDumpObjects();
+ Fatal("TEST FAILED");
}
}
+ doc.Add((ObjectType)(0), Rect());
+ if (doc == equ)
+ {
+ Error("Modified document is still equilant to saved document!?");
+ doc.DebugDumpObjects();
+ equ.DebugDumpObjects();
+ Fatal("TEST FAILED");
+ }
+ Debug("TEST SUCCESSFUL");
+ // Cleanup
return 0;
}
return 0;
}
+
+
UCC
git Repository :: git.ucc.asn.au