source: trunk/test/data_weight_test.cc @ 1379

Last change on this file since 1379 was 1379, checked in by Peter, 13 years ago

adding DataWeight? - a class to store a data value together with its weight

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1// $Id: data_weight_test.cc 1379 2008-07-16 21:41:58Z peter $
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://trac.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 2 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 this program; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22  02111-1307, USA.
23*/
24
25#include "Suite.h"
26
27#include "yat/utility/DataWeight.h"
28
29using namespace theplu::yat;
30
31int main( int argc, char* argv[])
32{ 
33  test::Suite suite(argc, argv);
34  suite.err() << "testing DataWeight" << std::endl;
35
36  using utility::DataWeight;
37
38  DataWeight x;
39  x.data()=3.14;
40  suite.add(x.data()==3.14);
41  suite.add(x.weight()==1.0);
42  DataWeight y(3.14);
43  y = DataWeight(3.14, 0.1);
44  suite.add(x==y);
45  suite.add(! (x!=y) );
46  suite.add(! (x<y) );
47  suite.add(! (x>y) );
48  suite.add(x<=y);
49  suite.add(x>=y);
50  DataWeight z(y);
51
52  suite.return_value();
53}
Note: See TracBrowser for help on using the repository browser.