source: trunk/test/utility_test.cc @ 444

Last change on this file since 444 was 439, checked in by Peter Johansson, 16 years ago

Merged patch release 0.6.1 to the trunk. Delta 0.6.1 - 0.6

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1// $Id: utility_test.cc 439 2007-07-09 21:04:52Z peter $
2
3/*
4  Copyright (C) 2007 Peter Johansson
5
6  This file is part of svndigest, http://trac.thep.lu.se/trac/svndigest
7
8  svndigest is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12
13  svndigest is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA.
22*/
23
24#include "utility.h"
25
26#include <iostream>
27#include <string>
28
29bool test_hex(int, u_int, std::string);
30
31int main(const int argc,const char* argv[])
32{
33  bool ok=true;
34 
35  ok &= test_hex(15,2, "0f"); 
36  ok &= test_hex(17,1, "1"); 
37  ok &= test_hex(16,2, "10"); 
38
39  if (ok)
40    return 0;
41  return 1;
42}
43
44bool test_hex(int x, u_int w, std::string facit)
45{
46  if (theplu::svndigest::hex(x,w)==facit)
47    return true;
48  std::cerr << "hex(" << x << ", " << w << ") results "
49            << theplu::svndigest::hex(x,w) << ". Expects " << facit
50            << std::endl;
51  return false;
52}
Note: See TracBrowser for help on using the repository browser.