// ----------------------------------------------------------------------------
// CNATFWUNSAFQuerySrv::QueryResult
// ----------------------------------------------------------------------------
//
TDnsRespSRV CNATFWUNSAFQuerySrv::QueryResult()
    {
    return iResult();
    }
示例#2
0
int main( int argc, char* argv[] )
{
	std::cout
		<< "Unit Test: Shock::SafeInteger"
		<< std::endl
		<< std::flush;

	// uint8_t
	std::cout
		<< "Uint8"
		<< std::endl
		<< std::flush;
	{
		std::cout
			<< "Valid Increment"
			<< std::endl
			<< std::flush;

		Shock::Types::uint8_t iOriginal( 5 );
		Shock::Types::uint8_t iIncrement( 1 );

		Shock::Types::ConversionError kError;

		Shock::Types::uint8_t iResult(
			Shock::SafeInteger::Operations< Shock::Types::uint8_t >::add(
				iOriginal,
				iIncrement,
				kError
				)
			);

		std::cout
			<< (size_t)iOriginal
			<< " + "
			<< (size_t)1
			<< " = "
			<< (size_t)iResult
			<< std::endl
			<< std::flush;

		if ( iResult == iOriginal + 1 )
		{
			std::cout
				<< "SUCCESS: Value changed"
				<< std::endl
				<< std::flush;
		}
		else
		{
			std::cout
				<< "FAILURE: Value did not change"
				<< std::endl
				<< std::flush;
		}

		if ( false == kError.isErrorSet() )
		{
			std::cout
				<< "SUCCESS: Error code is not set"
				<< std::endl
				<< std::flush;
		}
		else
		{
			std::cout
				<< "FAILURE: Error code is set"
				<< std::endl
				<< std::flush;
		}
	}
	{
		std::cout
			<< "Overflow"
			<< std::endl
			<< std::flush;

		Shock::Types::uint8_t iOriginal(
			Shock::Consts::Types::Uint8::Max
			);
		Shock::Types::uint8_t iIncrement(
			1
			);

		Shock::Types::ConversionError kError;

		Shock::Types::uint8_t iResult(
			Shock::SafeInteger::Operations< Shock::Types::uint8_t >::add(
				iOriginal,
				iIncrement,
				kError
				)
			);

		std::cout
			<< (size_t)iOriginal
			<< " + "
			<< (size_t)1
			<< " = "
			<< (size_t)iResult
			<< std::endl
			<< std::flush;

		if ( iOriginal == iResult )
		{
			std::cout
				<< "SUCCESS: Value did not change"
				<< std::endl
				<< std::flush;
		}
		else
		{
			std::cout
				<< "FAILURE: Value changed"
				<< std::endl
				<< std::flush;
		}

		if ( true == kError.isErrorSet() )
		{
			std::cout
				<< "SUCCESS: Error code is set"
				<< std::endl
				<< std::flush;
		}
		else
		{
			std::cout
				<< "FAILURE: Error code is not set"
				<< std::endl
				<< std::flush;
		}
	}

	// Complete
	std::cout
		<< "Press enter to continue..."
		<< std::endl
		<< std::flush;
	getchar();

	return 0;
}