MCPcopy Create free account
hub / github.com/dcleblanc/SafeInt / CompileType

Function CompileType

Test/CompileTest.cpp:191–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189
190template <typename T>
191void CompileType()
192{
193 // Test constructors
194 SafeInt<T> s;
195 SafeInt<T> i(Foo::Foo1);
196 T t = 0;
197 SafeInt<T> st(t);
198 SafeInt<T> sb(false);
199
200 // Mixed operations
201 CompiledMixedType<T, char>();
202 CompiledMixedType<T, signed char>();
203 CompiledMixedType<T, unsigned char>();
204 CompiledMixedType<T, short>();
205 CompiledMixedType<T, unsigned short>();
206 CompiledMixedType<T, int>();
207 CompiledMixedType<T, unsigned int>();
208 CompiledMixedType<T, long>();
209 CompiledMixedType<T, unsigned long>();
210 CompiledMixedType<T, long long>();
211 CompiledMixedType<T, unsigned long long>();
212
213 // This is making trouble for the compiler
214 ModulusFriendTest<T, char>();
215 ModulusFriendTest<T, signed char>();
216 ModulusFriendTest<T, unsigned char>();
217 ModulusFriendTest<T, short>();
218 ModulusFriendTest<T, unsigned short>();
219 ModulusFriendTest<T, int>();
220 ModulusFriendTest<T, unsigned int>();
221 ModulusFriendTest<T, long>();
222 ModulusFriendTest<T, unsigned long>();
223 ModulusFriendTest<T, long long>();
224 ModulusFriendTest<T, unsigned long long>();
225
226 // Special case casts
227 bool b = (bool)s;
228 wchar_t w = (wchar_t)s;
229 size_t size = (size_t)s;
230 float f = (float)s;
231 double d = (double)s;
232 long double ld = (long double)s;
233
234 // Pointer operations
235 T* p1 = s.Ptr();
236 const T* p2 = s.Ptr();
237 const T& r = s.Ref();
238 T* p3 = &s;
239 const T* p4 = &s;
240
241 // Unary operators
242 bool b2 = !st;
243 t = +st;
244
245 st++;
246 ++st;
247 st--;
248 --st;

Callers

nothing calls this directly

Calls 1

PtrMethod · 0.45

Tested by

no test coverage detected