Increase arithmetic op test coverage for `div_euclid` and `rem_euclid`
- Linguagem predominante
- Rust
- Estrelas
- 115
- Forks
- 84
- Merge médio
- 1d 8h
- PRs com merge (30d)
- 15
Descrição
These tests should be added to `tests/integration/src/end_to_end/arithmetic.rs`.
Signed Euclidean division rounds the quotient toward −∞ and yields an always-non-negative remainder, unlike the `/` and `%` operators, e.g. `(-7).div_euclid(2) == -4` / `(-7).rem_euclid(2) == 1` vs `-7 / 2 == -3` / `-7 % 2 == -1`. Truncating signed `/`/`%` is already covered (`case_i32_sdiv`); the Euclidean family has no coverage.
### div_euclid
- [ ] `div_euclid` (signed i32/i64, all four sign combinations)
- [ ] `div_euclid` (unsigned u32/u64)
- [ ] `checked_div_euclid`
- [ ] `overflowing_div_euclid`
- [ ] `wrapping_div_euclid`
### rem_euclid
- [ ] `rem_euclid` (signed i32/i64) — result is always in `[0, |d|)`
- [ ] `rem_euclid` (unsigned u32/u64)
- [ ] `checked_rem_euclid`
- [ ] `overflowing_rem_euclid`
- [ ] `wrapping_rem_euclid`
Note the trap surface: `div_euclid`/`rem_euclid` panic on divisor 0 and on the `MIN / -1` overflow (`i32::MIN.div_euclid(-1)`). Keep the plain arms panic-free by range-limiting divisors and excluding MIN/-1 (as `case_i32_sdiv` does), and exercise those edges through the `checked_*`/`overflowing_*` arms (`None` / `(MIN, true)`).
I'd like to be assigned to this.
Guia de contribuição
Direção de pesquisa
The tests go in tests/integration/src/end_to_end/arithmetic.rs. Start by reading the existing case_i32_sdiv test to understand the pattern. For each function listed (div_euclid, rem_euclid, and their checked/overflowing/wrapping variants), write test cases for signed i32/i64 and unsigned u32/u64, ensuring to avoid panic cases like division by zero and MIN/-1 overflow in the plain arms, and test those edges in the checked/overflowing arms. Run the test suite to verify coverage.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Domínio
- testing
- Tipo de issue
- Documentação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Ativa
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 75/100