krz/moonrise

Night-sky companion for iPhone, Apple Watch and Vision Pro: what's up tonight, the Moon, planets, launches and missions, and a Library of the solar system. SwiftUI app with a Cloudflare Workers backend. astronomy cloudflare-workers ios night-sky space swiftui visionos watchos

Commit aeab22a293

aeab22a293d720abc53fb2f1ee9d648ffdb77a7e

parent: 4234268fe5

Unsigned

cmc <hello@cleberg.net> · 2026-10-21 06:08 UTC

Observing log: shared store read off main, keys indexed once, hand-written designation parser (!76)

Every log screen re-read and parsed all Org files on the main thread when it appeared: `ObservingLog.all()` from `LogScreen.onAppear`, `ProgramsScreen.onAppear` (also on every return from a program) and `ProgramDetail.reload`, and `EquipmentDetail.reload`. `ProgramsScreen.body` built a `CatalogResolver` and a `ProgramProgress` per program on every evaluation, and `CatalogResolver.designation` ran a Swift `Regex` (~28 µs, 80 allocations a call). Saving from the editor also read every file on main (`ObservingLog.delete(id:)`).

## Changes

- `ObservingLogStore` (`LogScreen.swift`, one shared instance): entries, programs, resolver and per-program `ProgramProgress`. A read (`programs()`, `all()`, index, progress) runs in a detached task. A generation counter drops reads started before a later reload or delete, and published values are only replaced when entries or programs changed.
  - `LogScreen`, `ProgramsScreen`, `ProgramDetail` and `EquipmentDetail` read the store and call `reload()` on appear, so files changed in the Files app are still picked up, without blocking.
  - Save: `ObservationEditor` awaits `store.save` (write in a detached task, names resolved against freshly read programs as before), then dismisses. Errors show in the editor as before. The `onSave` parameter is gone; the store reloads itself.
  - Delete: the row leaves `entries` at once, then the files are deleted off main and the log is read again.
  - The Programs folder is still created when Programs appears, from a detached task.
  - `ObservableObject`, not `@Observable`: the macro expands to `Observation.…`, which resolves to `ObservingLog.Observation` in files that import `ObservingLog`.
- `LogIndex` (MoonriseKit): earliest entry per catalogue key, built once per read and shared by all programs. `ProgramProgress(program:index:)` uses it; `ProgramProgress(program:log:resolver:)` builds one.
- `CatalogResolver.designation`: scans `Character`s (ASCII letters, spaces, `Character.isNumber`, leading "0"s dropped) instead of the regex. Results are identical: new test `designationMatchesRegex` compares it with the regex over Library page titles and subtitles, Messier names and aliases, odd inputs ("M 31", "Messier 31", "m031", "NGC 6205", "NGC6205A", NBSP, thin, ideographic and zero-width spaces, BOM, Arabic, Devanagari, fullwidth and mathematical digits, "²", "½", combining marks) and every scalar U+0000–U+2FFF in four positions. A one-off run outside the test over all 1,112,064 scalars in six positions found no differences.
- `ObservingProgram` and `ObservingProgram.Object` are `Equatable` (change detection in the store).
- `ProgramDetail`'s "up tonight" list drops logged objects when it is drawn instead of in `reload()`.

## Measurements

Same method before and after. Load (`uptime`, 12 cores) is given per run; other work was running on the host.

**Package benchmark** (M2 Pro, `-c release`, 300 entries from the perf generator, Messier + two 50-object programs, medians, before and after back to back, load 4.86 → 4.71):

| Case | main | branch |
|---|---:|---:|
| `designation` × 300 | 8.26 ms, 24,550 allocs | 0.13 ms, 1 alloc |
| `keys(for:)` × 300 entries | 6.85 ms | 0.48 ms |
| `ProgramProgress`, Messier, 300 entries | 7.12 ms | 0.59 ms |
| Old Programs body: resolver + 3 × `ProgramProgress` | 21.75 ms | 1.88 ms (no longer in body) |
| `LogIndex` + 3 × `ProgramProgress` (once per read, off main) | — | 0.60 ms |
| `ObservingLog.programs()`, Messier + 2 files | 3.49 ms | 0.51 ms |
| `ObservingLog.all()`, 300 files | 20.96 ms | 20.76 ms (off main now) |
| Whole read: programs + all + progress | 50.71 ms | 21.45 ms (off main now) |

