The Road to Clang-Format part 1
Whitespace: The Darkening
Change-Id: I9c0c355ddf22f9b27763c97e3e85079c135ae7a7
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/test/bit_string_test.cpp b/test/bit_string_test.cpp
index 8320d97..8745911 100644
--- a/test/bit_string_test.cpp
+++ b/test/bit_string_test.cpp
@@ -14,23 +14,23 @@
// isBitSet()
// getSetCount()
// isZero()
-TEST( BitStringTest, TestSet1 )
+TEST(BitStringTest, TestSet1)
{
BitStringBuffer bs(UINT64_BIT_LEN);
uint32_t i;
// set all bits in ascending order
- for(i = 0; i < UINT64_BIT_LEN; i++)
+ for (i = 0; i < UINT64_BIT_LEN; i++)
{
// Make sure bit gets set and set count
// is increasing
bs.setBit(i);
ASSERT_TRUE(bs.isBitSet(i));
- ASSERT_EQ(bs.getSetCount(), i+1);
+ ASSERT_EQ(bs.getSetCount(), i + 1);
}
// all bits should be set at this point
- ASSERT_EQ(bs.getFieldRight(0,64), UINT64_MAX);
- ASSERT_EQ(bs.getFieldLeft(0,64), UINT64_MAX);
+ ASSERT_EQ(bs.getFieldRight(0, 64), UINT64_MAX);
+ ASSERT_EQ(bs.getFieldLeft(0, 64), UINT64_MAX);
// test clearAll(), setAll()
bs.clearAll();
@@ -39,23 +39,23 @@
ASSERT_EQ(bs.getSetCount(), UINT64_BIT_LEN);
// clear all bits in descending order
- for(i = UINT64_BIT_LEN; 0 != i; i--)
+ for (i = UINT64_BIT_LEN; 0 != i; i--)
{
// make sure bit gets cleared and set count
// is decreasing
ASSERT_EQ(bs.getSetCount(), i);
- bs.clearBit(i-1);
- ASSERT_FALSE(bs.isBitSet(i-1));
+ bs.clearBit(i - 1);
+ ASSERT_FALSE(bs.isBitSet(i - 1));
}
// all bits should be clear at this point
ASSERT_EQ(bs.getSetCount(), 0u);
- ASSERT_EQ(bs.getFieldRight(0,64), 0u);
- ASSERT_EQ(bs.getFieldLeft(0,64), 0u);
+ ASSERT_EQ(bs.getFieldRight(0, 64), 0u);
+ ASSERT_EQ(bs.getFieldLeft(0, 64), 0u);
ASSERT_TRUE(bs.isZero());
}
// setPattern()
-TEST( BitStringTest, TestSet2 )
+TEST(BitStringTest, TestSet2)
{
BitStringBuffer bs(UINT64_BIT_LEN);
uint64_t field = 0xaaaaaaaaaaaaaaaa;
@@ -80,7 +80,7 @@
}
// setString()
-TEST( BitStringTest, TestSet3 )
+TEST(BitStringTest, TestSet3)
{
BitStringBuffer bsb_dest(64);
BitStringBuffer bsb_src(64);
@@ -93,12 +93,12 @@
bsb_dest.setString(bsb_src);
ASSERT_FALSE(bsb_dest.isZero());
- ASSERT_EQ(bsb_dest.getFieldRight(0, 64), bsb_src.getFieldRight(0,64));
- ASSERT_EQ(bsb_dest.getFieldLeft(0, 64), bsb_src.getFieldLeft(0,64));
+ ASSERT_EQ(bsb_dest.getFieldRight(0, 64), bsb_src.getFieldRight(0, 64));
+ ASSERT_EQ(bsb_dest.getFieldLeft(0, 64), bsb_src.getFieldLeft(0, 64));
}
// maskString()
-TEST( BitStringTest, TestSet4 )
+TEST(BitStringTest, TestSet4)
{
BitStringBuffer bsb(64);
bsb.setAll();
@@ -115,49 +115,48 @@
// setFieldLeft()
// getFielRight()
// getFieldLeft()
-TEST( BitStringTest, TestSet5 )
+TEST(BitStringTest, TestSet5)
{
uint64_t field = 0x1234567890abcdef;
BitStringBuffer bsb(64);
// set bitstring to low end of field
bsb.setFieldRight(0, 32, field);
- ASSERT_EQ(field << 32, bsb.getFieldLeft(0,32));
+ ASSERT_EQ(field << 32, bsb.getFieldLeft(0, 32));
// set bitstring to high end of field
bsb.setFieldLeft(0, 32, field);
- ASSERT_EQ(field >> 32, bsb.getFieldRight(0,32));
+ ASSERT_EQ(field >> 32, bsb.getFieldRight(0, 32));
// increasing offset
- for(uint32_t i = 0; i < UINT64_BIT_LEN; i++)
+ for (uint32_t i = 0; i < UINT64_BIT_LEN; i++)
{
// increasing length
- for(uint32_t j = 1; j <= UINT64_BIT_LEN - i; j++)
+ for (uint32_t j = 1; j <= UINT64_BIT_LEN - i; j++)
{
bsb.clearAll();
bsb.setFieldRight(i, j, UINT64_MAX);
// verify
- ASSERT_EQ(bsb.getFieldRight(i, j), \
- UINT64_MAX >> (UINT64_BIT_LEN - j));
-
+ ASSERT_EQ(bsb.getFieldRight(i, j),
+ UINT64_MAX >> (UINT64_BIT_LEN - j));
}
}
- for(uint32_t i = 0; i < UINT64_BIT_LEN; i++)
+ for (uint32_t i = 0; i < UINT64_BIT_LEN; i++)
{
// set 1 bit at offset i
bsb.clearAll();
bsb.setFieldRight(i, 1, 1);
// verify bit is set
- ASSERT_EQ(bsb.getFieldRight(0, 64), (uint64_t)1 << \
- (UINT64_BIT_LEN - i - 1));
+ ASSERT_EQ(bsb.getFieldRight(0, 64),
+ (uint64_t)1 << (UINT64_BIT_LEN - i - 1));
}
}
// operator >>
// operator <<
-TEST( BitStringTest, TestSet6 )
+TEST(BitStringTest, TestSet6)
{
uint64_t field = 0x1234567890abcdef;
BitStringBuffer bsb(64);
diff --git a/test/flyweight_test.cpp b/test/flyweight_test.cpp
index 83b33c0..118f24e 100644
--- a/test/flyweight_test.cpp
+++ b/test/flyweight_test.cpp
@@ -8,20 +8,20 @@
{
public:
Foo() = default;
- explicit Foo( int i ) : iv_i(i) {}
+ explicit Foo(int i) : iv_i(i) {}
int get() const { return iv_i; }
- bool operator==( const Foo & i_r ) const { return iv_i == i_r.iv_i; }
- bool operator<( const Foo & i_r ) const { return iv_i < i_r.iv_i; }
+ bool operator==(const Foo & i_r) const { return iv_i == i_r.iv_i; }
+ bool operator<(const Foo & i_r) const { return iv_i < i_r.iv_i; }
private:
int iv_i = 0;
};
-Foo & addFoo( int i )
+Foo & addFoo(int i)
{
- return Flyweight<Foo>::getSingleton().get( Foo { i } );
+ return Flyweight<Foo>::getSingleton().get(Foo { i });
}
-TEST( FlyweightTest, TestSet1 )
+TEST(FlyweightTest, TestSet1)
{
// Add some unique entries in a random order and keep track of where those
// enties exist in memory.
@@ -34,9 +34,9 @@
// Now add more entries and verify the 'new' entries match the same
// addresses as the previously added entries.
- for ( int i = 4; i >= 0; i-- )
+ for (int i = 4; i >= 0; i--)
{
- ASSERT_EQ( a[i], &(addFoo(i)) );
+ ASSERT_EQ(a[i], &(addFoo(i)));
}
// At this point, we have proven that duplicate entries will return
diff --git a/test/hei_user_defines.hpp b/test/hei_user_defines.hpp
index 8b23473..eec606d 100644
--- a/test/hei_user_defines.hpp
+++ b/test/hei_user_defines.hpp
@@ -1,25 +1,24 @@
#pragma once
/**
-* @file hei_user_defines.hpp
-* @brief The purpose of this file is to create common defines that
-* will be used throughout this library.
-**/
+ * @file hei_user_defines.hpp
+ * @brief The purpose of this file is to create common defines that
+ * will be used throughout this library.
+ */
#include <stdio.h>
#include <assert.h>
-#define HEI_INF( ... ) \
-{ \
- printf( "I> " __VA_ARGS__ ); \
- printf( "\n" ); \
-}
+#define HEI_INF(...) \
+ { \
+ printf("I> " __VA_ARGS__); \
+ printf("\n"); \
+ }
-#define HEI_ERR( ... ) \
-{ \
- printf( "E> " __VA_ARGS__ ); \
- printf( "\n" ); \
-}
+#define HEI_ERR(...) \
+ { \
+ printf("E> " __VA_ARGS__); \
+ printf("\n"); \
+ }
-#define HEI_ASSERT( expression ) \
- assert( expression );
+#define HEI_ASSERT(expression) assert(expression);
diff --git a/test/simulator/hei_sim_main.cpp b/test/simulator/hei_sim_main.cpp
index 46de629..166b54e 100644
--- a/test/simulator/hei_sim_main.cpp
+++ b/test/simulator/hei_sim_main.cpp
@@ -7,7 +7,7 @@
void * buffer = nullptr;
size_t sz_buffer = 0;
- initialize( buffer, sz_buffer );
+ initialize(buffer, sz_buffer);
Chip c1, c2;
@@ -17,7 +17,7 @@
IsolationData isoData;
- isolate( chipList, isoData );
+ isolate(chipList, isoData);
uninitialize();
diff --git a/test/simulator/hei_sim_user_interface.cpp b/test/simulator/hei_sim_user_interface.cpp
index c3baeb3..073ae22 100644
--- a/test/simulator/hei_sim_user_interface.cpp
+++ b/test/simulator/hei_sim_user_interface.cpp
@@ -7,21 +7,21 @@
//------------------------------------------------------------------------------
-ReturnCode registerRead( void * i_chip, void * o_buffer, size_t & io_bufSize,
- uint64_t i_regType, uint64_t i_address )
+ReturnCode registerRead(void * i_chip, void * o_buffer, size_t & io_bufSize,
+ uint64_t i_regType, uint64_t i_address)
{
ReturnCode rc;
- HEI_ASSERT( nullptr != i_chip );
- HEI_ASSERT( nullptr != o_buffer );
- HEI_ASSERT( 0 != io_bufSize );
+ HEI_ASSERT(nullptr != i_chip);
+ HEI_ASSERT(nullptr != o_buffer);
+ HEI_ASSERT(0 != io_bufSize);
- switch ( i_regType )
+ switch (i_regType)
{
default:
rc = RC_REG_ACCESS_FAILURE;
- HEI_ERR( "registerRead(%p,%p,%lx,%lx,%lx)", i_chip, o_buffer,
- io_bufSize, i_regType, i_address );
+ HEI_ERR("registerRead(%p,%p,%lx,%lx,%lx)", i_chip, o_buffer,
+ io_bufSize, i_regType, i_address);
}
return rc;
@@ -31,21 +31,21 @@
#ifndef __HEI_READ_ONLY
-ReturnCode registerWrite( void * i_chip, void * i_buffer, size_t & io_bufSize,
- uint64_t i_regType, uint64_t i_address )
+ReturnCode registerWrite(void * i_chip, void * i_buffer, size_t & io_bufSize,
+ uint64_t i_regType, uint64_t i_address)
{
ReturnCode rc;
- HEI_ASSERT( nullptr != i_chip );
- HEI_ASSERT( nullptr != i_buffer );
- HEI_ASSERT( 0 != io_bufSize );
+ HEI_ASSERT(nullptr != i_chip);
+ HEI_ASSERT(nullptr != i_buffer);
+ HEI_ASSERT(0 != io_bufSize);
- switch ( i_regType )
+ switch (i_regType)
{
default:
rc = RC_REG_ACCESS_FAILURE;
- HEI_ERR( "registerWrite(%p,%p,%lx,%lx,%lx)", i_chip, i_buffer,
- io_bufSize, i_regType, i_address );
+ HEI_ERR("registerWrite(%p,%p,%lx,%lx,%lx)", i_chip, i_buffer,
+ io_bufSize, i_regType, i_address);
}
return rc;
@@ -56,4 +56,3 @@
//------------------------------------------------------------------------------
} // end namespace libhei
-