source: trunk/test/parser.cc @ 130

Last change on this file since 130 was 105, checked in by Peter Johansson, 15 years ago

added test for new Parser class

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1// $Id: parser.cc 105 2006-06-27 09:51:44Z peter $
2
3/*
4  Copyright (C) 2006 Peter Johansson
5
6  This file is part of svnstat, http://lev.thep.lu.se/trac/svnstat
7
8  svnstat 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  svnstat 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 "Parser.h"
25
26#include <fstream>
27#include <iostream>
28
29int main(const int argc,const char* argv[])
30{
31  using namespace theplu::svnstat;
32  std::ostream* out;
33  if (argc>1 && argv[1]==std::string("-v"))
34    out = &std::cout;
35  else {
36    out = new std::ofstream("/dev/null");
37    if (argc>1)
38      std::cout << "parser -v : for printing extra information\n";
39  }
40  bool ok = true;
41
42  std::ifstream is("../lib/Parser.h");
43  Parser p(is);
44  for (size_t i=0; i<p.type().size(); ++i)
45    *out << i+1 << " " << p.type()[i] << std::endl;
46  is.close();
47
48  if (out!=&std::cout)
49    delete out;
50  return (ok ? 0 : -1);
51}
Note: See TracBrowser for help on using the repository browser.