package com.cottondb.daysimport com.cottondb.days.ui.SuffixJoinimport org.junit.Assert.assertEqualsimport org.junit.Assert.assertFalseimport org.junit.Assert.assertTrueimport org.junit.Test/** RULE (DECISIONS "One rule"): a row's suffix stays whole; at the largest text it may go to the next line, never split. */classDaysSuffixJoinTest { @Test fun a_suffix_never_breaks_inside() { assertEquals("to 9:15", SuffixJoin.whole("to 9:15")) assertEquals("from 12 Nov", SuffixJoin.whole("from 12 Nov")) } @Test fun glued_to_the_last_word_until_that_would_split_it_then_free_to_take_the_next_line() { assertFalse(SuffixJoin.gap(loose = false).contains(' ')) assertTrue("breaks last, so the next line starts at the suffix", SuffixJoin.gap(loose = true).endsWith(" ")) } @Test fun a_suffix_over_two_lines_is_split() { assertTrue(SuffixJoin.split(firstLine = 1, lastLine = 2)) assertFalse(SuffixJoin.split(firstLine = 2, lastLine = 2)) }}/** RULE: a late row's day takes at most a third of the words' width, so the words never break inside a word at the largest text. */classDaysAsideRoomTest { @Test fun an_aside_takes_at_most_a_third() = assertEquals(300f, com.cottondb.days.ui.AsideRoom.most(900), 0.01f)}/** RULE: a repeating row's aside keeps its day at the largest text ("Every day · Sun 22 Nov" was cut to "Every day …"). */classDaysAsideLinesTest { @Test fun a_repeating_rows_aside_has_lines_for_its_day() = assertTrue(com.cottondb.days.ui.AsideRoom.LINES >= 4)}