mirror of
https://github.com/boostorg/endian.git
synced 2025-07-30 04:27:24 +02:00
Add test/quick.cpp
This commit is contained in:
@ -25,3 +25,5 @@ run conversion_test.cpp ;
|
|||||||
run conversion_test.cpp : : : <define>BOOST_ENDIAN_NO_INTRINSICS : conversion_test_ni ;
|
run conversion_test.cpp : : : <define>BOOST_ENDIAN_NO_INTRINSICS : conversion_test_ni ;
|
||||||
|
|
||||||
run intrinsic_test.cpp ;
|
run intrinsic_test.cpp ;
|
||||||
|
|
||||||
|
run quick.cpp ;
|
||||||
|
31
test/quick.cpp
Normal file
31
test/quick.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright 2019 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/endian/arithmetic.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using namespace boost::endian;
|
||||||
|
|
||||||
|
{
|
||||||
|
little_uint32_t v( 0x01020304 );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( v.data()[ 0 ], 0x04 );
|
||||||
|
BOOST_TEST_EQ( v.data()[ 1 ], 0x03 );
|
||||||
|
BOOST_TEST_EQ( v.data()[ 2 ], 0x02 );
|
||||||
|
BOOST_TEST_EQ( v.data()[ 3 ], 0x01 );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
big_uint32_t v( 0x01020304 );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( v.data()[ 0 ], 0x01 );
|
||||||
|
BOOST_TEST_EQ( v.data()[ 1 ], 0x02 );
|
||||||
|
BOOST_TEST_EQ( v.data()[ 2 ], 0x03 );
|
||||||
|
BOOST_TEST_EQ( v.data()[ 3 ], 0x04 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
Reference in New Issue
Block a user