~sharpie/geos/3.3.2

« back to all changes in this revision

Viewing changes to source/test/XMLTester.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabio Tranchitella
  • Date: 2006-11-06 21:35:52 UTC
  • mfrom: (3.1.3 feisty)
  • Revision ID: james.westby@ubuntu.com-20061106213552-m03o92ggj1na737b
Tags: 2.2.3-3
debian/control: move doxygen from build-depends-indep to build-depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
 * $Id: XMLTester.h,v 1.1.2.1.2.2 2006/03/06 14:54:19 strk Exp $
 
3
 *
 
4
 * GEOS - Geometry Engine Open Source
 
5
 * http://geos.refractions.net
 
6
 *
 
7
 * Copyright (C) 2005 Refractions Research Inc.
 
8
 *
 
9
 * This is free software; you can redistribute and/or modify it under
 
10
 * the terms of the GNU Lesser General Public Licence as published
 
11
 * by the Free Software Foundation. 
 
12
 * See the COPYING file for more information.
 
13
 *
 
14
 **********************************************************************/
 
15
 
 
16
#ifndef __XMLTESTER_H__
 
17
#define __XMLTESTER_H__
 
18
 
 
19
using namespace geos;
 
20
 
 
21
class XMLTester {
 
22
 
 
23
private:
 
24
        enum {
 
25
                SHOW_RUN_INFO=1,
 
26
                SHOW_CASE,
 
27
                SHOW_TEST,
 
28
                SHOW_RESULT,
 
29
                SHOW_GEOMS,
 
30
                SHOW_GEOMS_FULL,
 
31
                PRED
 
32
        };
 
33
 
 
34
        void parsePrecisionModel();
 
35
        void parseCase();
 
36
        void parseTest();
 
37
        void runPredicates(const Geometry *a, const Geometry *b);
 
38
        Geometry *parseGeometry(const std::string &in);
 
39
        static std::string trimBlanks(const std::string &in);
 
40
 
 
41
        Geometry *gA;
 
42
        Geometry *gB;
 
43
        Geometry *gT;
 
44
        PrecisionModel *pm;
 
45
 
 
46
        GeometryFactory *factory;
 
47
        WKTReader *r;
 
48
        WKTWriter *w;
 
49
        WKBReader *br;
 
50
        CMarkupSTL xml;
 
51
 
 
52
        int verbose;
 
53
        int test_predicates;
 
54
 
 
55
        int failed;
 
56
        int succeeded;
 
57
        int caseCount;
 
58
        int testCount;
 
59
        std::string opSignature;
 
60
 
 
61
        int testFileCount;
 
62
        int totalTestCount;
 
63
 
 
64
        const std::string *curr_file;
 
65
        std::string curr_case_desc;
 
66
 
 
67
        bool testValidOutput;
 
68
        bool testValidInput;
 
69
 
 
70
        void testValid(const Geometry* g, const std::string& label);
 
71
 
 
72
public:
 
73
        XMLTester();
 
74
        ~XMLTester();
 
75
        void run(const std::string &testFile);
 
76
        void resultSummary(std::ostream &os) const;
 
77
        void resetCounters();
 
78
 
 
79
        /*
 
80
         * Values:
 
81
         *      0: Show case description, run tests, show result
 
82
         *      1: Show parsed geometry values
 
83
         *      2: Run predicates
 
84
         *
 
85
         * Return previously set verbosity level
 
86
         */
 
87
        int setVerbosityLevel(int val);
 
88
 
 
89
        int getFailuresCount() { return failed; }
 
90
 
 
91
        void testOutputValidity(bool val) { testValidOutput=val; }
 
92
        void testInputValidity(bool val) { testValidInput=val; }
 
93
 
 
94
};
 
95
 
 
96
 
 
97
#endif