[llvm] [mlir] mlir/MathExtras: consolidate with llvm/MathExtras (PR #95087)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 11 03:43:34 PDT 2024
================
@@ -434,8 +434,25 @@ TEST(MathExtras, IsShiftedInt) {
EXPECT_FALSE((isShiftedInt<6, 10>(int64_t(1) << 15)));
}
-template <typename T>
-class OverflowTest : public ::testing::Test { };
+TEST(MathExtras, DivideCeilSigned) {
+ EXPECT_EQ(divideCeilSigned(14, 3), 5);
+ EXPECT_EQ(divideCeilSigned(14, -3), -4);
+ EXPECT_EQ(divideCeilSigned(-14, -3), 5);
+ EXPECT_EQ(divideCeilSigned(-14, 3), -4);
+ EXPECT_EQ(divideCeilSigned(0, 3), 0);
+ EXPECT_EQ(divideCeilSigned(0, -3), 0);
+}
+
+TEST(MathExtras, DivideFloorSigned) {
+ EXPECT_EQ(divideFloorSigned(14, 3), 4);
+ EXPECT_EQ(divideFloorSigned(14, -3), -5);
+ EXPECT_EQ(divideFloorSigned(-14, -3), 4);
+ EXPECT_EQ(divideFloorSigned(-14, 3), -5);
+ EXPECT_EQ(divideFloorSigned(0, 3), 0);
+ EXPECT_EQ(divideFloorSigned(0, -3), 0);
+}
----------------
nikic wrote:
Missing tests for mod()?
https://github.com/llvm/llvm-project/pull/95087
More information about the llvm-commits
mailing list