Skip to content

Commit 93176f5

Browse files
committed
rename next_multiple_back_of as prev_multiple_of and test more
1 parent 426f1d0 commit 93176f5

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

src/lib.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,14 @@ pub trait Integer: Sized + Num + PartialOrd + Ord + Eq {
199199
///
200200
/// ~~~
201201
/// # use num_integer::Integer;
202-
/// assert_eq!(16.next_multiple_of(& 8), 16);
203-
/// assert_eq!(23.next_multiple_of(& 8), 24);
204-
/// assert_eq!(16.next_multiple_of(&-8), 16);
205-
/// assert_eq!(23.next_multiple_of(&-8), 16);
202+
/// assert_eq!(( 16).next_multiple_of(& 8), 16);
203+
/// assert_eq!(( 23).next_multiple_of(& 8), 24);
204+
/// assert_eq!(( 16).next_multiple_of(&-8), 16);
205+
/// assert_eq!(( 23).next_multiple_of(&-8), 16);
206+
/// assert_eq!((-16).next_multiple_of(& 8), -16);
207+
/// assert_eq!((-23).next_multiple_of(& 8), -16);
208+
/// assert_eq!((-16).next_multiple_of(&-8), -16);
209+
/// assert_eq!((-23).next_multiple_of(&-8), -24);
206210
/// ~~~
207211
#[inline]
208212
fn next_multiple_of(&self, other: &Self) -> Self where Self: Clone {
@@ -216,13 +220,17 @@ pub trait Integer: Sized + Num + PartialOrd + Ord + Eq {
216220
///
217221
/// ~~~
218222
/// # use num_integer::Integer;
219-
/// assert_eq!(16.next_multiple_back_of(& 8), 16);
220-
/// assert_eq!(23.next_multiple_back_of(& 8), 16);
221-
/// assert_eq!(16.next_multiple_back_of(&-8), 16);
222-
/// assert_eq!(23.next_multiple_back_of(&-8), 24);
223+
/// assert_eq!(( 16).prev_multiple_of(& 8), 16);
224+
/// assert_eq!(( 23).prev_multiple_of(& 8), 16);
225+
/// assert_eq!(( 16).prev_multiple_of(&-8), 16);
226+
/// assert_eq!(( 23).prev_multiple_of(&-8), 24);
227+
/// assert_eq!((-16).prev_multiple_of(& 8), -16);
228+
/// assert_eq!((-23).prev_multiple_of(& 8), -24);
229+
/// assert_eq!((-16).prev_multiple_of(&-8), -16);
230+
/// assert_eq!((-23).prev_multiple_of(&-8), -16);
223231
/// ~~~
224232
#[inline]
225-
fn next_multiple_back_of(&self, other: &Self) -> Self where Self: Clone {
233+
fn prev_multiple_of(&self, other: &Self) -> Self where Self: Clone {
226234
self.clone() - self.mod_floor(other)
227235
}
228236
}

0 commit comments

Comments
 (0)