New tests for UTC parser and UTC formatting
[libacl.git] / test / utc_convert.cpp
1 /*******************************************************
2  *  Unit test for the UTC class
3  *
4  * test conversion and formatting of UTC objects
5  ******************************************************
6  *
7  */
8
9 #include "date.h"
10 #include <assert.h>
11
12 int main()
13 {
14    String formatted;
15
16    date d1(15, 9, 2002);
17    hour h1(15, 23, 46);
18
19    UTC  u1(d1, h1);
20
21    std::cout << "Contructor with date = 15-9-2002, hour = 15:23:46: " << u1 << "\n";
22    formatted = u1.format();
23    std::cout << "Formatted with default format: " << formatted << "\n";
24    assert(formatted == "2002-09-15 15:23:46");
25
26
27    String s3("23-10-2019 23:45");
28    UTC    u3(s3);
29
30    std::cout << "Contructor from String " << s3 << " : " << u3 << "\n";
31    formatted = u3.format();
32    std::cout << "Formatted with default format: " << formatted << "\n";
33    assert(formatted == "2019-10-23 23:45:00");
34
35
36    return 0;
37 }
38