Changeset View
Changeset View
Standalone View
Standalone View
source/ps/tests/test_ConfigDB.h
Show All 14 Lines | |||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#include "lib/self_test.h" | #include "lib/self_test.h" | ||||
#include "lib/file/vfs/vfs.h" | #include "lib/file/vfs/vfs.h" | ||||
#include "ps/ConfigDB.h" | #include "ps/ConfigDB.h" | ||||
#include <memory> | |||||
extern PIVFS g_VFS; | extern PIVFS g_VFS; | ||||
class TestConfigDB : public CxxTest::TestSuite | class TestConfigDB : public CxxTest::TestSuite | ||||
{ | { | ||||
CConfigDB* configDB; | std::unique_ptr<CConfigDB> configDB; | ||||
public: | public: | ||||
void setUp() | void setUp() | ||||
{ | { | ||||
g_VFS = CreateVfs(); | g_VFS = CreateVfs(); | ||||
TS_ASSERT_OK(g_VFS->Mount(L"config", DataDir() / "_testconfig" / "")); | TS_ASSERT_OK(g_VFS->Mount(L"config", DataDir() / "_testconfig" / "")); | ||||
configDB = new CConfigDB; | configDB = std::make_unique<CConfigDB>(); | ||||
Stan: #include <memory> | |||||
} | } | ||||
void tearDown() | void tearDown() | ||||
{ | { | ||||
DeleteDirectory(DataDir()/"_testconfig"); | DeleteDirectory(DataDir()/"_testconfig"); | ||||
g_VFS.reset(); | g_VFS.reset(); | ||||
configDB.reset(); | |||||
delete configDB; | |||||
} | } | ||||
void test_setting_int() | void test_setting_int() | ||||
{ | { | ||||
configDB->SetConfigFile(CFG_SYSTEM, "config/file.cfg"); | configDB->SetConfigFile(CFG_SYSTEM, "config/file.cfg"); | ||||
configDB->WriteFile(CFG_SYSTEM); | configDB->WriteFile(CFG_SYSTEM); | ||||
configDB->Reload(CFG_SYSTEM); | configDB->Reload(CFG_SYSTEM); | ||||
configDB->SetValueString(CFG_SYSTEM, "test_setting", "5"); | configDB->SetValueString(CFG_SYSTEM, "test_setting", "5"); | ||||
Show All 36 Lines |
Wildfire Games · Phabricator
#include <memory>