Programs `body` now does one dictionary lookup per program.

**iPhone 18 Pro simulator** (iOS 27, Release build with a temporary frame probe, not committed). A UI test seeds 300 entries, then twice: open the log, Programs, Messier, back, Messier, back, back, open an entry, Save, Done. Two unprofiled runs each, one run each under Time Profiler (1 ms).

Main-thread time in log code, whole tour (Time Profiler):

| | main | branch |
|---|---:|---:|
| `ObservingLog.all` | 375 ms | 0 (381 ms on other threads) |
| `ObservingLog.save` / `delete` | 63 ms | 0 (57 ms on other threads) |
| `ProgramsScreen` body | 227 ms | 0 samples |
| `ProgramDetail` | 135 ms | 4 ms |
| `LogScreen` | 127 ms | 5 ms |
| `CatalogResolver.designation` | 90 ms | 0 |

Main-thread CPU per step, test-driver accessibility code removed (profiled runs, round 1 / round 2):

| Step | main | branch |
|---|---:|---:|
| Log open | 824 / 478 ms | 511 / 332 ms |
| Programs open | 267 / 272 | 194 / 175 |
| Messier open | 280 / 176 | 189 / 130 |
| Messier back | 143 / 154 | 103 / 93 |
| Messier re-open | 187 / 182 | 140 / 146 |
| Messier back (2nd) | 139 / 133 | 76 / 97 |
| Programs back | 196 / 233 | 161 / 172 |
| Entry save | 216 / 221 | 111 / 81 |

Longest frame per step, unprofiled, 2 runs × 2 rounds (ms):

| Step | main | branch |
|---|---:|---:|
| Log open, first / second | 723–762 / 196 | 644–675 / 139–140 |
| Programs open | 118–227 | 125–204 |
| Messier open | 122–160 | 78–110 |
| Messier back | 77–178 | 44–51 |
| Messier re-open | 113–178 | 70–87 |
| Messier back (2nd) | 73–80 | 46–48, one 135 |
| Programs back | 56–99 | 53–72 |
| Entry save | 100–106 | 78–107 |
| Log close | 57–70 | 60–78 |

Frames over 50 ms remain when opening and closing. In the profiled branch run the app's own code in those frames is under 5 ms; the rest is SwiftUI/UIKit (first use of each view type, sheet and push transitions) and the UI test's accessibility snapshots. The 135 ms frame was in the second branch run while load rose to 7.7; it was not profiled.

Load: main 6.86 → 16.07 and 4.40 → 5.63, profiled 7.63 → 5.08; branch 5.54 → 5.46 and 4.67 → 7.73, profiled 9.19 → 4.29.

Checked by hand in the simulator: an Org file added to Observations shows on open; a second file added while the log was open showed after visiting Programs and coming back, and counted in Messier progress; swipe delete removed the row and the file.

## Tests

- `swift test` (MoonriseKit): 193 pass.
- `npm test` (server): 55 pass.
- `xcodebuild test` (iPhone 18 Pro): pass. The accessibility audit found 64 issues: Sky 4, Settings 2, System 7, Sun 3, News & launches 21, Library 14, Library page: Saturn 13. It does not visit the log screens.

## Not verified

- On a device.
- `EquipmentDetail` usage with real equipment (none was set up in the runs).
- Programs from files in the Programs folder in the app (covered only by the package benchmark).
- The accessibility audit was not run on main in this session.

Layout: unified · split

