1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Use lower-case u integral suffix

This commit is contained in:
Hielke Morsink
2022-10-17 19:21:18 +02:00
parent 97a7fcc110
commit 31dd4bf604
78 changed files with 618 additions and 618 deletions

View File

@@ -14,14 +14,14 @@ using namespace OpenRCT2;
TEST(BitTest, test_index_construction)
{
BitSet<64U> bits({ 0U, 2U, 4U, 6U, 8U, 10U });
BitSet<64u> bits({ 0u, 2u, 4u, 6u, 8u, 10u });
#if defined(_M_X64) || defined(_M_ARM64)
static_assert(std::is_same_v<decltype(bits)::BlockType, uint64_t>);
#else
static_assert(std::is_same_v<decltype(bits)::BlockType, uint32_t>);
#endif
constexpr auto size = sizeof(bits);
static_assert(size == 8U);
static_assert(size == 8u);
ASSERT_EQ(bits.data()[0], 0b10101010101U);
ASSERT_EQ(bits.to_string(), std::string("0000000000000000000000000000000000000000000000000000010101010101"));
@@ -29,7 +29,7 @@ TEST(BitTest, test_index_construction)
TEST(BitTest, test_basic)
{
BitSet<8U> bits;
BitSet<8u> bits;
static_assert(std::is_same_v<decltype(bits)::BlockType, uint8_t>);
constexpr auto size = sizeof(bits);
static_assert(size == sizeof(uint8_t));
@@ -42,26 +42,26 @@ TEST(BitTest, test_basic)
ASSERT_EQ(bits[0], false);
bits[0] = bits[6];
ASSERT_EQ(bits[0], true);
ASSERT_EQ(bits.data()[0U], 0b01000001U);
ASSERT_EQ(bits.data()[0u], 0b01000001U);
ASSERT_EQ(bits.to_string(), std::string("01000001"));
}
TEST(BitTest, test_flip)
{
BitSet<8U> bits;
BitSet<8u> bits;
static_assert(std::is_same_v<decltype(bits)::BlockType, uint8_t>);
constexpr auto size = sizeof(bits);
static_assert(size == sizeof(uint8_t));
bits.flip();
ASSERT_EQ(bits.data()[0U], 0xFFu);
ASSERT_EQ(bits.data()[0u], 0xFFu);
bits.flip();
ASSERT_EQ(bits.data()[0U], 0x00u);
ASSERT_EQ(bits.data()[0u], 0x00u);
}
TEST(BitTest, test_trim8)
{
BitSet<5U> bits;
BitSet<5u> bits;
static_assert(std::is_same_v<decltype(bits)::BlockType, uint8_t>);
constexpr auto size = sizeof(bits);
static_assert(size == sizeof(uint8_t));
@@ -70,12 +70,12 @@ TEST(BitTest, test_trim8)
ASSERT_EQ(bits[5], false);
ASSERT_EQ(bits[6], false);
ASSERT_EQ(bits[7], false);
ASSERT_EQ(bits.data()[0U], 0b00011111u);
ASSERT_EQ(bits.data()[0u], 0b00011111u);
}
TEST(BitTest, test_trim16)
{
BitSet<14U> bits;
BitSet<14u> bits;
static_assert(std::is_same_v<decltype(bits)::BlockType, uint16_t>);
constexpr auto size = sizeof(bits);
static_assert(size == sizeof(uint16_t));
@@ -83,42 +83,42 @@ TEST(BitTest, test_trim16)
bits.flip();
ASSERT_EQ(bits[14], false);
ASSERT_EQ(bits[15], false);
ASSERT_EQ(bits.data()[0U], 0b0011111111111111u);
ASSERT_EQ(bits.data()[0u], 0b0011111111111111u);
ASSERT_EQ(bits.to_string(), std::string("11111111111111"));
}
TEST(BitTest, test_big)
{
BitSet<256U> bits;
BitSet<256u> bits;
constexpr auto size = sizeof(bits);
static_assert(size == 32U);
static_assert(size == 32u);
bits.flip();
#if defined(_M_X64) || defined(_M_ARM64)
static_assert(std::is_same_v<decltype(bits)::BlockType, uint64_t>);
static_assert(bits.data().size() == 4);
ASSERT_EQ(bits.data()[0], ~0ULL);
ASSERT_EQ(bits.data()[1], ~0ULL);
ASSERT_EQ(bits.data()[2], ~0ULL);
ASSERT_EQ(bits.data()[3], ~0ULL);
ASSERT_EQ(bits.data()[0], ~0uLL);
ASSERT_EQ(bits.data()[1], ~0uLL);
ASSERT_EQ(bits.data()[2], ~0uLL);
ASSERT_EQ(bits.data()[3], ~0uLL);
#else
static_assert(std::is_same_v<decltype(bits)::BlockType, uint32_t>);
static_assert(bits.data().size() == 8);
ASSERT_EQ(bits.data()[0], ~0UL);
ASSERT_EQ(bits.data()[1], ~0UL);
ASSERT_EQ(bits.data()[2], ~0UL);
ASSERT_EQ(bits.data()[3], ~0UL);
ASSERT_EQ(bits.data()[4], ~0UL);
ASSERT_EQ(bits.data()[5], ~0UL);
ASSERT_EQ(bits.data()[6], ~0UL);
ASSERT_EQ(bits.data()[7], ~0UL);
ASSERT_EQ(bits.data()[0], ~0uL);
ASSERT_EQ(bits.data()[1], ~0uL);
ASSERT_EQ(bits.data()[2], ~0uL);
ASSERT_EQ(bits.data()[3], ~0uL);
ASSERT_EQ(bits.data()[4], ~0uL);
ASSERT_EQ(bits.data()[5], ~0uL);
ASSERT_EQ(bits.data()[6], ~0uL);
ASSERT_EQ(bits.data()[7], ~0uL);
#endif
}
TEST(BitTest, test_xor5)
{
BitSet<5U> bits1({ 0U, 2U, 4U });
BitSet<5U> bits2({ 0U, 1U, 3U });
BitSet<5u> bits1({ 0u, 2u, 4u });
BitSet<5u> bits2({ 0u, 1u, 3u });
auto res = bits1 ^ bits2;
ASSERT_EQ(res.data()[0], 0b11110u);
@@ -127,8 +127,8 @@ TEST(BitTest, test_xor5)
TEST(BitTest, test_xor15)
{
BitSet<15U> bits1({ 0U, 2U, 4U });
BitSet<15U> bits2({ 0U, 1U, 3U, 14U });
BitSet<15u> bits1({ 0u, 2u, 4u });
BitSet<15u> bits2({ 0u, 1u, 3u, 14u });
auto res = bits1 ^ bits2;
ASSERT_EQ(res.data()[0], 0b0100000000011110u);
@@ -137,8 +137,8 @@ TEST(BitTest, test_xor15)
TEST(BitTest, test_or5)
{
BitSet<5U> bits1({ 0U, 2U, 4U });
BitSet<5U> bits2({ 0U, 1U, 3U });
BitSet<5u> bits1({ 0u, 2u, 4u });
BitSet<5u> bits2({ 0u, 1u, 3u });
auto res = bits1 | bits2;
ASSERT_EQ(res.data()[0], 0b11111);
@@ -147,8 +147,8 @@ TEST(BitTest, test_or5)
TEST(BitTest, test_or15)
{
BitSet<15U> bits1({ 0U, 2U, 4U });
BitSet<15U> bits2({ 0U, 1U, 3U, 14U });
BitSet<15u> bits1({ 0u, 2u, 4u });
BitSet<15u> bits2({ 0u, 1u, 3u, 14u });
auto res = bits1 | bits2;
ASSERT_EQ(res.data()[0], 0b0100000000011111u);
@@ -157,8 +157,8 @@ TEST(BitTest, test_or15)
TEST(BitTest, test_and5)
{
BitSet<5U> bits1({ 0U, 2U, 4U });
BitSet<5U> bits2({ 0U, 1U, 3U });
BitSet<5u> bits1({ 0u, 2u, 4u });
BitSet<5u> bits2({ 0u, 1u, 3u });
auto res = bits1 & bits2;
ASSERT_EQ(res.data()[0], 0b1);
@@ -167,8 +167,8 @@ TEST(BitTest, test_and5)
TEST(BitTest, test_and15)
{
BitSet<15U> bits1({ 0U, 2U, 4U });
BitSet<15U> bits2({ 0U, 1U, 3U, 14U });
BitSet<15u> bits1({ 0u, 2u, 4u });
BitSet<15u> bits2({ 0u, 1u, 3u, 14u });
auto res = bits1 & bits2;
ASSERT_EQ(res.data()[0], 0b1);
@@ -177,7 +177,7 @@ TEST(BitTest, test_and15)
TEST(BitTest, test_neg5)
{
BitSet<5U> bits1({ 0U, 2U, 4U });
BitSet<5u> bits1({ 0u, 2u, 4u });
auto res = ~bits1;
ASSERT_EQ(res.data()[0], 0b01010u);
@@ -186,7 +186,7 @@ TEST(BitTest, test_neg5)
TEST(BitTest, test_neg15)
{
BitSet<15U> bits1({ 0U, 2U, 4U });
BitSet<15u> bits1({ 0u, 2u, 4u });
auto res = ~bits1;
ASSERT_EQ(res.data()[0], 0b111111111101010u);
@@ -195,13 +195,13 @@ TEST(BitTest, test_neg15)
TEST(BitTest, test_count)
{
BitSet<31U> bits1({ 0U, 2U, 4U, 7U, 9U, 12U, 16U, 19U, 22U, 29U });
ASSERT_EQ(bits1.count(), 10U);
BitSet<31u> bits1({ 0u, 2u, 4u, 7u, 9u, 12u, 16u, 19u, 22u, 29u });
ASSERT_EQ(bits1.count(), 10u);
}
TEST(BitTest, test_iterator)
{
BitSet<31U> bits1({ 0U, 2U, 4U, 7U, 9U, 12U, 16U, 19U, 22U, 29U });
BitSet<31u> bits1({ 0u, 2u, 4u, 7u, 9u, 12u, 16u, 19u, 22u, 29u });
int totalBits = 0;
for (auto v : bits1)
@@ -214,7 +214,7 @@ TEST(BitTest, test_iterator)
TEST(BitTest, test_iterator_const)
{
BitSet<31U> bits1({ 0U, 2U, 4U, 7U, 9U, 12U, 16U, 19U, 22U, 29U });
BitSet<31u> bits1({ 0u, 2u, 4u, 7u, 9u, 12u, 16u, 19u, 22u, 29u });
int totalBits = 0;
auto test = [&](const auto& b) {