Skip to content

Commit

Permalink
STYLE: remove unnecessary parentheses around logical conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
dzenanz committed Sep 13, 2021
1 parent dcd7dfd commit e092a3d
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 62 deletions.
8 changes: 4 additions & 4 deletions Modules/Core/Common/test/itkIsConvertible.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ struct Child : Base
int
itkIsConvertible(int, char *[])
{
static_assert((itk::IsConvertible<char, double>::Value), "Unit test failed");
static_assert((!itk::IsConvertible<char, char *>::Value), "Unit test failed");
static_assert(itk::IsConvertible<char, double>::Value, "Unit test failed");
static_assert(!itk::IsConvertible<char, char *>::Value, "Unit test failed");

static_assert((itk::IsConvertible<Child *, void *>::Value), "Unit test failed");
static_assert((!itk::IsConvertible<void *, Child *>::Value), "Unit test failed");
static_assert(itk::IsConvertible<Child *, void *>::Value, "Unit test failed");
static_assert(!itk::IsConvertible<void *, Child *>::Value, "Unit test failed");

return EXIT_SUCCESS;
}
88 changes: 44 additions & 44 deletions Modules/Core/Common/test/itkMetaProgrammingLibraryTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,66 +27,66 @@ itkMetaProgrammingLibraryTest(int, char *[])
using namespace itk::mpl;

// Or between constants
static_assert((OrC<true, true, true>::Value == true), "Unit test failed");
static_assert((OrC<true, true, false>::Value == true), "Unit test failed");
static_assert((OrC<true, false, true>::Value == true), "Unit test failed");
static_assert((OrC<true, false, false>::Value == true), "Unit test failed");
static_assert((OrC<false, true, true>::Value == true), "Unit test failed");
static_assert((OrC<false, true, false>::Value == true), "Unit test failed");
static_assert((OrC<false, false, true>::Value == true), "Unit test failed");
static_assert((OrC<false, false, false>::Value == false), "Unit test failed");
static_assert(OrC<true, true, true>::Value == true, "Unit test failed");
static_assert(OrC<true, true, false>::Value == true, "Unit test failed");
static_assert(OrC<true, false, true>::Value == true, "Unit test failed");
static_assert(OrC<true, false, false>::Value == true, "Unit test failed");
static_assert(OrC<false, true, true>::Value == true, "Unit test failed");
static_assert(OrC<false, true, false>::Value == true, "Unit test failed");
static_assert(OrC<false, false, true>::Value == true, "Unit test failed");
static_assert(OrC<false, false, false>::Value == false, "Unit test failed");

static_assert((OrC<true, true>::Value == true), "Unit test failed");
static_assert((OrC<true, false>::Value == true), "Unit test failed");
static_assert((OrC<false, true>::Value == true), "Unit test failed");
static_assert((OrC<false, false>::Value == false), "Unit test failed");
static_assert(OrC<true, true>::Value == true, "Unit test failed");
static_assert(OrC<true, false>::Value == true, "Unit test failed");
static_assert(OrC<false, true>::Value == true, "Unit test failed");
static_assert(OrC<false, false>::Value == false, "Unit test failed");

// Or between types
static_assert((std::is_same<Or<TrueType, TrueType, TrueType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<TrueType, TrueType, FalseType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<TrueType, FalseType, TrueType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<TrueType, FalseType, FalseType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<FalseType, TrueType, TrueType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<FalseType, TrueType, FalseType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<FalseType, FalseType, TrueType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<FalseType, FalseType, FalseType>::Type, FalseType>::value), "Unit test failed");
static_assert(std::is_same<Or<TrueType, TrueType, TrueType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<TrueType, TrueType, FalseType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<TrueType, FalseType, TrueType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<TrueType, FalseType, FalseType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<FalseType, TrueType, TrueType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<FalseType, TrueType, FalseType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<FalseType, FalseType, TrueType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<FalseType, FalseType, FalseType>::Type, FalseType>::value, "Unit test failed");

static_assert((std::is_same<Or<TrueType, TrueType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<TrueType, FalseType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<FalseType, TrueType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Or<FalseType, FalseType>::Type, FalseType>::value), "Unit test failed");
static_assert(std::is_same<Or<TrueType, TrueType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<TrueType, FalseType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<FalseType, TrueType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Or<FalseType, FalseType>::Type, FalseType>::value, "Unit test failed");

// And between constants
static_assert((AndC<true, true>::Value == true), "Unit test failed");
static_assert((AndC<true, false>::Value == false), "Unit test failed");
static_assert((AndC<false, true>::Value == false), "Unit test failed");
static_assert((AndC<false, false>::Value == false), "Unit test failed");
static_assert(AndC<true, true>::Value == true, "Unit test failed");
static_assert(AndC<true, false>::Value == false, "Unit test failed");
static_assert(AndC<false, true>::Value == false, "Unit test failed");
static_assert(AndC<false, false>::Value == false, "Unit test failed");

// And between types
static_assert((std::is_same<And<TrueType, TrueType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<And<TrueType, FalseType>::Type, FalseType>::value), "Unit test failed");
static_assert((std::is_same<And<FalseType, TrueType>::Type, FalseType>::value), "Unit test failed");
static_assert((std::is_same<And<FalseType, FalseType>::Type, FalseType>::value), "Unit test failed");
static_assert(std::is_same<And<TrueType, TrueType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<And<TrueType, FalseType>::Type, FalseType>::value, "Unit test failed");
static_assert(std::is_same<And<FalseType, TrueType>::Type, FalseType>::value, "Unit test failed");
static_assert(std::is_same<And<FalseType, FalseType>::Type, FalseType>::value, "Unit test failed");

