source: trunk/test/data_weight_test.cc @ 1534

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

fixed some bugs in DataWeight?

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1// $Id: data_weight_test.cc 1534 2008-09-25 18:24:28Z 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://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
27using namespace theplu::yat;
28
29int 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(suite.equal(x.data(),3.14));
39  suite.add(suite.equal(x.weight(),1.0));
40  DataWeight y(3.14);
41  y = DataWeight(3.14, 0.1);
42  suite.add(suite.equal(x.data(), y.data()));
43  if (!suite.add(x==y))
44    suite.err() << "operator==\n";
45  if (!suite.add(! (x!=y) ))
46    suite.err() << "operator!=\n";
47  if (!suite.add(! (x<y) ))
48    suite.err() << "operator<\n";
49  if (!suite.add(! (x>y) ))
50    suite.err() << "operator>\n";
51  if (!suite.add(x<=y))
52    suite.err() << "operator<=\n";
53  if (!suite.add(x>=y))
54    suite.err() << "operator>=\n";
55
56  DataWeight z(y);
57
58  return suite.return_value();
59}
Note: See TracBrowser for help on using the repository browser.