1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 **********************************************************************/
17 #include <geos/util/Assert.h>
18 #include <geos/util/AssertionFailedException.h>
19 #include <geos/geom/Coordinate.h>
22 using namespace geos::geom
;
25 namespace util
{ // geos.util
28 Assert::isTrue(bool assertion
, const string
& message
)
31 if (message
.empty()) {
32 throw AssertionFailedException();
34 throw AssertionFailedException(message
);
40 Assert::equals(const Coordinate
& expectedValue
,
41 const Coordinate
& actualValue
, const string
& message
)
43 if (!(actualValue
==expectedValue
)) {
44 throw AssertionFailedException("Expected " + expectedValue
.toString() + " but encountered "
45 + actualValue
.toString() + (!message
.empty() ? ": " + message
: ""));
50 void Assert::shouldNeverReachHere(const string
& message
) {
51 throw AssertionFailedException("Should never reach here"
52 + (!message
.empty() ? ": " + message
: ""));
55 } // namespace geos.util
58 /**********************************************************************
60 * Revision 1.14 2006/03/09 16:46:49 strk
61 * geos::geom namespace definition, first pass at headers split
63 * Revision 1.13 2006/03/06 19:40:47 strk
64 * geos::util namespace. New GeometryCollection::iterator interface, many cleanups.
66 * Revision 1.12 2006/03/03 10:46:22 strk
67 * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
69 * Revision 1.11 2006/02/23 11:54:21 strk
70 * - MCIndexPointSnapper
71 * - MCIndexSnapRounder
72 * - SnapRounding BufferOp
74 * - GEOSException hierarchy cleanups
75 * - SpatialIndex memory-friendly query interface
76 * - GeometryGraph::getBoundaryNodes memory-friendly
77 * - NodeMap::getBoundaryNodes memory-friendly
78 * - Cleanups in geomgraph::Edge
79 * - Added an XML test for snaprounding buffer (shows leaks, working on it)
81 * Revision 1.10 2006/02/09 15:52:47 strk
82 * GEOSException derived from std::exception; always thrown and cought by const ref.
84 * Revision 1.9 2004/07/02 13:28:29 strk
85 * Fixed all #include lines to reflect headers layout change.
86 * Added client application build tips in README.
88 * Revision 1.8 2003/11/07 01:23:43 pramsey
89 * Add standard CVS headers licence notices and copyrights to all cpp and h
93 **********************************************************************/