source: branches/0.8-stable/test/graph_test.cc @ 1167

Last change on this file since 1167 was 1167, checked in by Peter Johansson, 11 years ago

closes #470

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1// $Id: graph_test.cc 1167 2010-08-14 01:01:50Z peter $
2
3/*
4  Copyright (C) 2010 Peter Johansson
5
6  This file is part of svndigest, http://dev.thep.lu.se/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 3 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 svndigest. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#include "Suite.h"
23
24#include "lib/Graph.h"
25
26#include <cstdlib>
27#include <ostream>
28
29using namespace theplu::svndigest;
30
31void test_graph(const std::string format, test::Suite& suite);
32void test_graph__(const std::string format, test::Suite& suite);
33
34int main(int argc, char* argv[])
35{
36  test::Suite suite(argc, argv);
37
38#ifndef HAVE_PLPLOT
39  suite.out() << "no plplot: skip test\n";
40  exit(EXIT_SKIP);
41#endif
42
43  test_graph("png", suite);
44  test_graph("svg", suite);
45  test_graph("pdf", suite);
46
47  // FIXME: in 0.9pre replace with
48  // return suite.exit_statu();
49  if (suite.ok())
50    return EXIT_SUCCESS;
51  return EXIT_FAILURE;
52}
53
54
55void test_graph(const std::string format, test::Suite& suite)
56{
57  suite.out() << "testing " << format << std::endl;
58  for (size_t i=0; i<20; ++i)
59    test_graph__(format, suite);
60}
61
62
63void test_graph__(const std::string format, test::Suite& suite)
64{
65  std::string filename("plot.");
66  filename+=format;
67  Graph graph(filename, format);
68  graph.ymax(10);
69  graph.current_color(255, 0, 0);
70  std::vector<unsigned int> data(100,1);
71  graph.plot(data, "label", 1);
72}
Note: See TracBrowser for help on using the repository browser.