Skip to content

Commit 4b050c1

Browse files
committed
test: basic division
1 parent 6efa98b commit 4b050c1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/beman/bounds_test/bounds_test.tests.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,20 @@ TEMPLATE_TEST_CASE("can_subtract signed", "[bt::can_subtract]", SIGNED_TYPES) {
179179
STATIC_REQUIRE_FALSE(bt::can_subtract(result_t{lmin}, TestType{1}));
180180
}
181181

182+
TEMPLATE_TEST_CASE("can_divide unsigned", "[bt::can_divide]", UNSIGNED_TYPES) {
183+
STATIC_REQUIRE(bt::can_divide(TestType{0}, TestType{1}));
184+
STATIC_REQUIRE(bt::can_divide(TestType{1}, TestType{1}));
185+
STATIC_REQUIRE_FALSE(bt::can_divide(TestType{1}, TestType{0}));
186+
}
187+
188+
TEMPLATE_TEST_CASE("can_divide signed", "[bt::can_divide]", SIGNED_TYPES) {
189+
using result_t = decltype(TestType{} / TestType{});
190+
STATIC_REQUIRE(bt::can_divide(result_t{0}, TestType{1}));
191+
STATIC_REQUIRE(bt::can_divide(result_t{1}, TestType{1}));
192+
STATIC_REQUIRE_FALSE(bt::can_divide(result_t{1}, TestType{0}));
193+
STATIC_REQUIRE_FALSE(bt::can_divide(result_t{nl<result_t>::min()}, TestType{-1}));
194+
}
195+
182196
TEMPLATE_TEST_CASE("can_multiply unsigned", "[bt::can_multiply]", UNSIGNED_TYPES) {
183197
using result_t = decltype(TestType{} * TestType{});
184198
constexpr auto lmax = nl<result_t>::max();

0 commit comments

Comments
 (0)