~ubuntu-branches/ubuntu/quantal/poco/quantal

« back to all changes in this revision

Viewing changes to Util/testsuite/src/WinConfigurationTest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Burghardt
  • Date: 2008-11-15 11:39:15 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081115113915-7kauhm2c3m2i7oid
Tags: 1.3.3p1-2
* Fixed FTBFS with GCC 4.4 due to missing #include (Closes: #505619)
* Renamed 20_gcc43-missing-include.dpatch to 20_gcc44-missing-include.dpatch
* Downgraded dependencies on -dbg packages (Closes: #504342)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
// WinConfigurationTest.cpp
3
3
//
4
 
// $Id: //poco/1.3/Util/testsuite/src/WinConfigurationTest.cpp#2 $
 
4
// $Id: //poco/1.3/Util/testsuite/src/WinConfigurationTest.cpp#3 $
5
5
//
6
6
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
7
7
// and Contributors.
55
55
 
56
56
void WinConfigurationTest::testConfiguration()
57
57
{
58
 
        AutoPtr<WinRegistryConfiguration> reg = new WinRegistryConfiguration("HKEY_CURRENT_USER\\Software\\Applied Informatics\\Test");
59
 
        reg->setString("name1", "value1");
60
 
        assert (reg->getString("name1") == "value1");
61
 
        reg->setInt("name1", 1); // overwrite should also change type
62
 
        assert (reg->getInt("name1") == 1);
63
 
        reg->setString("name2", "value2");
64
 
        assert (reg->getString("name2") == "value2");
65
 
        assert (reg->hasProperty("name1"));
66
 
        assert (reg->hasProperty("name2"));
67
 
        
68
 
        std::string dfl = reg->getString("nonexistent", "default");
69
 
        assert (dfl == "default");
 
58
        AutoPtr<WinRegistryConfiguration> pReg = new WinRegistryConfiguration("HKEY_CURRENT_USER\\Software\\Applied Informatics\\Test");
 
59
        pReg->setString("name1", "value1");
 
60
        assert (pReg->getString("name1") == "value1");
 
61
        pReg->setInt("name1", 1); // overwrite should also change type
 
62
        assert (pReg->getInt("name1") == 1);
 
63
        pReg->setString("name2", "value2");
 
64
        assert (pReg->getString("name2") == "value2");
 
65
        assert (pReg->hasProperty("name1"));
 
66
        assert (pReg->hasProperty("name2"));
 
67
        
 
68
        std::string dfl = pReg->getString("nonexistent", "default");
 
69
        assert (dfl == "default");
 
70
        
 
71
        AutoPtr<Poco::Util::AbstractConfiguration> pView = pReg->createView("config");
 
72
        dfl = pView->getString("sub.foo", "default");
 
73
        assert (dfl == "default");
 
74
        
 
75
        pView->setString("sub.foo", "bar");
 
76
        assert (pView->getString("sub.foo", "default") == "bar");
70
77
}
71
78
 
72
79