Main MRPT website > C++ reference for MRPT 1.5.5
bits_unittest.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include <mrpt/utils/core_defs.h>
11 #include <mrpt/utils/bits.h>
12 #include <gtest/gtest.h>
13 
14 using namespace mrpt;
15 using namespace mrpt::utils;
16 using namespace std;
17 
18 // Load data from constant file and check for exact match.
20 {
21  {
22  uint8_t val = 0x88, val_r;
23  const uint8_t val_r_ok = 0x88;
24 
26  EXPECT_EQ(val_r, val_r_ok);
28  EXPECT_EQ(val, val_r_ok);
29  }
30  {
31  uint16_t val = 0x1122, val_r;
32  const uint16_t val_r_ok = 0x2211;
33 
35  EXPECT_EQ(val_r, val_r_ok);
37  EXPECT_EQ(val, val_r_ok);
38  }
39  {
40  uint32_t val = UINT32_C(0x11223344), val_r;
41  const uint32_t val_r_ok = UINT32_C(0x44332211);
42 
44  EXPECT_EQ(val_r, val_r_ok);
46  EXPECT_EQ(val, val_r_ok);
47  }
48  {
49  uint64_t val = UINT64_C( 0x1122334455667788 ), val_r;
50  const uint64_t val_r_ok = UINT64_C( 0x8877665544332211 );
51 
53  EXPECT_EQ(val_r, val_r_ok);
55  EXPECT_EQ(val, val_r_ok);
56  }
57 }
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
unsigned __int16 uint16_t
Definition: rptypes.h:46
void BASE_IMPEXP reverseBytesInPlace(bool &v_in_out)
Reverse the order of the bytes of a given type (useful for transforming btw little/big endian) ...
STL namespace.
unsigned char uint8_t
Definition: rptypes.h:43
void reverseBytes(const T &v_in, T &v_out)
Reverse the order of the bytes of a given type (useful for transforming btw little/big endian) ...
int val
Definition: mrpt_jpeglib.h:953
void reverseBytes(const T &v_in, T &v_out)
Reverse the order of the bytes of a given type (useful for transforming btw little/big endian) ...
Definition: bits.h:162
TEST(bits, reverseBytes)
unsigned __int64 uint64_t
Definition: rptypes.h:52
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t
Definition: rptypes.h:49



Page generated by Doxygen 1.8.14 for MRPT 1.5.5 Git: e06b63dbf Fri Dec 1 14:41:11 2017 +0100 at lun oct 28 01:31:35 CET 2019