2 #include <gtest/gtest.h>
\r
4 #include "UnicodeString.h"
\r
5 #include "RegOptionsMgr.h"
\r
10 // - add helper functions for checking the changes in registry
\r
14 // The fixture for testing command line parsing.
\r
15 class RegOptionsMgrTest : public testing::Test
\r
18 // You can remove any or all of the following functions if its body
\r
23 // You can do set-up work for each test here.
\r
26 virtual ~RegOptionsMgrTest()
\r
28 // You can do clean-up work that doesn't throw exceptions here.
\r
31 // If the constructor and destructor are not enough for setting up
\r
32 // and cleaning up each test, you can define the following methods:
\r
34 virtual void SetUp()
\r
36 // Code here will be called immediately after the constructor (right
\r
37 // before each test).
\r
40 virtual void TearDown()
\r
42 // Code here will be called immediately after each test (right
\r
43 // before the destructor).
\r
46 // Objects declared here can be used by all tests in the test case for Foo.
\r
49 // Read option that does not exist
\r
50 // This causes exception in debug builds
\r
52 TEST_F(RegOptionsMgrTest, ReadNonexistingBool1)
\r
55 mgr.SetRegRootKey(_T("Thingamahoochie\\WinMerge\\UnitTesting"));
\r
56 EXPECT_EQ(true, mgr.GetBool(_T("BoolOpt2"));
\r
60 // Add new bool option with false default value
\r
61 TEST_F(RegOptionsMgrTest, AddBoolOption1)
\r
64 mgr.SetRegRootKey(_T("Thingamahoochie\\WinMerge\\UnitTesting"));
\r
65 EXPECT_EQ(COption::OPT_OK, mgr.InitOption(_T("BoolOpt1"), false));
\r
66 EXPECT_EQ(false, mgr.GetBool(_T("BoolOpt1")));
\r
69 // Add new bool option with true default value
\r
70 TEST_F(RegOptionsMgrTest, AddBoolOption2)
\r
73 mgr.SetRegRootKey(_T("Thingamahoochie\\WinMerge\\UnitTesting"));
\r
74 EXPECT_EQ(COption::OPT_OK, mgr.InitOption(_T("BoolOpt2"), true));
\r
75 EXPECT_EQ(true, mgr.GetBool(_T("BoolOpt2")));
\r