diff options
Diffstat (limited to 'libphobos/testsuite/libphobos.phobos/std_conv.d')
-rw-r--r-- | libphobos/testsuite/libphobos.phobos/std_conv.d | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libphobos/testsuite/libphobos.phobos/std_conv.d b/libphobos/testsuite/libphobos.phobos/std_conv.d index 01f6fb7..5e9636b 100644 --- a/libphobos/testsuite/libphobos.phobos/std_conv.d +++ b/libphobos/testsuite/libphobos.phobos/std_conv.d @@ -509,3 +509,15 @@ assert(toChars!(16, char, LetterCase.upper)(255U).equal("FF")); } +@safe unittest +{ + import std.conv; + + uint n = 0xDEADBEEF; + + version (LittleEndian) + assert(n.bitCast!(ubyte[4]) == [0xEF, 0xBE, 0xAD, 0xDE]); + version (BigEndian) + assert(n.bitCast!(ubyte[4]) == [0xDE, 0xAD, 0xBE, 0xEF]); +} + |