• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  boost win32_test.cpp  -----------------------------------------------------//
2 
3 //  Copyright 2010 Vicente J. Botet Escriba
4 
5 //  Distributed under the Boost Software License, Version 1.0.
6 //  See http://www.boost.org/LICENSE_1_0.txt
7 
8 //  See http://www.boost.org/libs/chrono for documentation.
9 #include <boost/chrono/config.hpp>
10 #include <boost/detail/lightweight_test.hpp>
11 #if defined(BOOST_CHRONO_WINDOWS_API) ||  defined(__CYGWIN__)
12 
13 #include <boost/chrono/detail/static_assert.hpp>
14 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
15 #define NOTHING ""
16 #endif
17 
18 #include <boost/type_traits.hpp>
19 #include <boost/typeof/typeof.hpp>
20 #undef BOOST_USE_WINDOWS_H
21 #include <boost/winapi/basic_types.hpp>
22 #include <boost/winapi/time.hpp>
23 #include <windows.h>
24 
test()25 void test() {
26     {
27     boost::winapi::LARGE_INTEGER_ a;
28     LARGE_INTEGER b;
29     BOOST_CHRONO_STATIC_ASSERT((
30             sizeof(boost::winapi::LARGE_INTEGER_)==sizeof(LARGE_INTEGER)
31         ), NOTHING, (boost::winapi::LARGE_INTEGER_, LARGE_INTEGER));
32     BOOST_TEST((
33             sizeof(a.QuadPart)==sizeof(b.QuadPart)
34             ));
35     BOOST_CHRONO_STATIC_ASSERT((
36             offsetof(boost::winapi::LARGE_INTEGER_, QuadPart)==offsetof(LARGE_INTEGER, QuadPart)
37         ), NOTHING, (boost::winapi::LARGE_INTEGER_, LARGE_INTEGER));
38     BOOST_CHRONO_STATIC_ASSERT((
39             boost::is_same<
40                     BOOST_TYPEOF(a.QuadPart),
41                     BOOST_TYPEOF(b.QuadPart)
42                 >::value
43         ), NOTHING, (boost::winapi::LARGE_INTEGER_, LARGE_INTEGER));
44     }
45 
46     BOOST_CHRONO_STATIC_ASSERT((
47             sizeof(boost::winapi::BOOL_)==sizeof(BOOL)
48         ), NOTHING, (boost::winapi::BOOL_, BOOL));
49     BOOST_CHRONO_STATIC_ASSERT((
50             boost::is_same<boost::winapi::BOOL_,BOOL>::value
51         ), NOTHING, (boost::winapi::BOOL_, BOOL));
52 
53     BOOST_CHRONO_STATIC_ASSERT((
54             sizeof(boost::winapi::DWORD_)==sizeof(DWORD)
55         ), NOTHING, (boost::winapi::DWORD_, DWORD));
56     BOOST_CHRONO_STATIC_ASSERT((
57             boost::is_same<boost::winapi::DWORD_,DWORD>::value
58         ), NOTHING, (boost::winapi::DWORD_, DWORD));
59 
60     BOOST_CHRONO_STATIC_ASSERT((
61             sizeof(boost::winapi::HANDLE_)==sizeof(HANDLE)
62         ), NOTHING, (boost::winapi::HANDLE_, HANDLE));
63     BOOST_CHRONO_STATIC_ASSERT((
64             boost::is_same<boost::winapi::HANDLE_,HANDLE>::value
65         ), NOTHING, (boost::winapi::HANDLE_, HANDLE));
66 
67     BOOST_CHRONO_STATIC_ASSERT((
68             sizeof(boost::winapi::LONG_)==sizeof(LONG)
69         ), NOTHING, (boost::winapi::LONG_, LONG));
70     BOOST_CHRONO_STATIC_ASSERT((
71             boost::is_same<boost::winapi::LONG_,LONG>::value
72         ), NOTHING, (boost::winapi::LONG_, LONG));
73 
74     BOOST_CHRONO_STATIC_ASSERT((
75             sizeof(boost::winapi::LONGLONG_)==sizeof(LONGLONG)
76         ), NOTHING, (boost::winapi::LONGLONG_, LONGLONG));
77     BOOST_CHRONO_STATIC_ASSERT((
78             boost::is_same<boost::winapi::LONGLONG_,LONGLONG>::value
79         ), NOTHING, (boost::winapi::LONGLONG_, LONGLONG));
80 
81     BOOST_CHRONO_STATIC_ASSERT((
82             sizeof(boost::winapi::ULONG_PTR_)==sizeof(ULONG_PTR)
83         ), NOTHING, (boost::winapi::ULONG_PTR_, ULONG_PTR));
84     BOOST_CHRONO_STATIC_ASSERT((
85             boost::is_same<boost::winapi::ULONG_PTR_,ULONG_PTR>::value
86         ), NOTHING, (boost::winapi::ULONG_PTR_, ULONG_PTR));
87 
88     BOOST_CHRONO_STATIC_ASSERT((
89             sizeof(boost::winapi::PLARGE_INTEGER_)==sizeof(PLARGE_INTEGER)
90         ), NOTHING, (boost::winapi::PLARGE_INTEGER_, PLARGE_INTEGER));
91     //~ BOOST_CHRONO_STATIC_ASSERT((
92             //~ boost::is_same<boost::winapi::PLARGE_INTEGER_,PLARGE_INTEGER>::value
93         //~ ), NOTHING, (boost::winapi::PLARGE_INTEGER_, PLARGE_INTEGER));
94 
95     {
96         BOOST_CHRONO_STATIC_ASSERT((
97                 sizeof(boost::winapi::FILETIME_)==sizeof(FILETIME)
98             ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
99 
100         BOOST_CHRONO_STATIC_ASSERT((
101                 sizeof(boost::winapi::PFILETIME_)==sizeof(PFILETIME)
102             ), NOTHING, (boost::winapi::PFILETIME_, PFILETIME));
103 
104 
105         boost::winapi::FILETIME_ a;
106         FILETIME b;
107         BOOST_TEST((
108                 sizeof(a.dwLowDateTime)==sizeof(b.dwLowDateTime)
109                 ));
110         BOOST_TEST((
111                 sizeof(a.dwHighDateTime)==sizeof(b.dwHighDateTime)
112                 ));
113         BOOST_CHRONO_STATIC_ASSERT((
114                 offsetof(boost::winapi::FILETIME_, dwLowDateTime)==offsetof(FILETIME, dwLowDateTime)
115             ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
116         BOOST_CHRONO_STATIC_ASSERT((
117                 offsetof(boost::winapi::FILETIME_, dwHighDateTime)==offsetof(FILETIME, dwHighDateTime)
118             ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
119         BOOST_CHRONO_STATIC_ASSERT((
120             boost::is_same<
121                     BOOST_TYPEOF(a.dwLowDateTime),
122                     BOOST_TYPEOF(b.dwLowDateTime)
123                 >::value
124         ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
125         BOOST_CHRONO_STATIC_ASSERT((
126             boost::is_same<
127                     BOOST_TYPEOF(a.dwHighDateTime),
128                     BOOST_TYPEOF(b.dwHighDateTime)
129                 >::value
130         ), NOTHING, (boost::winapi::FILETIME_, FILETIME));
131 
132     }
133 
134 //    BOOST_CHRONO_STATIC_ASSERT((
135 //            GetLastError==boost::winapi::::GetLastError
136 //        ), NOTHING, ());
137 
138 }
139 #else
test()140 void test() {
141 }
142 #endif
main()143 int main(  )
144 {
145     test();
146 
147   return boost::report_errors();
148 }
149 
150