mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Restore test-gnc-option
- removed in merge 3e5fcc8709
To get it to compile
- remove unused variables
- remove duplicate operator==(GncGUID)
This commit is contained in:
@@ -200,6 +200,11 @@ gtest-qofevent.cpp)
|
|||||||
gnc_add_test(test-qofevent "${test_qofevent_SOURCES}"
|
gnc_add_test(test-qofevent "${test_qofevent_SOURCES}"
|
||||||
gtest_engine_INCLUDES gtest_old_engine_LIBS)
|
gtest_engine_INCLUDES gtest_old_engine_LIBS)
|
||||||
|
|
||||||
|
set(test_gnc_option_SOURCES
|
||||||
|
gtest-gnc-option.cpp
|
||||||
|
gtest-gnc-optiondb.cpp)
|
||||||
|
gnc_add_test(test-gnc-option "${test_gnc_option_SOURCES}"
|
||||||
|
gtest_engine_INCLUDES gtest_old_engine_LIBS)
|
||||||
|
|
||||||
set(test_engine_SOURCES_DIST
|
set(test_engine_SOURCES_DIST
|
||||||
gtest-gnc-euro.cpp
|
gtest-gnc-euro.cpp
|
||||||
|
|||||||
@@ -536,7 +536,6 @@ protected:
|
|||||||
return account;
|
return account;
|
||||||
};
|
};
|
||||||
auto assets = create_account(m_root, ACCT_TYPE_ASSET, "Assets");
|
auto assets = create_account(m_root, ACCT_TYPE_ASSET, "Assets");
|
||||||
auto liabilities = create_account(m_root, ACCT_TYPE_LIABILITY, "Liabilities");
|
|
||||||
auto expenses = create_account(m_root, ACCT_TYPE_EXPENSE, "Expenses");
|
auto expenses = create_account(m_root, ACCT_TYPE_EXPENSE, "Expenses");
|
||||||
create_account(assets, ACCT_TYPE_BANK, "Bank");
|
create_account(assets, ACCT_TYPE_BANK, "Bank");
|
||||||
auto broker = create_account(assets, ACCT_TYPE_ASSET, "Broker");
|
auto broker = create_account(assets, ACCT_TYPE_ASSET, "Broker");
|
||||||
@@ -569,12 +568,6 @@ protected:
|
|||||||
Account* m_root;
|
Account* m_root;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
|
||||||
operator==(const GncGUID& l, const GncGUID& r)
|
|
||||||
{
|
|
||||||
return guid_equal(&l, &r);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(GncOptionAccountTest, test_test_constructor_and_destructor)
|
TEST_F(GncOptionAccountTest, test_test_constructor_and_destructor)
|
||||||
{
|
{
|
||||||
EXPECT_TRUE(m_book != NULL);
|
EXPECT_TRUE(m_book != NULL);
|
||||||
@@ -777,9 +770,9 @@ TEST_F(GncMultichoiceOption, test_permissible_value_stuff)
|
|||||||
EXPECT_STREQ("waldo", m_option.permissible_value(1));
|
EXPECT_STREQ("waldo", m_option.permissible_value(1));
|
||||||
EXPECT_STREQ("sausage", m_option.permissible_value_name(2));
|
EXPECT_STREQ("sausage", m_option.permissible_value_name(2));
|
||||||
});
|
});
|
||||||
EXPECT_THROW({ auto result = m_option.permissible_value(7); },
|
EXPECT_THROW({ m_option.permissible_value(7); },
|
||||||
std::out_of_range);
|
std::out_of_range);
|
||||||
EXPECT_THROW({ auto result = m_option.permissible_value_name(9); },
|
EXPECT_THROW({ m_option.permissible_value_name(9); },
|
||||||
std::out_of_range);
|
std::out_of_range);
|
||||||
EXPECT_EQ(std::numeric_limits<uint16_t>::max(),
|
EXPECT_EQ(std::numeric_limits<uint16_t>::max(),
|
||||||
m_option.permissible_value_index("xyzzy"));
|
m_option.permissible_value_index("xyzzy"));
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ struct GncOptionDBAccountTest : public ::testing::Test
|
|||||||
return account;
|
return account;
|
||||||
};
|
};
|
||||||
auto assets = create_account(m_root, ACCT_TYPE_ASSET, "Assets");
|
auto assets = create_account(m_root, ACCT_TYPE_ASSET, "Assets");
|
||||||
auto liabilities = create_account(m_root, ACCT_TYPE_LIABILITY, "Liabilities");
|
|
||||||
auto expenses = create_account(m_root, ACCT_TYPE_EXPENSE, "Expenses");
|
auto expenses = create_account(m_root, ACCT_TYPE_EXPENSE, "Expenses");
|
||||||
create_account(assets, ACCT_TYPE_BANK, "Bank");
|
create_account(assets, ACCT_TYPE_BANK, "Bank");
|
||||||
auto broker = create_account(assets, ACCT_TYPE_ASSET, "Broker");
|
auto broker = create_account(assets, ACCT_TYPE_ASSET, "Broker");
|
||||||
@@ -288,12 +287,6 @@ TEST_F(GncOptionDBTest, test_register_start_date_option)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
operator==(const GncGUID& l, const GncGUID& r)
|
|
||||||
{
|
|
||||||
return guid_equal(&l, &r);
|
|
||||||
}
|
|
||||||
|
|
||||||
class GncOptionDBIOTest : public ::testing::Test
|
class GncOptionDBIOTest : public ::testing::Test
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@@ -315,7 +308,6 @@ protected:
|
|||||||
return account;
|
return account;
|
||||||
};
|
};
|
||||||
auto assets = create_account(m_root, ACCT_TYPE_ASSET, "Assets");
|
auto assets = create_account(m_root, ACCT_TYPE_ASSET, "Assets");
|
||||||
auto liabilities = create_account(m_root, ACCT_TYPE_LIABILITY, "Liabilities");
|
|
||||||
auto expenses = create_account(m_root, ACCT_TYPE_EXPENSE, "Expenses");
|
auto expenses = create_account(m_root, ACCT_TYPE_EXPENSE, "Expenses");
|
||||||
create_account(assets, ACCT_TYPE_BANK, "Bank");
|
create_account(assets, ACCT_TYPE_BANK, "Bank");
|
||||||
auto broker = create_account(assets, ACCT_TYPE_ASSET, "Broker");
|
auto broker = create_account(assets, ACCT_TYPE_ASSET, "Broker");
|
||||||
@@ -384,14 +376,12 @@ TEST_F(GncOptionDBIOTest, test_option_kvp_save)
|
|||||||
auto bar = "bar";
|
auto bar = "bar";
|
||||||
auto sausage = "sausage";
|
auto sausage = "sausage";
|
||||||
auto grault = "grault";
|
auto grault = "grault";
|
||||||
auto garply = "garply";
|
|
||||||
GSList foo_bar_tail{(void*)bar, nullptr};
|
GSList foo_bar_tail{(void*)bar, nullptr};
|
||||||
GSList foo_bar_head{(void*)foo, &foo_bar_tail};
|
GSList foo_bar_head{(void*)foo, &foo_bar_tail};
|
||||||
GSList foo_sausage_tail{(void*)sausage, nullptr};
|
GSList foo_sausage_tail{(void*)sausage, nullptr};
|
||||||
GSList foo_sausage_head{(void*)foo, &foo_sausage_tail};
|
GSList foo_sausage_head{(void*)foo, &foo_sausage_tail};
|
||||||
GSList qux_grault_tail{(void*)grault, nullptr};
|
GSList qux_grault_tail{(void*)grault, nullptr};
|
||||||
GSList qux_grault_head{(void*)foo, &qux_grault_tail};
|
GSList qux_grault_head{(void*)foo, &qux_grault_tail};
|
||||||
GSList qux_garply_tail{(void*)garply, nullptr};
|
|
||||||
GSList qux_garply_head{(void*)foo, &qux_grault_tail};
|
GSList qux_garply_head{(void*)foo, &qux_grault_tail};
|
||||||
m_db->set_option("foo", "sausage", std::string{"pepper"});
|
m_db->set_option("foo", "sausage", std::string{"pepper"});
|
||||||
m_db->save_to_kvp(m_book, true);
|
m_db->save_to_kvp(m_book, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user