本文整理汇总了C++中Bank::addRate方法的典型用法代码示例。如果您正苦于以下问题:C++ Bank::addRate方法的具体用法?C++ Bank::addRate怎么用?C++ Bank::addRate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bank
的用法示例。
在下文中一共展示了Bank::addRate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Bank
TEST(ExpressionTest, ReduceMoneyDifferentCurrency) {
Money* two = Money::franc(2);
Money* one = Money::dollar(1);
Bank* bank = new Bank();
bank->addRate("CHF","USD",2);
Money* result = bank->reduce(two,"USD");
EXPECT_EQ(*one,*result);
delete one;
delete two;
delete bank;
delete result;
}
示例2:
TEST(ExpressionTest,MixedAddition)
{
Money* ten = Money::dollar(10);
Expression* fiveBucks = Money::dollar(5);
Expression* tenFrancs = Money::franc(10);
Bank bank;
bank.addRate("CHF","USD",2);
Expression* sum = fiveBucks->plus(tenFrancs);
Money* result = bank.reduce(sum,"USD");
EXPECT_EQ(*ten,*result);
delete sum;
delete ten;
delete result;
delete fiveBucks;
delete tenFrancs;
}
示例3: Sum
TEST(ExpressionTest,SumTimes)
{
Money* d20 = Money::dollar(20);
Expression* fiveBucks = Money::dollar(5);
Expression* tenFrancs = Money::franc(10);
Bank bank;
bank.addRate("CHF","USD",2);
Expression* sum = new Sum(fiveBucks,tenFrancs);
Expression* sum2nd = sum->times(2);
Money* result = bank.reduce(sum2nd,"USD");
EXPECT_EQ(*d20,*result);
delete d20;
delete sum;
delete sum2nd;
delete result;
delete fiveBucks;
delete tenFrancs;
}