div_test: Don't try to divide by zero

This commit is contained in:
Vladimir Serbinenko 2015-02-21 16:05:45 +01:00
parent d93147abb7
commit 2426ac36d3

View file

@ -34,6 +34,8 @@ static void
test32 (grub_uint32_t a, grub_uint32_t b) test32 (grub_uint32_t a, grub_uint32_t b)
{ {
grub_uint64_t q, r; grub_uint64_t q, r;
if (b == 0)
return;
q = grub_divmod64 (a, b, &r); q = grub_divmod64 (a, b, &r);
grub_test_assert (r < b, "remainder is larger than dividend: 0x%llx %% 0x%llx = 0x%llx", grub_test_assert (r < b, "remainder is larger than dividend: 0x%llx %% 0x%llx = 0x%llx",
(long long) a, (long long) b, (long long) r); (long long) a, (long long) b, (long long) r);