• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //  Adaptation to Boost of the libcxx
10 //  Copyright 2010 Vicente J. Botet Escriba
11 //  Distributed under the Boost Software License, Version 1.0.
12 //  See http://www.boost.org/LICENSE_1_0.txt
13 
14 // test ratio_add
15 
16 #define BOOST_RATIO_EXTENSIONS
17 #include <boost/ratio/ratio_io.hpp>
18 #include <boost/detail/lightweight_test.hpp>
19 #include <climits>
20 
main()21 int main()
22 {
23 
24     {
25         BOOST_TEST((
26                 boost::ratio_string<boost::atto, char>::prefix() == "atto"
27         ));
28         BOOST_TEST((
29                 boost::ratio_string<boost::atto, char>::symbol() == "a"
30         ));
31     }
32     {
33         BOOST_TEST((
34                 boost::ratio_string<boost::femto, char>::prefix() == "femto"
35         ));
36         BOOST_TEST((
37                 boost::ratio_string<boost::femto, char>::symbol() == "f"
38         ));
39     }
40     {
41         BOOST_TEST((
42                 boost::ratio_string<boost::pico, char>::prefix() == "pico"
43         ));
44         BOOST_TEST((
45                 boost::ratio_string<boost::pico, char>::symbol() == "p"
46         ));
47     }
48     {
49         BOOST_TEST((
50                 boost::ratio_string<boost::nano, char>::prefix() == "nano"
51         ));
52         BOOST_TEST((
53                 boost::ratio_string<boost::nano, char>::symbol() == "n"
54         ));
55     }
56     {
57         BOOST_TEST((
58                 boost::ratio_string<boost::micro, char>::prefix() == "micro"
59         ));
60         BOOST_TEST((
61                 boost::ratio_string<boost::micro, char>::symbol() == "\xC2\xB5"
62         ));
63     }
64     {
65         BOOST_TEST((
66                 boost::ratio_string<boost::milli, char>::prefix() == "milli"
67         ));
68         BOOST_TEST((
69                 boost::ratio_string<boost::milli, char>::symbol() == "m"
70         ));
71     }
72     {
73         BOOST_TEST((
74                 boost::ratio_string<boost::centi, char>::prefix() == "centi"
75         ));
76         BOOST_TEST((
77                 boost::ratio_string<boost::centi, char>::symbol() == "c"
78         ));
79     }
80     {
81         BOOST_TEST((
82                 boost::ratio_string<boost::deci, char>::prefix() == "deci"
83         ));
84         BOOST_TEST((
85                 boost::ratio_string<boost::deci, char>::symbol() == "d"
86         ));
87     }
88     {
89         BOOST_TEST((
90                 boost::ratio_string<boost::deca, char>::prefix() == "deca"
91         ));
92         BOOST_TEST((
93                 boost::ratio_string<boost::deca, char>::symbol() == "da"
94         ));
95     }
96     {
97         BOOST_TEST((
98                 boost::ratio_string<boost::hecto, char>::prefix() == "hecto"
99         ));
100         BOOST_TEST((
101                 boost::ratio_string<boost::hecto, char>::symbol() == "h"
102         ));
103     }
104     {
105         BOOST_TEST((
106                 boost::ratio_string<boost::kilo, char>::prefix() == "kilo"
107         ));
108         BOOST_TEST((
109                 boost::ratio_string<boost::kilo, char>::symbol() == "k"
110         ));
111     }
112     {
113         BOOST_TEST((
114                 boost::ratio_string<boost::mega, char>::prefix() == "mega"
115         ));
116         BOOST_TEST((
117                 boost::ratio_string<boost::mega, char>::symbol() == "M"
118         ));
119     }
120     {
121         BOOST_TEST((
122                 boost::ratio_string<boost::giga, char>::prefix() == "giga"
123         ));
124         BOOST_TEST((
125                 boost::ratio_string<boost::giga, char>::symbol() == "G"
126         ));
127     }
128     {
129         BOOST_TEST((
130                 boost::ratio_string<boost::tera, char>::prefix() == "tera"
131         ));
132         BOOST_TEST((
133                 boost::ratio_string<boost::tera, char>::symbol() == "T"
134         ));
135     }
136     {
137         BOOST_TEST((
138                 boost::ratio_string<boost::peta, char>::prefix() == "peta"
139         ));
140         BOOST_TEST((
141                 boost::ratio_string<boost::peta, char>::symbol() == "P"
142         ));
143     }
144     {
145         BOOST_TEST((
146                 boost::ratio_string<boost::exa, char>::prefix() == "exa"
147         ));
148         BOOST_TEST((
149                 boost::ratio_string<boost::exa, char>::symbol() == "E"
150         ));
151     }
152     {
153         BOOST_TEST((
154                 boost::ratio_string<boost::kibi, char>::prefix() == "kibi"
155         ));
156         BOOST_TEST((
157                 boost::ratio_string<boost::kibi, char>::symbol() == "Ki"
158         ));
159     }
160     {
161         BOOST_TEST((
162                 boost::ratio_string<boost::gibi, char>::prefix() == "gibi"
163         ));
164         BOOST_TEST((
165                 boost::ratio_string<boost::gibi, char>::symbol() == "Gi"
166         ));
167     }
168     return boost::report_errors();
169 }
170 
171 
172