mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-14 04:48:15 +01:00
added conversion operator to DynamicAny
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user