forked from boostorg/endian
Add data() member
git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@62439 b8fc166d-592f-0410-95f2-cb63ce0dd405
This commit is contained in:
1 parent
22ccd7a2e4
commit
c60b7d2171
7 files changed
+237
-19
No files matched your search
@@ -264,6 +264,8 @@ void op_test()
|
||||
#endif
|
||||
}
|
||||
|
||||
// main ------------------------------------------------------------------------------//
|
||||
|
||||
int main()
|
||||
{
|
||||
bi::endian_log = false;
|
||||
@@ -339,7 +341,21 @@ int main()
|
||||
std::clog << "\n";
|
||||
|
||||
bi::endian_log = false;
|
||||
|
||||
|
||||
// test from Roland Schwarz that detected ambiguities
|
||||
unsigned u;
|
||||
bi::ulittle32_t u1;
|
||||
bi::ulittle32_t u2;
|
||||
|
||||
u = 1;
|
||||
u1 = 1;
|
||||
u2 = u1 + u;
|
||||
|
||||
// one more wrinkle
|
||||
bi::ulittle16_t u3(3);
|
||||
u3 = 3;
|
||||
u2 = u1 + u3;
|
||||
|
||||
// perform the indicated test on ~60*60 operand types
|
||||
|
||||
op_test<default_construct>();
|
||||
|
||||
@@ -142,6 +142,152 @@ namespace
|
||||
cout << "That should not matter and is presented for your information only.\n";
|
||||
} // detect_endianness
|
||||
|
||||
// check_data ------------------------------------------------------------//
|
||||
|
||||
void check_data()
|
||||
{
|
||||
big8_t big8;
|
||||
big16_t big16;
|
||||
big24_t big24;
|
||||
big32_t big32;
|
||||
big40_t big40;
|
||||
big48_t big48;
|
||||
big56_t big56;
|
||||
big64_t big64;
|
||||
|
||||
ubig8_t ubig8;
|
||||
ubig16_t ubig16;
|
||||
ubig24_t ubig24;
|
||||
ubig32_t ubig32;
|
||||
ubig40_t ubig40;
|
||||
ubig48_t ubig48;
|
||||
ubig56_t ubig56;
|
||||
ubig64_t ubig64;
|
||||
|
||||
little8_t little8;
|
||||
little16_t little16;
|
||||
little24_t little24;
|
||||
little32_t little32;
|
||||
little40_t little40;
|
||||
little48_t little48;
|
||||
little56_t little56;
|
||||
little64_t little64;
|
||||
|
||||
ulittle8_t ulittle8;
|
||||
ulittle16_t ulittle16;
|
||||
ulittle24_t ulittle24;
|
||||
ulittle32_t ulittle32;
|
||||
ulittle40_t ulittle40;
|
||||
ulittle48_t ulittle48;
|
||||
ulittle56_t ulittle56;
|
||||
ulittle64_t ulittle64;
|
||||
|
||||
native8_t native8;
|
||||
native16_t native16;
|
||||
native24_t native24;
|
||||
native32_t native32;
|
||||
native40_t native40;
|
||||
native48_t native48;
|
||||
native56_t native56;
|
||||
native64_t native64;
|
||||
|
||||
unative8_t unative8;
|
||||
unative16_t unative16;
|
||||
unative24_t unative24;
|
||||
unative32_t unative32;
|
||||
unative40_t unative40;
|
||||
unative48_t unative48;
|
||||
unative56_t unative56;
|
||||
unative64_t unative64;
|
||||
|
||||
aligned_big16_t aligned_big16;
|
||||
aligned_big32_t aligned_big32;
|
||||
aligned_big64_t aligned_big64;
|
||||
|
||||
aligned_ubig16_t aligned_ubig16;
|
||||
aligned_ubig32_t aligned_ubig32;
|
||||
aligned_ubig64_t aligned_ubig64;
|
||||
|
||||
aligned_little16_t aligned_little16;
|
||||
aligned_little32_t aligned_little32;
|
||||
aligned_little64_t aligned_little64;
|
||||
|
||||
aligned_ulittle16_t aligned_ulittle16 ;
|
||||
aligned_ulittle32_t aligned_ulittle32 ;
|
||||
aligned_ulittle64_t aligned_ulittle64 ;
|
||||
|
||||
VERIFY(big8.data() == reinterpret_cast<const char *>(&big8));
|
||||
VERIFY(big16.data() == reinterpret_cast<const char *>(&big16));
|
||||
VERIFY(big24.data() == reinterpret_cast<const char *>(&big24));
|
||||
VERIFY(big32.data() == reinterpret_cast<const char *>(&big32));
|
||||
VERIFY(big40.data() == reinterpret_cast<const char *>(&big40));
|
||||
VERIFY(big48.data() == reinterpret_cast<const char *>(&big48));
|
||||
VERIFY(big56.data() == reinterpret_cast<const char *>(&big56));
|
||||
VERIFY(big64.data() == reinterpret_cast<const char *>(&big64));
|
||||
|
||||
VERIFY(ubig8.data() == reinterpret_cast<const char *>(&ubig8));
|
||||
VERIFY(ubig16.data() == reinterpret_cast<const char *>(&ubig16));
|
||||
VERIFY(ubig24.data() == reinterpret_cast<const char *>(&ubig24));
|
||||
VERIFY(ubig32.data() == reinterpret_cast<const char *>(&ubig32));
|
||||
VERIFY(ubig40.data() == reinterpret_cast<const char *>(&ubig40));
|
||||
VERIFY(ubig48.data() == reinterpret_cast<const char *>(&ubig48));
|
||||
VERIFY(ubig56.data() == reinterpret_cast<const char *>(&ubig56));
|
||||
VERIFY(ubig64.data() == reinterpret_cast<const char *>(&ubig64));
|
||||
|
||||
VERIFY(little8.data() == reinterpret_cast<const char *>(&little8));
|
||||
VERIFY(little16.data() == reinterpret_cast<const char *>(&little16));
|
||||
VERIFY(little24.data() == reinterpret_cast<const char *>(&little24));
|
||||
VERIFY(little32.data() == reinterpret_cast<const char *>(&little32));
|
||||
VERIFY(little40.data() == reinterpret_cast<const char *>(&little40));
|
||||
VERIFY(little48.data() == reinterpret_cast<const char *>(&little48));
|
||||
VERIFY(little56.data() == reinterpret_cast<const char *>(&little56));
|
||||
VERIFY(little64.data() == reinterpret_cast<const char *>(&little64));
|
||||
|
||||
VERIFY(ulittle8.data() == reinterpret_cast<const char *>(&ulittle8));
|
||||
VERIFY(ulittle16.data() == reinterpret_cast<const char *>(&ulittle16));
|
||||
VERIFY(ulittle24.data() == reinterpret_cast<const char *>(&ulittle24));
|
||||
VERIFY(ulittle32.data() == reinterpret_cast<const char *>(&ulittle32));
|
||||
VERIFY(ulittle40.data() == reinterpret_cast<const char *>(&ulittle40));
|
||||
VERIFY(ulittle48.data() == reinterpret_cast<const char *>(&ulittle48));
|
||||
VERIFY(ulittle56.data() == reinterpret_cast<const char *>(&ulittle56));
|
||||
VERIFY(ulittle64.data() == reinterpret_cast<const char *>(&ulittle64));
|
||||
|
||||
VERIFY(native8.data() == reinterpret_cast<const char *>(&native8));
|
||||
VERIFY(native16.data() == reinterpret_cast<const char *>(&native16));
|
||||
VERIFY(native24.data() == reinterpret_cast<const char *>(&native24));
|
||||
VERIFY(native32.data() == reinterpret_cast<const char *>(&native32));
|
||||
VERIFY(native40.data() == reinterpret_cast<const char *>(&native40));
|
||||
VERIFY(native48.data() == reinterpret_cast<const char *>(&native48));
|
||||
VERIFY(native56.data() == reinterpret_cast<const char *>(&native56));
|
||||
VERIFY(native64.data() == reinterpret_cast<const char *>(&native64));
|
||||
|
||||
VERIFY(unative8.data() == reinterpret_cast<const char *>(&unative8));
|
||||
VERIFY(unative16.data() == reinterpret_cast<const char *>(&unative16));
|
||||
VERIFY(unative24.data() == reinterpret_cast<const char *>(&unative24));
|
||||
VERIFY(unative32.data() == reinterpret_cast<const char *>(&unative32));
|
||||
VERIFY(unative40.data() == reinterpret_cast<const char *>(&unative40));
|
||||
VERIFY(unative48.data() == reinterpret_cast<const char *>(&unative48));
|
||||
VERIFY(unative56.data() == reinterpret_cast<const char *>(&unative56));
|
||||
VERIFY(unative64.data() == reinterpret_cast<const char *>(&unative64));
|
||||
|
||||
VERIFY(aligned_big16.data() == reinterpret_cast<const char *>(&aligned_big16));
|
||||
VERIFY(aligned_big32.data() == reinterpret_cast<const char *>(&aligned_big32));
|
||||
VERIFY(aligned_big64.data() == reinterpret_cast<const char *>(&aligned_big64));
|
||||
|
||||
VERIFY(aligned_ubig16.data() == reinterpret_cast<const char *>(&aligned_ubig16));
|
||||
VERIFY(aligned_ubig32.data() == reinterpret_cast<const char *>(&aligned_ubig32));
|
||||
VERIFY(aligned_ubig64.data() == reinterpret_cast<const char *>(&aligned_ubig64));
|
||||
|
||||
VERIFY(aligned_little16.data() == reinterpret_cast<const char *>(&aligned_little16));
|
||||
VERIFY(aligned_little32.data() == reinterpret_cast<const char *>(&aligned_little32));
|
||||
VERIFY(aligned_little64.data() == reinterpret_cast<const char *>(&aligned_little64));
|
||||
|
||||
VERIFY(aligned_ulittle16.data() == reinterpret_cast<const char *>(&aligned_ulittle16));
|
||||
VERIFY(aligned_ulittle32.data() == reinterpret_cast<const char *>(&aligned_ulittle32));
|
||||
VERIFY(aligned_ulittle64.data() == reinterpret_cast<const char *>(&aligned_ulittle64));
|
||||
|
||||
}
|
||||
|
||||
// check_size ------------------------------------------------------------//
|
||||
|
||||
void check_size()
|
||||
@@ -572,6 +718,8 @@ namespace
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
// main ------------------------------------------------------------------------------//
|
||||
|
||||
int main( int argc, char * argv[] )
|
||||
{
|
||||
cout << "Usage: "
|
||||
@@ -586,6 +734,7 @@ int main( int argc, char * argv[] )
|
||||
check_size();
|
||||
check_alignment();
|
||||
check_representation_and_range_and_ops();
|
||||
check_data();
|
||||
|
||||
//timing_test<big32_t> ( "big32_t" );
|
||||
//timing_test<aligned_big32_t>( "aligned_big32_t" );
|
||||
|
||||
@@ -1,11 +1,41 @@
|
||||
set ENDIAN_LOCATE_ROOT=%TEMP%\endian-regr
|
||||
md %ENDIAN_LOCATE_ROOT% 2>nul
|
||||
@echo off
|
||||
echo Special version of boost_test for sandbox version of endian library.
|
||||
xcopy /D %BOOST_TRUNK%\boost-build.jam ..\..\..
|
||||
xcopy /D %BOOST_TRUNK%\Jamroot ..\..\..
|
||||
set BOOST_BUILD_PATH=%BOOST_TRUNK%\tools\build\v2
|
||||
|
||||
if not $%1==$--help goto nohelp
|
||||
echo Invoke: boost_test [-ts toolset] [bjam-options]
|
||||
echo Default -ts is gcc-4.3,msvc-8.0,msvc-9.0express,msvc-10.0express
|
||||
goto done
|
||||
:nohelp
|
||||
|
||||
if $%1==$-ts goto toolset
|
||||
|
||||
echo Begin test processing...
|
||||
bjam --dump-tests includes=/boost/trunk "-sALL_LOCATE_TARGET=%ENDIAN_LOCATE_ROOT%" %* >bjam.log 2>&1
|
||||
bjam include=%BOOST_TRUNK% --v2 --dump-tests --toolset=gcc-4.3,msvc-8.0,msvc-9.0express,msvc-10.0express %* >bjam.log 2>&1
|
||||
goto jam_log
|
||||
|
||||
:toolset
|
||||
echo Begin test processing...
|
||||
bjam include=%BOOST_TRUNK% --v2 --dump-tests --toolset=%2 %3 %4 %5 %6 %7 %8 %9 >bjam.log 2>&1
|
||||
|
||||
:jam_log
|
||||
echo Begin log processing...
|
||||
process_jam_log %ENDIAN_LOCATE_ROOT% <bjam.log
|
||||
process_jam_log --v2 <bjam.log
|
||||
start bjam.log
|
||||
|
||||
echo Begin compiler status processing...
|
||||
compiler_status --locate-root %ENDIAN_LOCATE_ROOT% ..\..\.. test_status.html test_links.html
|
||||
call boost_relative_root
|
||||
rem compiler_status barfs on a relative root, so convert it to absolute
|
||||
dir %BOOST_RELATIVE_ROOT% | grep " Directory of " >%TEMP%\babsr.bat
|
||||
%UTIL%\change %TEMP%\babsr.bat " Directory of " "set BOOST_TEST_ABS_ROOT=" >nul
|
||||
%UTIL%\change %TEMP%\babsr.bat "C:" "c:" >nul
|
||||
%UTIL%\change %TEMP%\babsr.bat "D:" "d:" >nul
|
||||
%UTIL%\change %TEMP%\babsr.bat "E:" "e:" >nul
|
||||
%UTIL%\change %TEMP%\babsr.bat "F:" "f:" >nul
|
||||
call %TEMP%\babsr.bat
|
||||
compiler_status --v2 %BOOST_TEST_ABS_ROOT% test_status.html test_links.html
|
||||
start test_status.html
|
||||
|
||||
:done
|
||||
Reference in new issue
Block a user