Skip to content

Commit cb2d7fd

Browse files
committed
feature: adds NadalaNumber model
1 parent 49a0fc0 commit cb2d7fd

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
public struct NadalaNumber: PositionalNumberSystemizable {
2+
public enum Digit: Int {
3+
case
4+
case no ,, nu,
5+
case `do`,, du,
6+
case lo ,, lu,
7+
}
8+
}
9+
10+
extension NadalaNumber.Digit: PositionalDigitSystemizable {
11+
public static var placeholder: Self { .}
12+
13+
public var predecessor: Self {
14+
switch self {
15+
case .: return .lu
16+
case .lu: return .
17+
case .: return .lo
18+
case .lo: return .
19+
case .: return .du
20+
case .du: return .
21+
case .: return .do
22+
case .do: return .
23+
case .: return .nu
24+
case .nu: return .
25+
case .: return .no
26+
case .no: return .placeholder
27+
default : Self.fatalPredecessionError()
28+
}
29+
}
30+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Testing
2+
@testable import NumberSystems
3+
4+
@Test func quantitiesOfNadalaDigits() async throws {
5+
NadalaNumber.Digit.allCases.forEach {
6+
#expect($0.quantityMatchesCardinality)
7+
}
8+
}

0 commit comments

Comments
 (0)