test.timefuncs.cpp

Go to the documentation of this file.
00001 
00002 
00003 #include <iomanip>
00004 #include <iostream>
00005 #include <assert.h>
00006 #include "NewDateTime.h"
00007 
00008 using namespace std;
00009 
00010 int main() {
00011   int lhs = 20070420, rhs = 20070127;
00012   
00013   int period = day_diff( lhs, rhs);
00014 
00015   cout << "day_diff( 20070420, 20070127) = " << period << endl;
00016   assert( period == 83);
00017 
00018   period = serial_time( 20080211);
00019   cout << "serial_time( 20080211) = " << period << endl;
00020   assert( period == 10268);
00021 
00022   period = week_day( 20070212);
00023   cout << "week_day( 20070212) = " << period << endl;
00024   assert( period == 1);
00025 
00026   period = serial_time( 99999999);
00027 
00028   assert( period == -1);
00029   cout << "serial_time( 99999999) = " << period << endl;
00030   cout << "ccyymmdd_error_buffer={" << ccyymmdd_error_buffer << "}" << endl;
00031 
00032   int i, j, k;
00033   for (i=200703; i<=200712; i++) {
00034     j = cbot_ag_option_expiration( i);
00035     k = cbot_ag_option_expiration_algorithm( i);
00036     cout << setw( 12) << i << setw(12) << j << setw(12) << k << endl;
00037     if (i==200703) {
00038       assert( j == 20070223); 
00039       assert( k == 20070223); 
00040     }
00041     if (i==200712) {
00042       assert( j == 20071120);
00043       assert( k == 20071123);
00044     }
00045   }
00046 
00047   cout << "all test passed in program test.timefuncs.cpp" << endl;
00048 
00049   return 0;
00050 }

Generated on Fri Jan 7 12:36:18 2011 for public_options by  doxygen 1.5.1