forked from mirror/Riven
1
0
Fork 0

Add EMERALD tier, fix #55 (#56)

fix #55
issue-59
Mingwei Samuel 2023-07-21 08:45:13 -07:00 committed by GitHub
parent 908d0d64ed
commit 7c0fff55ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -90,12 +90,12 @@ mod tests {
assert_eq!(Some((Tier::DIAMOND, Division::II)), it.next()); assert_eq!(Some((Tier::DIAMOND, Division::II)), it.next());
assert_eq!(Some((Tier::DIAMOND, Division::III)), it.next()); assert_eq!(Some((Tier::DIAMOND, Division::III)), it.next());
assert_eq!(Some((Tier::DIAMOND, Division::IV)), it.next()); assert_eq!(Some((Tier::DIAMOND, Division::IV)), it.next());
assert_eq!(Some((Tier::EMERALD, Division::I)), it.next());
assert_eq!(Some((Tier::EMERALD, Division::II)), it.next());
assert_eq!(Some((Tier::EMERALD, Division::III)), it.next());
assert_eq!(Some((Tier::EMERALD, Division::IV)), it.next());
assert_eq!(Some((Tier::PLATINUM, Division::I)), it.next()); assert_eq!(Some((Tier::PLATINUM, Division::I)), it.next());
let mut last = None; let last = it.last();
for next in &mut it {
last = Some(next);
}
assert_eq!(Some((Tier::IRON, Division::IV)), last); assert_eq!(Some((Tier::IRON, Division::IV)), last);
assert_eq!(None, it.next());
} }
} }

View File

@ -38,6 +38,8 @@ pub enum Tier {
MASTER = 180, MASTER = 180,
/// Diamond, the higest non-apex tier. Repr: `140_u8`. /// Diamond, the higest non-apex tier. Repr: `140_u8`.
DIAMOND = 140, DIAMOND = 140,
/// Emerald. Added in 2023. Repr: `130_u8`.
EMERALD = 130,
/// Platinum. Repr: `120_u8`. /// Platinum. Repr: `120_u8`.
PLATINUM = 120, PLATINUM = 120,
/// Gold. Repr: `100_u8`. /// Gold. Repr: `100_u8`.
@ -109,6 +111,7 @@ impl IntoEnumIterator for Tier {
Self::GRANDMASTER, Self::GRANDMASTER,
Self::MASTER, Self::MASTER,
Self::DIAMOND, Self::DIAMOND,
Self::EMERALD,
Self::PLATINUM, Self::PLATINUM,
Self::GOLD, Self::GOLD,
Self::SILVER, Self::SILVER,
@ -188,6 +191,7 @@ mod tests {
iter.next(); iter.next();
iter.next(); iter.next();
assert_eq!(Some(Tier::DIAMOND), iter.next()); assert_eq!(Some(Tier::DIAMOND), iter.next());
assert_eq!(Some(Tier::EMERALD), iter.next());
iter.next(); iter.next();
iter.next(); iter.next();
iter.next(); iter.next();
@ -202,6 +206,7 @@ mod tests {
iter.next(); iter.next();
iter.next(); iter.next();
iter.next(); iter.next();
assert_eq!(Some(Tier::EMERALD), iter.next());
assert_eq!(Some(Tier::DIAMOND), iter.next()); assert_eq!(Some(Tier::DIAMOND), iter.next());
iter.next(); iter.next();
iter.next(); iter.next();