1379 |
16 Jul 08 |
peter |
// $Id$ |
1379 |
16 Jul 08 |
peter |
2 |
|
1379 |
16 Jul 08 |
peter |
3 |
/* |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2012 Peter Johansson |
1379 |
16 Jul 08 |
peter |
6 |
|
1469 |
02 Sep 08 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
1379 |
16 Jul 08 |
peter |
8 |
|
1379 |
16 Jul 08 |
peter |
The yat library is free software; you can redistribute it and/or |
1379 |
16 Jul 08 |
peter |
modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
published by the Free Software Foundation; either version 3 of the |
1379 |
16 Jul 08 |
peter |
License, or (at your option) any later version. |
1379 |
16 Jul 08 |
peter |
13 |
|
1379 |
16 Jul 08 |
peter |
The yat library is distributed in the hope that it will be useful, |
1379 |
16 Jul 08 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1379 |
16 Jul 08 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1379 |
16 Jul 08 |
peter |
General Public License for more details. |
1379 |
16 Jul 08 |
peter |
18 |
|
1379 |
16 Jul 08 |
peter |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
1379 |
16 Jul 08 |
peter |
21 |
*/ |
1379 |
16 Jul 08 |
peter |
22 |
|
2881 |
18 Nov 12 |
peter |
23 |
#include <config.h> |
2881 |
18 Nov 12 |
peter |
24 |
|
1379 |
16 Jul 08 |
peter |
25 |
#include "Suite.h" |
1379 |
16 Jul 08 |
peter |
26 |
|
1379 |
16 Jul 08 |
peter |
27 |
#include "yat/utility/DataWeight.h" |
1379 |
16 Jul 08 |
peter |
28 |
|
1379 |
16 Jul 08 |
peter |
29 |
using namespace theplu::yat; |
1379 |
16 Jul 08 |
peter |
30 |
|
1379 |
16 Jul 08 |
peter |
31 |
int main( int argc, char* argv[]) |
4200 |
19 Aug 22 |
peter |
32 |
{ |
1379 |
16 Jul 08 |
peter |
33 |
test::Suite suite(argc, argv); |
1379 |
16 Jul 08 |
peter |
34 |
suite.err() << "testing DataWeight" << std::endl; |
1379 |
16 Jul 08 |
peter |
35 |
|
1379 |
16 Jul 08 |
peter |
36 |
using utility::DataWeight; |
1379 |
16 Jul 08 |
peter |
37 |
|
1379 |
16 Jul 08 |
peter |
38 |
DataWeight x; |
1379 |
16 Jul 08 |
peter |
39 |
x.data()=3.14; |
1534 |
25 Sep 08 |
peter |
40 |
suite.add(suite.equal(x.data(),3.14)); |
1534 |
25 Sep 08 |
peter |
41 |
suite.add(suite.equal(x.weight(),1.0)); |
1379 |
16 Jul 08 |
peter |
42 |
DataWeight y(3.14); |
1379 |
16 Jul 08 |
peter |
43 |
y = DataWeight(3.14, 0.1); |
1534 |
25 Sep 08 |
peter |
44 |
suite.add(suite.equal(x.data(), y.data())); |
1534 |
25 Sep 08 |
peter |
45 |
if (!suite.add(x==y)) |
1534 |
25 Sep 08 |
peter |
46 |
suite.err() << "operator==\n"; |
1534 |
25 Sep 08 |
peter |
47 |
if (!suite.add(! (x!=y) )) |
1534 |
25 Sep 08 |
peter |
48 |
suite.err() << "operator!=\n"; |
1534 |
25 Sep 08 |
peter |
49 |
if (!suite.add(! (x<y) )) |
1534 |
25 Sep 08 |
peter |
50 |
suite.err() << "operator<\n"; |
1534 |
25 Sep 08 |
peter |
51 |
if (!suite.add(! (x>y) )) |
1534 |
25 Sep 08 |
peter |
52 |
suite.err() << "operator>\n"; |
1534 |
25 Sep 08 |
peter |
53 |
if (!suite.add(x<=y)) |
1534 |
25 Sep 08 |
peter |
54 |
suite.err() << "operator<=\n"; |
1534 |
25 Sep 08 |
peter |
55 |
if (!suite.add(x>=y)) |
1534 |
25 Sep 08 |
peter |
56 |
suite.err() << "operator>=\n"; |
1534 |
25 Sep 08 |
peter |
57 |
|
1379 |
16 Jul 08 |
peter |
58 |
DataWeight z(y); |
1379 |
16 Jul 08 |
peter |
59 |
|
1534 |
25 Sep 08 |
peter |
60 |
return suite.return_value(); |
1379 |
16 Jul 08 |
peter |
61 |
} |