added conversion operator to DynamicAny

This commit is contained in:
Guenter Obiltschnig
2007-04-23 07:12:12 +00:00
parent c4a10c074a
commit 109a6f47bd
3 changed files with 27 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
//
// DynamicAnyTest.cpp
//
// $Id: //poco/Main/Foundation/testsuite/src/DynamicAnyTest.cpp#2 $
// $Id: //poco/Main/Foundation/testsuite/src/DynamicAnyTest.cpp#3 $
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
@@ -933,6 +933,18 @@ void DynamicAnyTest::testULong()
}
void DynamicAnyTest::testConversionOperator()
{
DynamicAny any("42");
int i = any;
assert (i == 42);
any = 123;
std::string s(any);
assert (s == "123");
}
void DynamicAnyTest::setUp()
{
}
@@ -962,6 +974,7 @@ CppUnit::Test* DynamicAnyTest::suite()
CppUnit_addTest(pSuite, DynamicAnyTest, testString);
CppUnit_addTest(pSuite, DynamicAnyTest, testLong);
CppUnit_addTest(pSuite, DynamicAnyTest, testULong);
CppUnit_addTest(pSuite, DynamicAnyTest, testConversionOperator);
return pSuite;
}

View File

@@ -1,7 +1,7 @@
//
// DynamicAnyTest.h
//
// $Id: //poco/Main/Foundation/testsuite/src/DynamicAnyTest.h#1 $
// $Id: //poco/Main/Foundation/testsuite/src/DynamicAnyTest.h#2 $
//
// Tests for Any types
//
@@ -60,6 +60,7 @@ public:
void testLong();
void testULong();
void testString();
void testConversionOperator();
void setUp();
void tearDown();