PSTime/test/testDurationParse.cpp

Go to the documentation of this file.
00001 /* Test of duration string parsification methods in the class Duration */
00002 
00003 #include "PSTime/Duration.h"
00004 
00005 #include <stdio.h>
00006 #include <time.h>
00007 
00008 #include <iostream>
00009 #include <string>
00010 
00011 using namespace std;
00012 using namespace PSTime;
00013 
00014 int main ()
00015 {
00016   //-------------
00017   char separationLine[]="----------------------------------";
00018 
00019   string str_dur1 = "P1Y2M3DT05H6M7S";
00020   string str_dur2 = "P01Y02M03D";
00021   string str_dur3 = "PT05H06M07S";
00022   string str_dur4 = "PT07.00345600S";
00023 
00024   int status;
00025 
00026   cout << separationLine << endl;
00027   //-------------
00028 
00029   Duration *dur1 = new Duration();
00030             dur1 -> Print();
00031   cout << endl << "Parse : " << str_dur1  << endl;
00032   status = Duration::parseStringToDuration(str_dur1, *dur1);
00033   dur1 -> Print();
00034   cout << separationLine << endl; 
00035 
00036   //-------------
00037 
00038   Duration *dur2 = new Duration();
00039   cout << endl << "Parse : " << str_dur2  << endl;
00040   status = Duration::parseStringToDuration(str_dur2, *dur2);
00041   dur2 -> Print();
00042   cout << separationLine << endl;
00043 
00044   //-------------
00045 
00046   Duration *dur3 = new Duration();
00047   cout << endl << "Parse : " << str_dur3  << endl;
00048   status = Duration::parseStringToDuration(str_dur3, *dur3);
00049   dur3 -> Print();
00050   cout << separationLine << endl;
00051 
00052   //-------------
00053 
00054   Duration *dur4 = new Duration();
00055   cout << endl << "Parse : " << str_dur4  << endl;
00056   status = Duration::parseStringToDuration(str_dur4, *dur4);
00057   dur4 -> Print();
00058   cout << separationLine << endl;
00059 
00060   //-------------
00061 }

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7