From efc028fb0d92b257e22a8ff32be0e7a5064b16ba Mon Sep 17 00:00:00 2001 From: Guilhem Date: Tue, 19 Jul 2022 19:10:40 +0200 Subject: [PATCH] fix: Fix to_uns and associated tests --- src/lib.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5aa77ed..64587eb 100644 --- a/src/lib.rs +++ b/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");