/[escript]/branches/RW_WIN32/escript/test/DataAlgorithmAdapterTestCase.cpp
ViewVC logotype

Diff of /branches/RW_WIN32/escript/test/DataAlgorithmAdapterTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 106 by jgs, Thu Dec 23 07:20:12 2004 UTC revision 108 by jgs, Thu Jan 27 06:21:59 2005 UTC
# Line 40  void DataAlgorithmAdapterTestCase::testA Line 40  void DataAlgorithmAdapterTestCase::testA
40    
41    cout << endl;    cout << endl;
42    
   cout << "\tSize: " << sizeof(DataAlgorithmAdapter<FMin>) << endl;  
   
43    cout << "\tTesting FMax." << endl;    cout << "\tTesting FMax." << endl;
44    DataAlgorithmAdapter<FMax> sup(numeric_limits<double>::min());  
45      FMax fmax;
46      assert(fmax(5,6)==6);
47      assert(fmax(5,-6)==5);
48      assert(fmax(0,0)==0);
49      assert(fmax(15,-96)==15);
50    
51      DataAlgorithmAdapter<FMax> sup(numeric_limits<double>::max()*-1);
52    sup.resetResult();    sup.resetResult();
53    sup(1);    sup(-1);
54    sup(2);    sup(-2);
55    sup(14);    sup(-14);
56    sup(3);    sup(3);
57    assert(sup.getResult()==14);    assert(sup.getResult()==3);
58    
59    cout << "\tTesting AbsMax." << endl;    cout << "\tTesting AbsMax." << endl;
60    
61      AbsMax absmax;
62      assert(absmax(5,6)==6);
63      assert(absmax(5,-6)==6);
64      assert(absmax(0,0)==0);
65      assert(absmax(15,-96)==96);
66    
67    DataAlgorithmAdapter<AbsMax> Lsup(0);    DataAlgorithmAdapter<AbsMax> Lsup(0);
68    Lsup.resetResult();    Lsup.resetResult();
69    Lsup(-2);    Lsup(-2);
# Line 61  void DataAlgorithmAdapterTestCase::testA Line 73  void DataAlgorithmAdapterTestCase::testA
73    assert(Lsup.getResult()==10);    assert(Lsup.getResult()==10);
74    
75    cout << "\tTesting FMin." << endl;    cout << "\tTesting FMin." << endl;
76    
77      FMin fmin;
78      assert(fmin(5,6)==5);
79      assert(fmin(5,-6)==-6);
80      assert(fmin(0,0)==0);
81      assert(fmin(15,-96)==-96);
82    
83    DataAlgorithmAdapter<FMin> inf(numeric_limits<double>::max());    DataAlgorithmAdapter<FMin> inf(numeric_limits<double>::max());
84    inf.resetResult();    inf.resetResult();
85    inf(1);    inf(1);
# Line 70  void DataAlgorithmAdapterTestCase::testA Line 89  void DataAlgorithmAdapterTestCase::testA
89    assert(inf.getResult()==1);    assert(inf.getResult()==1);
90    
91    cout << "\tTesting Length." << endl;    cout << "\tTesting Length." << endl;
92    
93      Length lngth;
94      assert(lngth(5,6)==std::sqrt(61.0));
95      assert(lngth(5,-6)==std::sqrt(61.0));
96      assert(lngth(0,0)==std::sqrt(0.0));
97      assert(lngth(15,-96)==std::sqrt(9441.0));
98    
99    DataAlgorithmAdapter<Length> length(0);    DataAlgorithmAdapter<Length> length(0);
100    length.resetResult();    length.resetResult();
101    length(2);    length(2);
# Line 85  void DataAlgorithmAdapterTestCase::testA Line 111  void DataAlgorithmAdapterTestCase::testA
111    assert(length.getResult()==std::sqrt(41.0));    assert(length.getResult()==std::sqrt(41.0));
112    
113    cout << "\tTesting Trace." << endl;    cout << "\tTesting Trace." << endl;
114    
115      Trace trce;
116      assert(trce(5,6)==11);
117      assert(trce(5,-6)==-1);
118      assert(trce(0,0)==0);
119      assert(trce(15,-96)==-81);
120    
121    DataAlgorithmAdapter<Trace> trace(0);    DataAlgorithmAdapter<Trace> trace(0);
122    trace.resetResult();    trace.resetResult();
123    trace(1);    trace(1);

Legend:
Removed from v.106  
changed lines
  Added in v.108

  ViewVC Help
Powered by ViewVC 1.1.26