// Xor between constants
static_assert((XorC<true, true>::Value == false), "Unit test failed");
static_assert((XorC<true, false>::Value == true), "Unit test failed");
static_assert((XorC<false, true>::Value == true), "Unit test failed");
static_assert((XorC<false, false>::Value == false), "Unit test failed");
static_assert(XorC<true, true>::Value == false, "Unit test failed");
static_assert(XorC<true, false>::Value == true, "Unit test failed");
static_assert(XorC<false, true>::Value == true, "Unit test failed");
static_assert(XorC<false, false>::Value == false, "Unit test failed");

// Xor between types
static_assert((std::is_same<Xor<TrueType, TrueType>::Type, FalseType>::value), "Unit test failed");
static_assert((std::is_same<Xor<TrueType, FalseType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Xor<FalseType, TrueType>::Type, TrueType>::value), "Unit test failed");
static_assert((std::is_same<Xor<FalseType, FalseType>::Type, FalseType>::value), "Unit test failed");
static_assert(std::is_same<Xor<TrueType, TrueType>::Type, FalseType>::value, "Unit test failed");
static_assert(std::is_same<Xor<TrueType, FalseType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Xor<FalseType, TrueType>::Type, TrueType>::value, "Unit test failed");
static_assert(std::is_same<Xor<FalseType, FalseType>::Type, FalseType>::value, "Unit test failed");

// Not between constants
static_assert((NotC<true>::Value == false), "Unit test failed");
static_assert((NotC<false>::Value == true), "Unit test failed");
static_assert(NotC<true>::Value == false, "Unit test failed");
static_assert(NotC<false>::Value == true, "Unit test failed");

// Not between types
static_assert((std::is_same<Not<TrueType>::Type, FalseType>::value), "Unit test failed");
static_assert((std::is_same<Not<FalseType>::Type, TrueType>::value), "Unit test failed");
static_assert(std::is_same<Not<TrueType>::Type, FalseType>::value, "Unit test failed");
static_assert(std::is_same<Not<FalseType>::Type, TrueType>::value, "Unit test failed");

return EXIT_SUCCESS;
}
28 changes: 14 additions & 14 deletions Modules/Core/Common/test/itkPromoteType.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ itkPromoteType(int, char *[])
// the following list able to hold their entire value range: int, unsigned
// int, long, unsigned long, long long, unsigned long long.

static_assert((std::is_same<PromoteType<signed char, int>::Type, int>::value), "test failed");
static_assert((std::is_same<PromoteType<signed char, short>::Type, int>::value), "test failed");
static_assert((std::is_same<PromoteType<unsigned char, int>::Type, int>::value), "test failed");
static_assert((std::is_same<PromoteType<unsigned char, unsigned int>::Type, unsigned int>::value), "test failed");
static_assert((std::is_same<PromoteType<int, int>::Type, int>::value), "test failed");
static_assert((std::is_same<PromoteType<short, int>::Type, int>::value), "test failed");
static_assert((std::is_same<PromoteType<double, int>::Type, double>::value), "test failed");
static_assert((std::is_same<PromoteType<float, int>::Type, float>::value), "test failed");
static_assert((std::is_same<PromoteType<long, int>::Type, long>::value), "test failed");
static_assert((std::is_same<PromoteType<long long, int>::Type, long long>::value), "test failed");
static_assert((std::is_same<PromoteType<int, long long>::Type, long long>::value), "test failed");
static_assert((std::is_same<PromoteType<long, long double>::Type, long double>::value), "test failed");
static_assert((std::is_same<PromoteType<double, std::complex<double>>::Type, std::complex<double>>::value),
static_assert(std::is_same<PromoteType<signed char, int>::Type, int>::value, "test failed");
static_assert(std::is_same<PromoteType<signed char, short>::Type, int>::value, "test failed");
static_assert(std::is_same<PromoteType<unsigned char, int>::Type, int>::value, "test failed");
static_assert(std::is_same<PromoteType<unsigned char, unsigned int>::Type, unsigned int>::value, "test failed");
static_assert(std::is_same<PromoteType<int, int>::Type, int>::value, "test failed");
static_assert(std::is_same<PromoteType<short, int>::Type, int>::value, "test failed");
static_assert(std::is_same<PromoteType<double, int>::Type, double>::value, "test failed");
static_assert(std::is_same<PromoteType<float, int>::Type, float>::value, "test failed");
static_assert(std::is_same<PromoteType<long, int>::Type, long>::value, "test failed");
static_assert(std::is_same<PromoteType<long long, int>::Type, long long>::value, "test failed");
static_assert(std::is_same<PromoteType<int, long long>::Type, long long>::value, "test failed");
static_assert(std::is_same<PromoteType<long, long double>::Type, long double>::value, "test failed");
static_assert(std::is_same<PromoteType<double, std::complex<double>>::Type, std::complex<double>>::value,
"test failed");

static_assert((std::is_same<PromoteType<std::complex<int>, std::complex<double>>::Type, std::complex<double>>::value),
static_assert(std::is_same<PromoteType<std::complex<int>, std::complex<double>>::Type, std::complex<double>>::value,
"test failed");
return EXIT_SUCCESS;
}

0 comments on commit e092a3d

Please sign in to comment.