217 |
01 Oct 06 |
peter |
// $Id$ |
217 |
01 Oct 06 |
peter |
2 |
|
217 |
01 Oct 06 |
peter |
3 |
/* |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2006, 2007 Peter Johansson |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2010, 2023 Peter Johansson |
217 |
01 Oct 06 |
peter |
7 |
|
687 |
04 Aug 08 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
217 |
01 Oct 06 |
peter |
9 |
|
217 |
01 Oct 06 |
peter |
svndigest is free software; you can redistribute it and/or modify it |
217 |
01 Oct 06 |
peter |
under the terms of the GNU General Public License as published by |
693 |
11 Sep 08 |
jari |
the Free Software Foundation; either version 3 of the License, or |
217 |
01 Oct 06 |
peter |
(at your option) any later version. |
217 |
01 Oct 06 |
peter |
14 |
|
217 |
01 Oct 06 |
peter |
svndigest is distributed in the hope that it will be useful, but |
217 |
01 Oct 06 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
217 |
01 Oct 06 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
217 |
01 Oct 06 |
peter |
General Public License for more details. |
217 |
01 Oct 06 |
peter |
19 |
|
217 |
01 Oct 06 |
peter |
You should have received a copy of the GNU General Public License |
693 |
11 Sep 08 |
jari |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
217 |
01 Oct 06 |
peter |
22 |
*/ |
217 |
01 Oct 06 |
peter |
23 |
|
1619 |
12 Mar 23 |
peter |
24 |
#include <config.h> |
1619 |
12 Mar 23 |
peter |
25 |
|
1162 |
13 Aug 10 |
peter |
26 |
#include "Suite.h" |
1162 |
13 Aug 10 |
peter |
27 |
|
1119 |
04 Jul 10 |
peter |
28 |
#include "lib/LineTypeParser.h" |
217 |
01 Oct 06 |
peter |
29 |
|
217 |
01 Oct 06 |
peter |
30 |
#include <iostream> |
217 |
01 Oct 06 |
peter |
31 |
#include <fstream> |
217 |
01 Oct 06 |
peter |
32 |
|
217 |
01 Oct 06 |
peter |
33 |
bool test(const std::string&, std::ostream&); |
217 |
01 Oct 06 |
peter |
34 |
|
1162 |
13 Aug 10 |
peter |
35 |
|
1162 |
13 Aug 10 |
peter |
36 |
int main(int argc, char* argv[]) |
217 |
01 Oct 06 |
peter |
37 |
{ |
1162 |
13 Aug 10 |
peter |
38 |
theplu::svndigest::test::Suite suite(argc, argv); |
217 |
01 Oct 06 |
peter |
39 |
std::ofstream os("parser.tmp"); |
1163 |
13 Aug 10 |
peter |
40 |
test("parser.cc",os); |
1163 |
13 Aug 10 |
peter |
41 |
test("Makefile.am",os); |
1163 |
13 Aug 10 |
peter |
42 |
test("../INSTALL",os); |
1162 |
13 Aug 10 |
peter |
43 |
return suite.exit_status(); |
217 |
01 Oct 06 |
peter |
44 |
} |
217 |
01 Oct 06 |
peter |
45 |
|
217 |
01 Oct 06 |
peter |
46 |
bool test(const std::string& file, std::ostream& os) |
217 |
01 Oct 06 |
peter |
47 |
{ |
217 |
01 Oct 06 |
peter |
48 |
using namespace theplu::svndigest; |
552 |
08 Jan 08 |
peter |
49 |
LineTypeParser parser(file); |
217 |
01 Oct 06 |
peter |
50 |
std::ifstream is(file.c_str()); |
217 |
01 Oct 06 |
peter |
51 |
for (size_t i=0; i<parser.type().size(); ++i){ |
552 |
08 Jan 08 |
peter |
52 |
if (parser.type()[i]==LineTypeParser::other) |
528 |
25 Dec 07 |
peter |
53 |
os << "other: "; |
552 |
08 Jan 08 |
peter |
54 |
else if (parser.type()[i]==LineTypeParser::comment) |
217 |
01 Oct 06 |
peter |
55 |
os << "comment: "; |
217 |
01 Oct 06 |
peter |
56 |
else |
217 |
01 Oct 06 |
peter |
57 |
os << "code: "; |
217 |
01 Oct 06 |
peter |
58 |
std::string str; |
217 |
01 Oct 06 |
peter |
59 |
getline(is, str); |
217 |
01 Oct 06 |
peter |
60 |
os << str << "\n"; |
217 |
01 Oct 06 |
peter |
61 |
} |
217 |
01 Oct 06 |
peter |
62 |
return true; |
217 |
01 Oct 06 |
peter |
63 |
} |