Files
date_time/test/gregorian/testdate_duration.cpp
Jeff Garland dc846827e4 first version -- renamed
[SVN r14901]
2002-08-15 18:59:16 +00:00

39 lines
1.2 KiB
C++

#include "boost/date_time/gregorian/gregorian.hpp"
#include "boost/date_time/testfrmwk.hpp"
#include <iostream>
void test_date_duration()
{
using namespace boost::gregorian;
date_duration threeDays(3);
date_duration twoDays(2);
//date_duration zeroDays(0);
check("Self equal case", threeDays == threeDays);
check("Not equal case", !(threeDays == twoDays));
check("Less case succeed", twoDays < threeDays);
check("Not less case", !(threeDays < twoDays));
check("Not less case - equal", !(threeDays < threeDays));
check("Greater than ", !(threeDays > threeDays));
check("Greater equal ", threeDays >= threeDays);
check("Greater equal - false", !(twoDays >= threeDays));
check("add", twoDays + threeDays == date_duration(5));
date_duration derivedOneDay = threeDays - twoDays;
check("Subtraction - neg result", twoDays - threeDays == date_duration(-1));
date_duration oneDay(1);
check("Subtraction", oneDay == derivedOneDay);
// date_duration dd(1);
// dd++;
// check("Increment", dd == twoDays);
}
int main() {
test_date_duration();
printTestStats();
return 0;
};