⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dimensiontest.cpp

📁 在Linux下做的QuadTree的程序
💻 CPP
字号:
// $Id: DimensionTest.cpp 1842 2006-09-07 15:28:03Z strk $// // Test Suite for geos::geom::Location class.// TUT#include <tut.h>// GEOS#include <geos/geom/Dimension.h>#include <geos/util/IllegalArgumentException.h>namespace tut{    //    // Test Group    //    // Common data used by tests    struct test_dimension_data    {		int nomatter;		int yes;		int no;		int point;		int curve;		int surface;		test_dimension_data()			:			nomatter(geos::geom::Dimension::DONTCARE),			yes(geos::geom::Dimension::True),			no(geos::geom::Dimension::False),			point(geos::geom::Dimension::P),			curve(geos::geom::Dimension::L),			surface(geos::geom::Dimension::A)		{}	};    typedef test_group<test_dimension_data> group;    typedef group::object object;    group test_dimension_group("geos::geom::Dimension");    //    // Test Cases    //    // Test of default constructor    template<>    template<>    void object::test<1>()    {		// Just compile-time test		geos::geom::Dimension dim;    }    // Test of toDimensionSymbol()    template<>    template<>    void object::test<2>()    {		using geos::geom::Dimension;		try		{			ensure_equals( Dimension::toDimensionSymbol(nomatter), '*' );			ensure_equals( Dimension::toDimensionSymbol(yes), 'T' );			ensure_equals( Dimension::toDimensionSymbol(no), 'F' );			ensure_equals( Dimension::toDimensionSymbol(point), '0' );			ensure_equals( Dimension::toDimensionSymbol(curve), '1' );			ensure_equals( Dimension::toDimensionSymbol(surface), '2' );		}		catch ( geos::util::IllegalArgumentException const& e ) 		{			fail( e.what() ); 		}    }    // Test of toDimensionSymbol() throwing IllegalArgumentException    template<>    template<>    void object::test<3>()    {		using geos::geom::Dimension;		try 		{			Dimension::toDimensionSymbol(101);			Dimension::toDimensionSymbol(-101);					fail("IllegalArgumentException expected"); 		}		catch ( geos::util::IllegalArgumentException const& e ) 		{ 			const char* msg = e.what(); // ok 			ensure( msg != 0 );		}     }    // Test of toDimensionValue()    template<>    template<>    void object::test<4>()    {		using geos::geom::Dimension;		try		{			ensure_equals( Dimension::toDimensionValue('*'), nomatter );			ensure_equals( Dimension::toDimensionValue('F'), no );			ensure_equals( Dimension::toDimensionValue('f'), no );			ensure_equals( Dimension::toDimensionValue('T') , yes );			ensure_equals( Dimension::toDimensionValue('t') , yes );			ensure_equals( Dimension::toDimensionValue('0'), point );			ensure_equals( Dimension::toDimensionValue('1'), curve );			ensure_equals( Dimension::toDimensionValue('2'), surface );		}		catch ( geos::util::IllegalArgumentException const& e ) 		{			fail( e.what() ); 		}    }    // Test of toDimensionValue() throwing IllegalArgumentException    template<>    template<>    void object::test<5>()    {		using geos::geom::Dimension;		try 		{			Dimension::toDimensionValue('X');			Dimension::toDimensionValue('9');					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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -