本文整理汇总了C++中DayCounter::name方法的典型用法代码示例。如果您正苦于以下问题:C++ DayCounter::name方法的具体用法?C++ DayCounter::name怎么用?C++ DayCounter::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DayCounter
的用法示例。
在下文中一共展示了DayCounter::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testIntraday
void DayCounterTest::testIntraday() {
#ifdef QL_HIGH_RESOLUTION_DATE
BOOST_TEST_MESSAGE("Testing intraday behavior of day counter ...");
const Date d1(12, February, 2015);
const Date d2(14, February, 2015, 12, 34, 17, 1, 230298);
const Time tol = 100*QL_EPSILON;
const DayCounter dayCounters[]
= { ActualActual(), Actual365Fixed(), Actual360() };
for (Size i=0; i < LENGTH(dayCounters); ++i) {
const DayCounter dc = dayCounters[i];
const Time expected = ((12*60 + 34)*60 + 17 + 0.231298)
* dc.yearFraction(d1, d1+1)/86400
+ dc.yearFraction(d1, d1+2);
BOOST_CHECK_MESSAGE(
std::fabs(dc.yearFraction(d1, d2) - expected) < tol,
"can not reproduce result for day counter " << dc.name());
BOOST_CHECK_MESSAGE(
std::fabs(dc.yearFraction(d2, d1) + expected) < tol,
"can not reproduce result for day counter " << dc.name());
}
#endif
}
示例2: return
inline bool operator==(const DayCounter& d1, const DayCounter& d2) {
return (d1.empty() && d2.empty())
|| (!d1.empty() && !d2.empty() && d1.name() == d2.name());
}