locationtest.cpp

来自「在Linux下做的QuadTree的程序」· C++ 代码 · 共 85 行

CPP
85
字号
// $Id: LocationTest.cpp 1842 2006-09-07 15:28:03Z strk $// // Test Suite for geos::geom::Location class.// TUT#include <tut.h>// GEOS#include <geos/geom/Location.h>#include <geos/util/IllegalArgumentException.h>namespace tut{    //    // Test Group    //    // Common data used by tests    struct test_location_data    {		int undef;		int interior;		int boundary;		int exterior;		test_location_data()			: undef(geos::geom::Location::UNDEF),			interior(geos::geom::Location::INTERIOR),			boundary(geos::geom::Location::BOUNDARY),			exterior(geos::geom::Location::EXTERIOR)		{}	};    typedef test_group<test_location_data> group;    typedef group::object object;    group test_location_group("geos::geom::Location");    //    // Test Cases    //    // Test of default constructor    template<>    template<>    void object::test<1>()    {		ensure("NOTE: Location has no default constructor.", true);    }    // Test of toLocationSymbol()    template<>    template<>    void object::test<2>()    {		using geos::geom::Location;		ensure_equals( Location::toLocationSymbol(exterior), 'e' );		ensure_equals( Location::toLocationSymbol(boundary), 'b' );		ensure_equals( Location::toLocationSymbol(interior), 'i' );		ensure_equals( Location::toLocationSymbol(undef), '-' );    }    // Test of toLocationSymbol() throwing IllegalArgumentException    template<>    template<>    void object::test<3>()    {		using geos::geom::Location;		try 		{			Location::toLocationSymbol(101);			Location::toLocationSymbol(-101);					fail("IllegalArgumentException expected"); 		}		catch ( geos::util::IllegalArgumentException const& e ) 		{ 			const char* msg = e.what(); // ok 			ensure( msg != 0 );		}     }} // namespace tut

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?