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

Annotation of /branches/escript3047_with_pastix2995/escript/test/DataAlgorithmAdapterTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (hide annotations)
Wed Dec 15 07:08:39 2004 UTC (15 years ago) by jgs
Original Path: trunk/esys2/escript/test/DataAlgorithmAdapter/DataAlgorithmAdapterTestCase.cpp
File size: 2302 byte(s)
*** empty log message ***

1 jgs 102 // $Id$
2 jgs 82 /*
3     *****************************************************************************
4     * *
5     * COPYRIGHT ACcESS - All Rights Reserved *
6     * *
7     * This software is the property of ACcESS. No part of this code *
8     * may be copied in any form or by any means without the expressed written *
9     * consent of ACcESS. Copying, use or modification of this software *
10     * by any unauthorised person is illegal unless that person has a software *
11     * license agreement with ACcESS. *
12     * *
13     *****************************************************************************
14     */
15     #include "escript/Data/DataAlgorithm.h"
16     #include "DataAlgorithmAdapterTestCase.h"
17    
18     #include <iostream>
19     #include <algorithm>
20     #include <math.h>
21     #include <limits>
22    
23     using namespace CppUnitTest;
24     using namespace std;
25     using namespace escript;
26    
27     void DataAlgorithmAdapterTestCase::setUp() {
28     //
29     // This is called before each test is run
30    
31     }
32    
33     void DataAlgorithmAdapterTestCase::tearDown() {
34     //
35     // This is called after each test has been run
36    
37     }
38    
39     void DataAlgorithmAdapterTestCase::testAll() {
40 jgs 102
41 jgs 82 cout << endl;
42 jgs 102
43     cout << "\tTesting FMax." << endl;
44 jgs 82 DataAlgorithmAdapter<FMax> myMax(numeric_limits<double>::min());
45     myMax(1);
46     myMax(2);
47 jgs 102 myMax(14);
48 jgs 82 myMax(3);
49 jgs 102 assert(myMax.getResult()==14);
50    
51     cout << "\tTesting AbsMax." << endl;
52     DataAlgorithmAdapter<AbsMax> Lsup(0);
53 jgs 82 Lsup(-2);
54     Lsup(2);
55     Lsup(5);
56 jgs 102 Lsup(-10);
57     assert(Lsup.getResult()==10);
58    
59     cout << "\tTesting FMin." << endl;
60 jgs 82 DataAlgorithmAdapter<FMin> inf(numeric_limits<double>::max());
61     inf(1);
62 jgs 102 inf(12);
63 jgs 82 inf(2);
64 jgs 102 inf(99);
65     assert(inf.getResult()==1);
66    
67     cout << "\tSize: " << sizeof(DataAlgorithmAdapter<FMin>) << endl;
68    
69 jgs 82 }
70    
71     TestSuite* DataAlgorithmAdapterTestCase::suite ()
72     {
73     //
74     // create the suite of tests to perform.
75     TestSuite *testSuite = new TestSuite ("DataAlgorithmAdapterTestCase");
76    
77     testSuite->addTest (new TestCaller< DataAlgorithmAdapterTestCase>("testAll",&DataAlgorithmAdapterTestCase::testAll));
78     return testSuite;
79     }
80    

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26