Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 623047419
  • Loading branch information
XLS Team authored and copybara-github committed Apr 9, 2024
1 parent 594f0df commit 3af76fc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions xls/common/math_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void TestCeilOfRatio(const IntegralType test_data[][kNumTestArguments],

template <typename UnsignedIntegralType>
void TestCeilOfRatioUnsigned() {
typedef std::numeric_limits<UnsignedIntegralType> Limits;
using Limits = std::numeric_limits<UnsignedIntegralType>;
EXPECT_TRUE(Limits::is_integer);
EXPECT_FALSE(Limits::is_signed);
const UnsignedIntegralType kMax = Limits::max();
Expand Down Expand Up @@ -93,7 +93,7 @@ void TestCeilOfRatioUnsigned() {

template <typename SignedInteger>
void TestCeilOfRatioSigned() {
typedef std::numeric_limits<SignedInteger> Limits;
using Limits = std::numeric_limits<SignedInteger>;
EXPECT_TRUE(Limits::is_integer);
EXPECT_TRUE(Limits::is_signed);
const SignedInteger kMin = Limits::min();
Expand Down
72 changes: 36 additions & 36 deletions xls/common/strong_int_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ TYPED_TEST_SUITE(StrongIntTest, SupportedStrongIntTypes);
// comparison operators which must themselves be tested.

TYPED_TEST(StrongIntTest, TestTraits) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
using T = typename TestFixture::StrongIntTypeUnderTest;
EXPECT_TRUE(std::is_standard_layout<T>::value);
EXPECT_TRUE(std::is_trivially_copy_constructible<T>::value);
EXPECT_TRUE(std::is_trivially_copy_assignable<T>::value);
EXPECT_TRUE(std::is_trivially_destructible<T>::value);
}

TYPED_TEST(StrongIntTest, TestCtors) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

{ // Test default construction.
T x;
Expand Down Expand Up @@ -217,26 +217,26 @@ struct PositiveValidator {
} // namespace

TYPED_TEST(StrongIntTest, TestCtorDeath) {
typedef typename TestFixture::StrongIntTypeUnderTest::ValueType V;
using V = typename TestFixture::StrongIntTypeUnderTest::ValueType;
if (std::numeric_limits<V>::is_signed) {
struct CustomTag {};
typedef StrongInt<CustomTag, V, PositiveValidator> T;
using T = StrongInt<CustomTag, V, PositiveValidator>;
EXPECT_DEATH(T(static_cast<V>(-123)), "PositiveValidator");
}
}

TYPED_TEST(StrongIntTest, TestMetadata) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

T t;
EXPECT_EQ(std::numeric_limits<V>::max(), t.Max());
EXPECT_EQ(std::numeric_limits<V>::min(), t.Min());
}

TYPED_TEST(StrongIntTest, TestUnaryOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

{ // Test unary plus and minus of positive values.
T x(123);
Expand Down Expand Up @@ -276,8 +276,8 @@ TYPED_TEST(StrongIntTest, TestUnaryOperators) {
}

TYPED_TEST(StrongIntTest, TestIncrementDecrementOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

{ // Test simple increments and decrements.
T x(0);
Expand All @@ -294,7 +294,7 @@ TYPED_TEST(StrongIntTest, TestIncrementDecrementOperators) {
}

TYPED_TEST(StrongIntTest, TestAssignmentOperator) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
using T = typename TestFixture::StrongIntTypeUnderTest;
{ // Test simple assignment from the same type.
T x(12);
T y(34);
Expand Down Expand Up @@ -326,8 +326,8 @@ TYPED_TEST(StrongIntTest, TestAssignmentOperator) {
}

TYPED_TEST(StrongIntTest, TestPlusOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test positive vs. positive addition.
TEST_T_OP_T(9, +, 3)
Expand All @@ -354,8 +354,8 @@ TYPED_TEST(StrongIntTest, TestPlusOperators) {
}

TYPED_TEST(StrongIntTest, TestMinusOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test positive vs. positive subtraction.
TEST_T_OP_T(9, -, 3)
Expand Down Expand Up @@ -409,8 +409,8 @@ TYPED_TEST(StrongIntTest, TestMinusOperators) {
}

TYPED_TEST(StrongIntTest, TestMultiplyOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test positive vs. positive multiplication.
TEST_T_OP_NUM(9, *, V, 3);
Expand Down Expand Up @@ -481,8 +481,8 @@ TYPED_TEST(StrongIntTest, TestMultiplyOperators) {
}

TYPED_TEST(StrongIntTest, TestDivideOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test positive vs. positive division.
TEST_T_OP_NUM(9, /, V, 3);
Expand Down Expand Up @@ -529,8 +529,8 @@ TYPED_TEST(StrongIntTest, TestDivideOperators) {
}

TYPED_TEST(StrongIntTest, TestModuloOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test positive vs. positive modulo.
TEST_T_OP_NUM(7, %, V, 6);
Expand Down Expand Up @@ -575,8 +575,8 @@ TYPED_TEST(StrongIntTest, TestModuloOperators) {
}

TYPED_TEST(StrongIntTest, TestLeftShiftOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test basic shift.
TEST_T_OP_NUM(0x09, <<, int, 3);
Expand All @@ -595,8 +595,8 @@ TYPED_TEST(StrongIntTest, TestLeftShiftOperators) {
}

TYPED_TEST(StrongIntTest, TestRightShiftOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test basic shift.
TEST_T_OP_NUM(0x09, >>, int, 3);
Expand All @@ -615,8 +615,8 @@ TYPED_TEST(StrongIntTest, TestRightShiftOperators) {
}

TYPED_TEST(StrongIntTest, TestBitAndOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test basic bit-and.
TEST_T_OP_T(0x09, &, 0x03);
Expand All @@ -635,8 +635,8 @@ TYPED_TEST(StrongIntTest, TestBitAndOperators) {
}

TYPED_TEST(StrongIntTest, TestBitOrOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test basic bit-or.
TEST_T_OP_T(0x09, |, 0x03);
Expand All @@ -655,8 +655,8 @@ TYPED_TEST(StrongIntTest, TestBitOrOperators) {
}

TYPED_TEST(StrongIntTest, TestBitXorOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
typedef typename T::ValueType V;
using T = typename TestFixture::StrongIntTypeUnderTest;
using V = typename T::ValueType;

// Test basic bit-xor.
TEST_T_OP_T(0x09, ^, 0x03);
Expand All @@ -675,7 +675,7 @@ TYPED_TEST(StrongIntTest, TestBitXorOperators) {
}

TYPED_TEST(StrongIntTest, TestComparisonOperators) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
using T = typename TestFixture::StrongIntTypeUnderTest;

T x(93);

Expand Down Expand Up @@ -715,7 +715,7 @@ TYPED_TEST(StrongIntTest, TestComparisonOperators) {
}

TYPED_TEST(StrongIntTest, TestStreamOutputOperator) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
using T = typename TestFixture::StrongIntTypeUnderTest;

T x(93);
std::ostringstream out;
Expand All @@ -724,7 +724,7 @@ TYPED_TEST(StrongIntTest, TestStreamOutputOperator) {
}

TYPED_TEST(StrongIntTest, TestHasher) {
typedef typename TestFixture::StrongIntTypeUnderTest T;
using T = typename TestFixture::StrongIntTypeUnderTest;

typename T::Hasher hasher;
EXPECT_EQ(hasher(T(0)), hasher(T(0)));
Expand Down Expand Up @@ -799,7 +799,7 @@ TYPED_TEST(StrongIntTest, ConstexprMinMax) {

template <typename Ttest, typename Tbig>
bool ExhaustiveTest() {
typedef typename Ttest::ValueType V;
using V = typename Ttest::ValueType;
Tbig v_min = std::numeric_limits<V>::min();
Tbig v_max = std::numeric_limits<V>::max();
for (Tbig lhs = v_min; lhs <= v_max; ++lhs) {
Expand Down

0 comments on commit 3af76fc

Please sign in to comment.