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

Packages/MoonriseKit/Tests/SkyEngineTests/LaunchPassTests.swift

59d401dca1a327705632d1e2e20f00f807dee828
moonrise/Packages/MoonriseKit/Tests/SkyEngineTests/LaunchPassTests.swift history · blame · raw

26 lines · 1237 bytes

2 symbols in this file
 1import Foundation
 2import Testing
 3@testable import SkyEngine
 4
 5// CelesTrak GP for the ISS, 2026-10-18.
 6private let iss = OrbitalElements(name: "ISS (ZARYA)", norad: 25544, epoch: "2026-10-18T03:28:15.076416",
 7                                  meanMotion: 15.48918166, eccentricity: 0.000678, inclination: 51.6328,
 8                                  raan: 51.6259, argPerigee: 277.7856, meanAnomaly: 82.2363, bstar: 0.00014456)
 9
10@Test func visiblePassesStartAtEachEpoch() throws {
11    let epoch = try #require(iss.epochDate)
12    let passes = SkyEngine.visiblePasses(of: [iss], from: epoch.addingTimeInterval(-86_400), observer: chicago)
13    #expect(!passes.isEmpty)
14    #expect(passes.allSatisfy { $0.visible && $0.rise >= epoch && $0.rise <= epoch.addingTimeInterval(72 * 3600) })
15}
16
17@Test func visiblePassesMergeSetsInTimeOrder() throws {
18    var other = iss
19    other.OBJECT_NAME = "FALCON 9 R/B"
20    other.MEAN_ANOMALY += 40
21    let start = try #require(iss.epochDate)
22    let one = SkyEngine.visiblePasses(of: [iss], from: start, observer: chicago)
23    let both = SkyEngine.visiblePasses(of: [iss, other], from: start, observer: chicago)
24    #expect(both.count > one.count)
25    #expect(both.map(\.rise) == both.map(\.rise).sorted())
26}