diff options
author | Martin Moene <martin.moene@gmail.com> | 2016-09-17 09:16:15 +0200 |
---|---|---|
committer | Martin Moene <martin.moene@gmail.com> | 2016-09-17 09:16:15 +0200 |
commit | ad991370daccc087f4dca8c239df413c45e5ec2f (patch) | |
tree | 43824ec9265182339d48496a72e21c3d056ae4cf /tests/byte_tests.cpp | |
parent | 8361aae39eba1bd3b41bd188baa4019aaa8317b1 (diff) | |
download | Microsoft-GSL-ad991370daccc087f4dca8c239df413c45e5ec2f.tar.gz |
Add tests for to_integer(): they fail
Diffstat (limited to 'tests/byte_tests.cpp')
-rw-r--r-- | tests/byte_tests.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/byte_tests.cpp b/tests/byte_tests.cpp index 59ff0cd..3bbf382 100644 --- a/tests/byte_tests.cpp +++ b/tests/byte_tests.cpp @@ -96,6 +96,24 @@ SUITE(byte_tests) a >>= 4; CHECK(a == to_byte<0x0F>()); } + + TEST(to_integer) + { + byte b = to_byte<0x12>(); + + CHECK(0x12 == gsl::to_integer<char>(b)); + CHECK(0x12 == gsl::to_integer<short>(b)); + CHECK(0x12 == gsl::to_integer<long>(b)); + CHECK(0x12 == gsl::to_integer<long long>(b)); + + CHECK(0x12 == gsl::to_integer<unsigned char>(b)); + CHECK(0x12 == gsl::to_integer<unsigned short>(b)); + CHECK(0x12 == gsl::to_integer<unsigned long>(b)); + CHECK(0x12 == gsl::to_integer<unsigned long long>(b)); + +// CHECK(0x12 == gsl::to_integer<float>(b)); // expect compile-time error +// CHECK(0x12 == gsl::to_integer<double>(b)); // expect compile-time error + } } } |