App/Sources/EquipmentScreen.swift +6 −2
@@ -90,10 +90,14 @@ struct EquipmentScreen: View {
9090struct EquipmentDetail: View {
9191 @State var item: Equipment
9292 var onChange: () -> Void
93 @State private var usage: EquipmentUsage?
93 @ObservedObject private var store = observingLogStore
9494 @State private var names: [String: String] = [:]
9595 @State private var editing: Equipment?
9696
97 private var usage: EquipmentUsage? {
98 store.loaded ? EquipmentUsage(of: item.id, in: store.entries, resolver: store.resolver) : nil
99 }
100
97101 var body: some View {
98102 List {
99103 Section {
@@ -150,7 +154,7 @@ struct EquipmentDetail: View {
150154
151155 private func reload() {
152156 names = Dictionary(equipmentInventory.all().map { ($0.id, $0.name) }, uniquingKeysWith: { a, _ in a })
153 usage = EquipmentUsage(of: item.id, in: observingLog.all(), resolver: CatalogResolver(programs: observingLog.programs()))
157 store.reload()
154158 }
155159}
156160
App/Sources/LogScreen.swift +86 −17
@@ -4,17 +4,91 @@ import SwiftUI
44/// The observing log lives in Documents/Observations, one Org file per entry, visible in the Files app.
55let observingLog = ObservingLog(folder: URL.documentsDirectory.appending(path: "Observations"))
66
7@MainActor let observingLogStore = ObservingLogStore(log: observingLog)
8
9/// The parsed log and programs, shared by the log screens. Files are read off the main thread. Screens call
10/// `reload` when they appear, so files changed in the Files app are picked up.
11@MainActor final class ObservingLogStore: ObservableObject {
12 struct Snapshot: Sendable {
13 var entries: [Observation]
14 var programs: [ObservingProgram]
15 var resolver: CatalogResolver
16 var progress: [String: ProgramProgress]
17 }
18
19 /// Newest first.
20 @Published private(set) var entries: [Observation] = []
21 /// Messier, then the files in the Programs folder.
22 @Published private(set) var programs: [ObservingProgram] = []
23 @Published private(set) var resolver = CatalogResolver()
24 /// By program ID.
25 @Published private(set) var progress: [String: ProgramProgress] = [:]
26 /// False until the first read finishes.
27 @Published private(set) var loaded = false
28 private let log: ObservingLog
29 /// Results of reads started before the latest reload or delete are dropped.
30 private var generation = 0
31 /// The read the published values were last set from.
32 private var shown: Snapshot?
33
34 init(log: ObservingLog) { self.log = log }
35
36 func reload() {
37 generation += 1
38 let g = generation, log = log
39 Task {
40 let s = await Task.detached(priority: .userInitiated) { ObservingLogStore.read(log) }.value
41 guard g == generation, s.entries != shown?.entries || s.programs != shown?.programs else { return }
42 shown = s
43 entries = s.entries
44 programs = s.programs
45 resolver = s.resolver
46 progress = s.progress
47 loaded = true
48 }
49 }
50
51 /// Writes as `ObservingLog.save`, with names resolved against the current programs, then reloads.
52 func save(_ o: Observation) async throws {
53 let log = log
54 try await Task.detached(priority: .userInitiated) { try log.save(o, resolver: CatalogResolver(programs: log.programs())) }.value
55 reload()
56 }
57
58 /// Removes the entries from `entries` at once, then deletes their files and reloads.
59 func delete(ids: [String]) {
60 entries.removeAll { ids.contains($0.id) }
61 generation += 1
62 let log = log
63 Task {
64 await Task.detached(priority: .userInitiated) { for id in ids { try? log.delete(id: id) } }.value
65 reload()
66 }
67 }
68
69 nonisolated private static func read(_ log: ObservingLog) -> Snapshot {
70 let programs = log.programs()
71 let resolver = CatalogResolver(programs: programs)
72 let entries = log.all()
73 let index = LogIndex(log: entries, resolver: resolver)
74 let progress = Dictionary(programs.map { ($0.id, ProgramProgress(program: $0, index: index)) }, uniquingKeysWith: { a, _ in a })
75 return Snapshot(entries: entries, programs: programs, resolver: resolver, progress: progress)
76 }
77}
78
779struct LogScreen: View {
8 @State private var entries: [Observation] = []
80 @ObservedObject private var store = observingLogStore
981 @State private var editing: Observation?
1082 var newEntry: () -> Observation
1183 @Environment(\.dismiss) private var dismiss
1284
85 private var entries: [Observation] { store.entries }
86
1387 var body: some View {
1488 NavigationStack {
1589 List {
1690 NavigationLink("Programs") { ProgramsScreen(newEntry: newEntry) }
17 if entries.isEmpty {
91 if store.loaded, entries.isEmpty {
1892 Text("No observations yet. Add one here, or use Log on an object's card in the Sky tab.")
1993 .font(.footnote).foregroundStyle(.secondary)
2094 }
@@ -28,10 +102,7 @@ struct LogScreen: View {
28102 }
29103 .buttonStyle(.plain)
30104 }
31 .onDelete { idx in
32 for i in idx { try? observingLog.delete(id: entries[i].id) }
33 reload()
34 }
105 .onDelete { idx in store.delete(ids: idx.map { entries[$0].id }) }
35106 }
36107 .navigationTitle("Observing log")
37108 .navigationBarTitleDisplayMode(.inline)
@@ -51,18 +122,15 @@ struct LogScreen: View {
51122 .font(.caption2).foregroundStyle(.secondary).padding(8)
52123 }
53124 .sheet(item: $editing) { o in
54 ObservationEditor(observation: o) { reload() }
125 ObservationEditor(observation: o)
55126 }
56127 }
57 .onAppear(perform: reload)
128 .onAppear { store.reload() }
58129 }
59
60 private func reload() { entries = observingLog.all() }
61130}
62131
63132struct ObservationEditor: View {
64133 @State var observation: Observation
65 var onSave: () -> Void
66134 @Environment(\.dismiss) private var dismiss
67135 @State private var error: String?
68136 @State private var names: [String: String] = [:]
@@ -102,12 +170,13 @@ struct ObservationEditor: View {
102170 ToolbarItem(placement: .cancellationAction) { Button("Cancel") { dismiss() } }
103171 ToolbarItem(placement: .confirmationAction) {
104172 Button("Save") {
105 do {
106 try observingLog.save(observation, resolver: CatalogResolver(programs: observingLog.programs()))
107 onSave()
108 dismiss()
109 } catch {
110 self.error = "Couldn't save: \(error.localizedDescription)"
173 Task {
174 do {
175 try await observingLogStore.save(observation)
176 dismiss()
177 } catch {
178 self.error = "Couldn't save: \(error.localizedDescription)"
179 }
111180 }
112181 }
113182 .disabled(observation.object.trimmingCharacters(in: .whitespaces).isEmpty)
App/Sources/ProgramsScreen.swift +14 −19
@@ -5,15 +5,13 @@ import SwiftUI
55/// Observing programs: the bundled Messier list plus Org files in Documents/Observations/Programs.
66struct ProgramsScreen: View {
77 var newEntry: () -> Observation
8 @State private var programs: [ObservingProgram] = []
9 @State private var log: [Observation] = []
8 @ObservedObject private var store = observingLogStore
109
1110 var body: some View {
12 let resolver = CatalogResolver(programs: programs)
1311 List {
1412 Section {
15 ForEach(programs) { p in
16 let n = ProgramProgress(program: p, log: log, resolver: resolver).count
13 ForEach(store.programs) { p in
14 let n = store.progress[p.id]?.count ?? 0
1715 NavigationLink { ProgramDetail(program: p, newEntry: newEntry) } label: {
1816 VStack(alignment: .leading, spacing: 6) {
1917 HStack {
@@ -34,9 +32,9 @@ struct ProgramsScreen: View {
3432 .navigationTitle("Programs")
3533 .navigationBarTitleDisplayMode(.inline)
3634 .onAppear {
37 try? FileManager.default.createDirectory(at: observingLog.programsFolder, withIntermediateDirectories: true)
38 programs = observingLog.programs()
39 log = observingLog.all()
35 let folder = observingLog.programsFolder
36 Task.detached { try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) }
37 store.reload()
4038 }
4139 }
4240}
@@ -50,18 +48,21 @@ struct ProgramDetail: View {
5048
5149 var program: ObservingProgram
5250 var newEntry: () -> Observation
53 @State private var progress: ProgramProgress?
51 @ObservedObject private var store = observingLogStore
5452 @State private var upTonight: [Candidate]?
5553 @State private var editing: Observation?
5654
55 private var progress: ProgramProgress? { store.progress[program.id] }
56
5757 var body: some View {
5858 List {
5959 Section {
6060 if let upTonight {
61 if upTonight.isEmpty {
61 let pending = upTonight.filter { progress?.first[$0.object.id] == nil }
62 if pending.isEmpty {
6263 Text("None of the objects still to log gets 25° up in full darkness tonight.").font(.footnote).foregroundStyle(.secondary)
6364 }
64 ForEach(Array(upTonight.enumerated()), id: \.offset) { _, c in
65 ForEach(Array(pending.enumerated()), id: \.offset) { _, c in
6566 row(c.object, trailing: "\(c.best.formatted(date: .omitted, time: .shortened)) · \(Int(c.position.altitude.rounded()))° \(SkyEngine.compass(c.position.azimuth))")
6667 }
6768 } else {
@@ -81,9 +82,9 @@ struct ProgramDetail: View {
8182 .navigationTitle(program.title)
8283 .navigationBarTitleDisplayMode(.inline)
8384 .sheet(item: $editing) { o in
84 ObservationEditor(observation: o) { reload() }
85 ObservationEditor(observation: o)
8586 }
86 .onAppear(perform: reload)
87 .onAppear { store.reload() }
8788 .task { await findUpTonight() }
8889 }
8990
@@ -114,12 +115,6 @@ struct ProgramDetail: View {
114115 .accessibilityHint(logged == nil ? "Logs this object" : "Opens the entry")
115116 }
116117
117 private func reload() {
118 let programs = observingLog.programs()
119 progress = ProgramProgress(program: program, log: observingLog.all(), resolver: CatalogResolver(programs: programs))
120 if let upTonight, let progress { self.upTonight = upTonight.filter { progress.first[$0.object.id] == nil } }
121 }
122
123118 private func findUpTonight() async {
124119 let here = newEntry()
125120 guard let lat = here.latitude, let lon = here.longitude else { upTonight = []; return }
App/Sources/SkyScreen.swift +1 −1
@@ -91,7 +91,7 @@ struct SkyScreen: View {
9191 LogScreen { newObservation("") }.preferredColorScheme(.dark).tint(.blue)
9292 }
9393 .sheet(item: $logEntry) { o in
94 ObservationEditor(observation: o) {}.preferredColorScheme(.dark).tint(.blue)
94 ObservationEditor(observation: o).preferredColorScheme(.dark).tint(.blue)
9595 }
9696 .sheet(isPresented: $showEvents) {
9797 EventsScreen(observer: model.observer, placeName: model.placeName, forecast: model.forecast)
Packages/MoonriseKit/Sources/ObservingLog/Programs.swift +31 −10
@@ -27,10 +27,18 @@ public struct CatalogResolver: Sendable {
2727 public static let messier = CatalogResolver(programs: [.messier])
2828
2929 /// "M 31", "Messier 31" and "m031" give "M31"; "NGC 6205" gives "NGC6205". Nil when `s` is not letters then a number.
30 /// Letters are ASCII, then optional spaces, then one or more `Character.isNumber` characters.
3031 public static func designation(_ s: String) -> String? {
31 guard let m = s.trimmingCharacters(in: .whitespaces).wholeMatch(of: /([A-Za-z]+) *0*(\d+)/) else { return nil }
32 let prefix = m.1.uppercased()
33 return (prefix == "MESSIER" ? "M" : prefix) + m.2
32 let t = s.trimmingCharacters(in: .whitespaces)
33 var i = t.startIndex
34 while i < t.endIndex, t[i].isASCII, t[i].isLetter { t.formIndex(after: &i) }
35 guard i > t.startIndex else { return nil }
36 let prefix = t[..<i].uppercased()
37 while i < t.endIndex, t[i] == " " { t.formIndex(after: &i) }
38 var number = t[i...]
39 guard !number.isEmpty, number.allSatisfy(\.isNumber) else { return nil }
40 while number.count > 1, number.first == "0" { number = number.dropFirst() }
41 return (prefix == "MESSIER" ? "M" : prefix) + number
3442 }
3543
3644 /// Case, diacritics, curly apostrophes and runs of spaces ignored.
@@ -69,8 +77,8 @@ public struct CatalogResolver: Sendable {
6977/// `CatalogResolver`, else the object is matched by name. `:RA:` and `:DEC:` are J2000 degrees; Messier
7078/// objects without them take the bundled position. Other lines and lower-level headings are ignored.
7179/// Without `#+TITLE:` the file name is the title.
72public struct ObservingProgram: Sendable, Identifiable {
73 public struct Object: Sendable, Identifiable {
80public struct ObservingProgram: Sendable, Identifiable, Equatable {
81 public struct Object: Sendable, Identifiable, Equatable {
7482 /// Catalogue IDs; the first is `id`. Empty when the object is matched by name.
7583 public var ids: [String]
7684 public var name: String
@@ -148,6 +156,19 @@ public struct ObservingProgram: Sendable, Identifiable {
148156 }
149157}
150158
159/// Earliest entry for each catalogue key in a log. Build it once per log and share it between programs.
160public struct LogIndex: Sendable {
161 public var earliest: [String: Observation]
162
163 public init(log: [Observation], resolver: CatalogResolver) {
164 var earliest: [String: Observation] = [:]
165 for o in log {
166 for k in resolver.keys(for: o) where o.date < earliest[k]?.date ?? .distantFuture { earliest[k] = o }
167 }
168 self.earliest = earliest
169 }
170}
171
151172/// Which objects of a program the log has, derived each time and never stored.
152173public struct ProgramProgress: Sendable {
153174 /// Earliest entry for each logged object, by object ID.
@@ -156,13 +177,13 @@ public struct ProgramProgress: Sendable {
156177 public var count: Int { first.count }
157178
158179 public init(program: ObservingProgram, log: [Observation], resolver: CatalogResolver) {
159 var byKey: [String: Observation] = [:]
160 for o in log {
161 for k in resolver.keys(for: o) where o.date < byKey[k]?.date ?? .distantFuture { byKey[k] = o }
162 }
180 self.init(program: program, index: LogIndex(log: log, resolver: resolver))
181 }
182
183 public init(program: ObservingProgram, index: LogIndex) {
163184 var first: [String: Observation] = [:]
164185 for object in program.objects {
165 if let o = object.keys.compactMap({ byKey[$0] }).min(by: { $0.date < $1.date }) { first[object.id] = o }
186 if let o = object.keys.compactMap({ index.earliest[$0] }).min(by: { $0.date < $1.date }) { first[object.id] = o }
166187 }
167188 self.first = first
168189 }
Packages/MoonriseKit/Tests/ObservingLogTests/ProgramsTests.swift +27
@@ -1,4 +1,5 @@
11import Foundation
2import Library
23import Testing
34@testable import ObservingLog
45
@@ -13,6 +14,32 @@ import Testing
1314 #expect(CatalogResolver.designation("M31 and M32") == nil)
1415}
1516
17/// The regex `designation` used to be, as the reference for the hand-written parser.
18private func regexDesignation(_ s: String) -> String? {
19 guard let m = s.trimmingCharacters(in: .whitespaces).wholeMatch(of: /([A-Za-z]+) *0*(\d+)/) else { return nil }
20 let prefix = m.1.uppercased()
21 return (prefix == "MESSIER" ? "M" : prefix) + m.2
22}
23
24@Test func designationMatchesRegex() {
25 var inputs = Library.pages.flatMap { [$0.title, $0.subtitle] + $0.subtitle.components(separatedBy: " · ") }
26 inputs += ObservingProgram.messier.objects.flatMap { [$0.name] + $0.aliases }
27 inputs += ["M 31", "Messier 31", "m031", "NGC 6205", "NGC6205A", "M", "31", "", " ", "M000", "M00 7", "M 0", "messier 0031",
28 "MESSIER31", "M 31", "M\t31", "\tM31\n", "M\r\n31", "M31 ", " M31", "M-31", "M.31", "M31.5", "M31a", "Sh2-155",
29 "M\u{00A0}31", "\u{00A0}M31\u{2009}", "M\u{2009}31", "M\u{3000}31", "\u{3000}M31\u{3000}", "M\u{200B}31", "\u{200B}M31",
30 "M\u{FEFF}31", "\u{FEFF}M31", "M\u{202F}31",
31 "M٣١", "M३१", "M31", "M𝟑𝟏", "M0٣", "M²", "M①", "M½", "MⅫ", "M三", "M31", "ß31", "Dž1", "ff1",
32 "M3\u{0301}", "M0\u{0301}31", "M31\u{0301}", "M \u{0301}31", "M\u{0301}31", "e\u{0301}31", "A\u{0308}1", "M 3\u{20E3}"]
33 for v in 0..<0x3000 {
34 guard let u = Unicode.Scalar(v) else { continue }
35 let c = String(Character(u))
36 inputs += ["M" + c + "1", "M0" + c, c + "31", "M " + c]
37 }
38 for s in inputs {
39 #expect(CatalogResolver.designation(s) == regexDesignation(s), "\(s.unicodeScalars.map { String($0.value, radix: 16) })")
40 }
41}
42
1643@Test func messierNamesResolve() {
1744 let r = CatalogResolver.messier
1845 for name in ["M31", "M 31", "Messier 31", "Andromeda Galaxy", "andromeda galaxy"] {