0.108.3: Black Mirror on Paradox after 21:00; After Dark anthology strand; linked episodes; Tales from the Crypt off Orbit 2 (built, not installed)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
Claude
co-authored by
Claude Opus 5.5
parent
80d315481b
commit
a57d0dfbe1
@@ -0,0 +1,72 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import java.time.Instant
|
||||
import java.time.ZoneId
|
||||
import java.time.ZonedDateTime
|
||||
|
||||
/** Anthologies (approved by Paul on 4 November 2026): standalone stories shuffle, linked episodes stay together and in order. */
|
||||
class AnthologyTest {
|
||||
private val london = ZoneId.of("Europe/London")
|
||||
private val minute = 60_000L
|
||||
private fun at(d: Int, h: Int) = ZonedDateTime.of(2026, 11, d, h, 0, 0, 0, london).toInstant().toEpochMilli()
|
||||
private fun show(id: String, title: String, marks: List<Pair<Int, Int>>, minutes: Long) =
|
||||
PoolSeries(id, title, marks.map { (s, e) -> PoolEpisode("$id-$s-$e", "src", EpisodeMark(s, e), "E$s.$e", minutes * minute) })
|
||||
private fun film(n: Int) = "f$n".let { id -> PoolSeries(id, "Film $n", listOf(PoolEpisode(id, "s$id", EpisodeMark(1, 1), "Film $n", (90L + n % 30) * minute))) }
|
||||
|
||||
private val mirror = show("bm", "Black Mirror", (1..7).flatMap { s -> (1..6).map { s to it } }, 60)
|
||||
private val robots = show("ldr", "Love, Death & Robots", (1..4).flatMap { s -> (1..9).map { s to it } }, 14)
|
||||
private val crypt = show("tftc", "Tales from the Crypt", (1..7).flatMap { s -> (1..13).map { s to it } }, 26)
|
||||
|
||||
@Test fun linkedEpisodesAreAStoryInOrder() {
|
||||
val callister = storiesOf(mirror).of(mirror.episodes.first { it.mark == EpisodeMark(4, 1) })!!
|
||||
assertEquals(listOf(EpisodeMark(4, 1), EpisodeMark(7, 6)), callister.parts.map { it.mark })
|
||||
val deck = shuffledStories(mirror, storiesOf(mirror))
|
||||
val i = deck.indexOfFirst { it.mark == EpisodeMark(4, 1) }
|
||||
assertEquals(EpisodeMark(7, 6), deck[i + 1].mark)
|
||||
assertEquals(mirror.episodes.size, deck.size)
|
||||
// Anything else has no links.
|
||||
assertTrue(storiesOf(crypt).stories.isEmpty())
|
||||
}
|
||||
|
||||
@Test fun afterDarksStrandPlaysItsMixedRunAfterTheFilm() {
|
||||
val pool = (1..40).map(::film) + crypt + robots
|
||||
val parts = AfterDarkStrand + listOf(DayPart(21, 5), DayPart(5, 21))
|
||||
val plan = extendFilmSchedule(pool, ScheduleCursor(), at(9, 12), at(16, 12), 2 * 24 * 60 * minute, parts, london)
|
||||
val strand = plan.entries.filter { !it.media.item.title.startsWith("Film") }
|
||||
// Monday and Wednesday nights: two Crypts; Tuesday and Thursday nights: three shorts; nothing at the weekend.
|
||||
val byNight = strand.groupBy { Instant.ofEpochMilli(it.startMs).atZone(london).toLocalDate() }
|
||||
assertEquals(setOf(java.time.DayOfWeek.TUESDAY, java.time.DayOfWeek.WEDNESDAY, java.time.DayOfWeek.THURSDAY, java.time.DayOfWeek.FRIDAY), byNight.keys.map { it.dayOfWeek }.toSet())
|
||||
byNight.forEach { (day, entries) ->
|
||||
val crypts = entries.count { it.seriesId == "tftc" }; val shorts = entries.count { it.seriesId == "ldr" }
|
||||
if (day.dayOfWeek in setOf(java.time.DayOfWeek.TUESDAY, java.time.DayOfWeek.THURSDAY)) assertEquals(2, crypts) else assertTrue(shorts >= 3)
|
||||
entries.zipWithNext { a, b -> assertEquals(a.endMs, b.startMs) }
|
||||
assertTrue(Instant.ofEpochMilli(entries.first().startMs).atZone(london).hour in 1..1)
|
||||
}
|
||||
// A mixed order, not season order.
|
||||
val crypts = strand.filter { it.seriesId == "tftc" }.map { it.mark }
|
||||
assertNotEquals(crypts.sortedWith(compareBy({ it.season }, { it.episode })), crypts)
|
||||
plan.entries.zipWithNext { a, b -> assertEquals(a.endMs, b.startMs) }
|
||||
}
|
||||
|
||||
@Test fun threeRobotsNeverAirsExitStrategiesFirst() {
|
||||
val pool = (1..40).map(::film) + robots
|
||||
val parts = AfterDarkStrand + listOf(DayPart(21, 5), DayPart(5, 21))
|
||||
val plan = extendFilmSchedule(pool, ScheduleCursor(), at(2, 12), at(30, 12) + 120L * 24 * 60 * minute, 2 * 24 * 60 * minute, parts, london)
|
||||
val shorts = plan.entries.filter { it.seriesId == "ldr" }
|
||||
val first = shorts.indexOfFirst { it.mark == EpisodeMark(1, 2) }; val sequel = shorts.indexOfFirst { it.mark == EpisodeMark(3, 1) }
|
||||
assertTrue(first >= 0 && sequel == first + 1)
|
||||
}
|
||||
|
||||
@Test fun theChannelsAreAsApproved() {
|
||||
val paradox = SmartChannels.first { it.number == 106 }
|
||||
assertTrue("Black Mirror" in paradox.searches)
|
||||
assertTrue(paradox.mixes(mirror))
|
||||
// Only from 21:00: not in the 18:00 to 21:00 block or the day.
|
||||
assertTrue(paradox.dayParts.filter { "Black Mirror" in it.titles }.all { it.fromHour >= 21 })
|
||||
val afterDark = SmartChannels.first { it.number == AFTER_DARK_NUMBER }
|
||||
assertTrue(afterDark.filmSeries.containsAll(listOf("Tales from the Crypt", "Love, Death & Robots")))
|
||||
assertTrue("Tales from the Crypt" !in SmartChannels.first { it.number == 102 }.searches)
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,6 @@ class PpvSundayTest {
|
||||
assertTrue(ringX.signature.contains("#films:"))
|
||||
assertTrue(ringX.signature.contains(PpvSunday.first()))
|
||||
val afterDark = SmartChannels.first { it.number == AFTER_DARK_NUMBER }
|
||||
assertTrue(afterDark.signature.contains("#series:$LAST_DRIVE_IN#"))
|
||||
assertTrue(afterDark.signature.contains("#series:${(listOf(LAST_DRIVE_IN) + AfterDarkAnthologies).joinToString("|")}#"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user