fix: Fix to_uns and associated tests
This commit is contained in:
parent
6782552379
commit
efc028fb0d
20
src/lib.rs
20
src/lib.rs
@ -154,9 +154,9 @@ impl Teeth {
|
||||
pub fn to_uns(&self) -> String {
|
||||
let max = Teeth::quadrant_max(self.permanent);
|
||||
let value: u8 = match (&self.quadrant, self.number) {
|
||||
(QuadrantKind::TopLeft, x) => x,
|
||||
(QuadrantKind::TopLeft, x) => max - x + 1,
|
||||
(QuadrantKind::TopRight, x) => x + max,
|
||||
(QuadrantKind::BottomRight, x) => x + max * 2,
|
||||
(QuadrantKind::BottomRight, x) => (max - x + 1) + max * 2,
|
||||
(QuadrantKind::BottomLeft, x) => x + max * 3,
|
||||
};
|
||||
|
||||
@ -398,20 +398,20 @@ mod test {
|
||||
from_fail!(from_iso_fail_80, from_iso, "80");
|
||||
from_fail!(from_iso_fail_86, from_iso, "86");
|
||||
|
||||
to!(to_uns_1, to_uns, QuadrantKind::TopLeft, 1, true, "1");
|
||||
to!(to_uns_8, to_uns, QuadrantKind::TopLeft, 8, true, "8");
|
||||
to!(to_uns_1, to_uns, QuadrantKind::TopLeft, 1, true, "8");
|
||||
to!(to_uns_8, to_uns, QuadrantKind::TopLeft, 8, true, "1");
|
||||
to!(to_uns_9, to_uns, QuadrantKind::TopRight, 1, true, "9");
|
||||
to!(to_uns_16, to_uns, QuadrantKind::TopRight, 8, true, "16");
|
||||
to!(to_uns_17, to_uns, QuadrantKind::BottomRight, 1, true, "17");
|
||||
to!(to_uns_24, to_uns, QuadrantKind::BottomRight, 8, true, "24");
|
||||
to!(to_uns_17, to_uns, QuadrantKind::BottomRight, 1, true, "24");
|
||||
to!(to_uns_24, to_uns, QuadrantKind::BottomRight, 8, true, "17");
|
||||
to!(to_uns_25, to_uns, QuadrantKind::BottomLeft, 1, true, "25");
|
||||
to!(to_uns_32, to_uns, QuadrantKind::BottomLeft, 8, true, "32");
|
||||
to!(to_uns_a, to_uns, QuadrantKind::TopLeft, 1, false, "A");
|
||||
to!(to_uns_e, to_uns, QuadrantKind::TopLeft, 5, false, "E");
|
||||
to!(to_uns_a, to_uns, QuadrantKind::TopLeft, 1, false, "E");
|
||||
to!(to_uns_e, to_uns, QuadrantKind::TopLeft, 5, false, "A");
|
||||
to!(to_uns_f, to_uns, QuadrantKind::TopRight, 1, false, "F");
|
||||
to!(to_uns_j, to_uns, QuadrantKind::TopRight, 5, false, "J");
|
||||
to!(to_uns_k, to_uns, QuadrantKind::BottomRight, 1, false, "K");
|
||||
to!(to_uns_o, to_uns, QuadrantKind::BottomRight, 5, false, "O");
|
||||
to!(to_uns_k, to_uns, QuadrantKind::BottomRight, 1, false, "O");
|
||||
to!(to_uns_o, to_uns, QuadrantKind::BottomRight, 5, false, "K");
|
||||
to!(to_uns_p, to_uns, QuadrantKind::BottomLeft, 1, false, "P");
|
||||
to!(to_uns_t, to_uns, QuadrantKind::BottomLeft, 5, false, "T");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user