1 | // $Id: data_weight_test.cc 1487 2008-09-10 08:41:36Z jari $ |
---|
2 | |
---|
3 | /* |
---|
4 | Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson |
---|
5 | Copyright (C) 2008 Peter Johansson |
---|
6 | |
---|
7 | This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
8 | |
---|
9 | The yat library is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU General Public License as |
---|
11 | published by the Free Software Foundation; either version 3 of the |
---|
12 | License, or (at your option) any later version. |
---|
13 | |
---|
14 | The yat library is distributed in the hope that it will be useful, |
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License |
---|
20 | along with yat. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | */ |
---|
22 | |
---|
23 | #include "Suite.h" |
---|
24 | |
---|
25 | #include "yat/utility/DataWeight.h" |
---|
26 | |
---|
27 | using namespace theplu::yat; |
---|
28 | |
---|
29 | int main( int argc, char* argv[]) |
---|
30 | { |
---|
31 | test::Suite suite(argc, argv); |
---|
32 | suite.err() << "testing DataWeight" << std::endl; |
---|
33 | |
---|
34 | using utility::DataWeight; |
---|
35 | |
---|
36 | DataWeight x; |
---|
37 | x.data()=3.14; |
---|
38 | suite.add(x.data()==3.14); |
---|
39 | suite.add(x.weight()==1.0); |
---|
40 | DataWeight y(3.14); |
---|
41 | y = DataWeight(3.14, 0.1); |
---|
42 | suite.add(x==y); |
---|
43 | suite.add(! (x!=y) ); |
---|
44 | suite.add(! (x<y) ); |
---|
45 | suite.add(! (x>y) ); |
---|
46 | suite.add(x<=y); |
---|
47 | suite.add(x>=y); |
---|
48 | DataWeight z(y); |
---|
49 | |
---|
50 | suite.return_value(); |
---|
51 | } |
---|