]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/date_time/test/gregorian/testgreg_month.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / date_time / test / gregorian / testgreg_month.cpp
1 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
2 * Use, modification and distribution is subject to the
3 * Boost Software License, Version 1.0. (See accompanying
4 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5 * Author: Jeff Garland
6 */
7
8 #include "boost/date_time/gregorian/greg_month.hpp"
9 #include "../testfrmwk.hpp"
10 #include <iostream>
11
12
13 void
14 test_month()
15 {
16 using namespace boost::gregorian;
17 greg_month m1(Jan), m2(Feb), m3(Mar), m4(Apr), m5(May), m6(Jun);
18 greg_month m7(Jul), m8(Aug), m9(Sep), m10(Oct), m11(Nov),m12(Dec);
19 check("January as_number", m1.as_number() == 1);
20 check("December as_number", m12.as_number() == 12);
21 check("Jan as Short String", m1.as_short_string() == std::string("Jan"));
22 check("Feb as Short String", m2.as_short_string() == std::string("Feb"));
23 check("Mar as Short String", m3.as_short_string() == std::string("Mar"));
24 check("Apr as Short String", m4.as_short_string() == std::string("Apr"));
25 check("May as Short String", m5.as_short_string() == std::string("May"));
26 check("Jun as Short String", m6.as_short_string() == std::string("Jun"));
27 check("Jul as Short String", m7.as_short_string() == std::string("Jul"));
28 check("Aug as Short String", m8.as_short_string() == std::string("Aug"));
29 check("Sep as Short String", m9.as_short_string() == std::string("Sep"));
30 check("Oct as Short String", m10.as_short_string() == std::string("Oct"));
31 check("Nov as Short String", m11.as_short_string() == std::string("Nov"));
32 check("Dec as Short String", m12.as_short_string() == std::string("Dec"));
33 check("Jan as Long String", m1.as_long_string() == std::string("January"));
34 check("Feb as Long String", m2.as_long_string() == std::string("February"));
35 check("Mar as Long String", m3.as_long_string() == std::string("March"));
36 check("Apr as Long String", m4.as_long_string() == std::string("April"));
37 check("May as Long String", m5.as_long_string() == std::string("May"));
38 check("Jun as Long String", m6.as_long_string() == std::string("June"));
39 check("Jul as Long String", m7.as_long_string() == std::string("July"));
40 check("Aug as Long String", m8.as_long_string() == std::string("August"));
41 check("Sep as Long String", m9.as_long_string() == std::string("September"));
42 check("Oct as Long String", m10.as_long_string() == std::string("October"));
43 check("Nov as Long String", m11.as_long_string() == std::string("November"));
44 check("Dec as Long String", m12.as_long_string() == std::string("December"));
45 //month m(5);
46
47 //TODO can this support NAM? or check exception
48 // greg_month sm0(0);
49 greg_month sm1(1);
50 greg_month sm12(12);
51 //check("check not a month value", sm0.as_short_string() == "NAM");
52 check("short construction -- 1",
53 sm1.as_short_string() == std::string("Jan"));
54 check("short construction -- 12",
55 sm12.as_short_string() == std::string("Dec"));
56 check("month traits min", (greg_month::min)() == 1);
57 check("month traits max", (greg_month::max)() == 12);
58
59 }
60
61 int
62 main()
63 {
64 test_month();
65 return printTestStats();
66 }
67