Commit before breaking everything
[ipdf/code.git] / src / tests / stresstest.cpp
diff --git a/src/tests/stresstest.cpp b/src/tests/stresstest.cpp
new file mode 100644 (file)
index 0000000..4f757ca
--- /dev/null
@@ -0,0 +1,38 @@
+#include "stresstest.h"
+#include "real.h"
+#include "progressbar.h"
+
+using namespace std;
+using namespace IPDF;
+
+int main(int argc, char ** argv)
+{
+       Debug("Repeated Adds and Subtracts - Should give zero");
+       
+       for (int i = 1; i < 100; ++i)
+       {
+               for (int j = 1; j < 100; ++j)
+               {
+                       Real result = AddSub(0, i, Real(1)/Real(j));
+                       if (result != Real(0))
+                               Warn("Result of %lf != %lf (zero)", Double(result), 0.0);
+                               
+                       printf("%d\t%lf\t%lf", i, Real(1)/Real(j), Double(result));
+               }
+       }
+       
+       Debug("Repeated Multiplications and Divisions - Should give one");
+       for (int i = 1; i < 100; ++i)
+       {
+               for (int j = 1; j < 100; ++j)
+               {
+                       Real result = MulDiv(1, i, Real(1)/Real(j));
+                       if (result != Real(1))
+                               Warn("Result of %lf != %lf (one)", Double(result), 1.0);
+                               
+                       printf("%d\t%lf\t%lf", i, Real(1)/Real(j), Double(result));
+               }
+       }
+
+}
+

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