David's final changes: more profiler features, fixes.
[ipdf/code.git] / src / tests / stresstest.cpp
1 #include "stresstest.h"
2 #include "real.h"
3 #include "progressbar.h"
4
5 using namespace std;
6 using namespace IPDF;
7
8 int main(int argc, char ** argv)
9 {
10         Debug("Repeated Adds and Subtracts - Should give zero");
11         
12         for (int i = 1; i < 100; ++i)
13         {
14                 for (int j = 1; j < 100; ++j)
15                 {
16                         Real result = AddSub(0, i, Real(1)/Real(j));
17                         if (result != Real(0))
18                                 Warn("Result of %lf != %lf (zero)", Double(result), 0.0);
19                                 
20                         printf("%d\t%lf\t%lf", i, Real(1)/Real(j), Double(result));
21                 }
22         }
23         
24         Debug("Repeated Multiplications and Divisions - Should give one");
25         for (int i = 1; i < 100; ++i)
26         {
27                 for (int j = 1; j < 100; ++j)
28                 {
29                         Real result = MulDiv(1, i, Real(1)/Real(j));
30                         if (result != Real(1))
31                                 Warn("Result of %lf != %lf (one)", Double(result), 1.0);
32                                 
33                         printf("%d\t%lf\t%lf", i, Real(1)/Real(j), Double(result));
34                 }
35         }
36
37 }
38

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