Better naming for variable in tests
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 2m30s
Cargo CI / Lint (pull_request) Successful in 43s

This commit is contained in:
Wojciech Kozlowski 2024-02-02 12:42:11 +01:00
parent 48572fe03b
commit 42c192bd01

View File

@ -425,23 +425,23 @@ mod tests {
assert_eq!(sel.state.selected(), Some(tracks.len() - 1));
// Re-initialise.
let previous = sel.clone();
let expected = sel.clone();
let active_track = ActiveTrack::get(tracks, &sel);
sel.reinitialise(tracks, active_track);
assert_eq!(sel, previous);
assert_eq!(sel, expected);
// Re-initialise out-of-bounds.
let mut previous = sel.clone();
previous.decrement(tracks);
let mut expected = sel.clone();
expected.decrement(tracks);
let active_track = ActiveTrack::get(tracks, &sel);
sel.reinitialise(&tracks[..(tracks.len() - 1)], active_track);
assert_eq!(sel, previous);
assert_eq!(sel, expected);
// Re-initialise empty.
let previous = TrackSelection::initialise(&[]);
let expected = TrackSelection::initialise(&[]);
let active_track = ActiveTrack::get(tracks, &sel);
sel.reinitialise(&[], active_track);
assert_eq!(sel, previous);
assert_eq!(sel, expected);
// Artifical test case to verify upper limit.
sel.state.select(Some(std::usize::MAX));
@ -496,23 +496,23 @@ mod tests {
assert_eq!(sel.track.state.selected(), Some(1));
// Re-initialise.
let previous = sel.clone();
let expected = sel.clone();
let active_album = ActiveAlbum::get(albums, &sel);
sel.reinitialise(albums, active_album);
assert_eq!(sel, previous);
assert_eq!(sel, expected);
// Re-initialise out-of-bounds.
let mut previous = sel.clone();
previous.decrement(albums);
let mut expected = sel.clone();
expected.decrement(albums);
let active_album = ActiveAlbum::get(albums, &sel);
sel.reinitialise(&albums[..(albums.len() - 1)], active_album);
assert_eq!(sel, previous);
assert_eq!(sel, expected);
// Re-initialise empty.
let previous = AlbumSelection::initialise(&[]);
let expected = AlbumSelection::initialise(&[]);
let active_album = ActiveAlbum::get(albums, &sel);
sel.reinitialise(&[], active_album);
assert_eq!(sel, previous);
assert_eq!(sel, expected);
// Artifical test case to verify upper limit.
sel.state.select(Some(std::usize::MAX));
@ -570,23 +570,23 @@ mod tests {
assert_eq!(sel.album.state.selected(), Some(1));
// Re-initialise.
let previous = sel.clone();
let expected = sel.clone();
let active_artist = ActiveArtist::get(artists, &sel);
sel.reinitialise(artists, active_artist);
assert_eq!(sel, previous);
assert_eq!(sel, expected);
// Re-initialise out-of-bounds.
let mut previous = sel.clone();
previous.decrement(artists);
let mut expected = sel.clone();
expected.decrement(artists);
let active_artist = ActiveArtist::get(artists, &sel);
sel.reinitialise(&artists[..(artists.len() - 1)], active_artist);
assert_eq!(sel, previous);
assert_eq!(sel, expected);
// Re-initialise empty.
let previous = ArtistSelection::initialise(&[]);
let expected = ArtistSelection::initialise(&[]);
let active_artist = ActiveArtist::get(artists, &sel);
sel.reinitialise(&[], active_artist);
assert_eq!(sel, previous);
assert_eq!(sel, expected);
// Artifical test case to verify upper limit.
sel.state.select(Some(std::usize::MAX));