2 #include <gtest/gtest.h>
\r
6 #include "UnicodeString.h"
\r
7 #include "RegOptionsMgr.h"
\r
12 // - add helper functions for checking the changes in registry
\r
16 // The fixture for testing command line parsing.
\r
17 class RegOptionsMgrTest : public testing::Test
\r
20 // You can remove any or all of the following functions if its body
\r
25 // You can do set-up work for each test here.
\r
28 virtual ~RegOptionsMgrTest()
\r
30 // You can do clean-up work that doesn't throw exceptions here.
\r
33 // If the constructor and destructor are not enough for setting up
\r
34 // and cleaning up each test, you can define the following methods:
\r
36 virtual void SetUp()
\r
38 // Code here will be called immediately after the constructor (right
\r
39 // before each test).
\r
42 virtual void TearDown()
\r
44 // Code here will be called immediately after each test (right
\r
45 // before the destructor).
\r
48 // Objects declared here can be used by all tests in the test case for Foo.
\r
51 // Read option that does not exist
\r
52 // This causes exception in debug builds
\r
54 TEST_F(RegOptionsMgrTest, ReadNonexistingBool1)
\r
57 mgr.SetRegRootKey(_T("Thingamahoochie\\WinMerge\\UnitTesting"));
\r
58 EXPECT_EQ(true, mgr.GetBool(_T("BoolOpt2"));
\r
62 // Add new bool option with false default value
\r
63 TEST_F(RegOptionsMgrTest, AddBoolOption1)
\r
66 mgr.SetRegRootKey(_T("Thingamahoochie\\WinMerge\\UnitTesting"));
\r
67 EXPECT_EQ(COption::OPT_OK, mgr.InitOption(_T("BoolOpt1"), false));
\r
68 EXPECT_EQ(false, mgr.GetBool(_T("BoolOpt1")));
\r
71 // Add new bool option with true default value
\r
72 TEST_F(RegOptionsMgrTest, AddBoolOption2)
\r
75 mgr.SetRegRootKey(_T("Thingamahoochie\\WinMerge\\UnitTesting"));
\r
76 EXPECT_EQ(COption::OPT_OK, mgr.InitOption(_T("BoolOpt2"), true));
\r
77 EXPECT_EQ(true, mgr.GetBool(_T("BoolOpt2")));
\r