当前位置: 首页>>代码示例>>C++>>正文


C++ Account::StrikeBalance方法代码示例

本文整理汇总了C++中Account::StrikeBalance方法的典型用法代码示例。如果您正苦于以下问题:C++ Account::StrikeBalance方法的具体用法?C++ Account::StrikeBalance怎么用?C++ Account::StrikeBalance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Account的用法示例。


在下文中一共展示了Account::StrikeBalance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MixedTimeBalance

void AccountBalanceTest::MixedTimeBalance()
{
    Account account;
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(100, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(1, account.StrikeBalance(), 0.01);

    account.AddTransaction(t_Transaction_ptr(new Transaction(1000, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(2, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(2000, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(3, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(500, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(4, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(1, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(5, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(3000, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(6, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(6, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(7, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(4500, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(8, account.StrikeBalance(), 0.01);

    account.AddTransaction(t_Transaction_ptr(new Transaction(1, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(9, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(3001, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(10, account.StrikeBalance(), 0.01);    
}
开发者ID:vok1980,项目名称:DistributedBudget,代码行数:34,代码来源:AccountBalanceTest.cpp

示例2: LinearBalance

void AccountBalanceTest::LinearBalance()
{
    Account account;
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(0, 1)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(1, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(0, 3)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(4, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(50, -45.1f)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(-41.10, account.StrikeBalance(), 0.01);
    
    account.AddTransaction(t_Transaction_ptr(new Transaction(52, 457.5)));
    CPPUNIT_ASSERT_DOUBLES_EQUAL(416.40, account.StrikeBalance(), 0.01);
}
开发者ID:vok1980,项目名称:DistributedBudget,代码行数:16,代码来源:AccountBalanceTest.cpp

示例3: DuplicatedTransaction

void AccountBalanceTest::DuplicatedTransaction()
{
    Account account;
    t_Transaction_ptr pTransaction(new Transaction(1, 2));
    
    account.AddTransaction(pTransaction);
    account.AddTransaction(pTransaction);
    
    CPPUNIT_ASSERT(pTransaction->GetParent() != pTransaction);
    CPPUNIT_ASSERT_DOUBLES_EQUAL(2, account.StrikeBalance(), 0.01);
}
开发者ID:vok1980,项目名称:DistributedBudget,代码行数:11,代码来源:AccountBalanceTest.cpp


注:本文中的Account::StrikeBalance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。