package com.cottondb.dataimport org.junit.Assert.assertFalseimport org.junit.Assert.assertTrueimport org.junit.Testimport java.io.File/** ANDROID READY 1: what Data's walk on emulator-5604 found in the shell. */classDataReadyTest {privateval repo = generateSequence(File("").absoluteFile) { it.parentFile }.first { File(it, "apps/registry.json").isFile }privatefun src(name: String) = File(repo, "apps/android/app/src/data/kotlin/com/cottondb/data/$name").readText()/** Stopped to leave room at 20%: the core's state_line says why, beside the percent; only filling leaves it out. */ @Testfun keep_says_why_it_stopped() {val you = src("You.kt") assertTrue(you.contains("if (progress == null || a.str(\"state\") != \"filling\") a.str(\"state_line\")")) assertFalse(you.contains("if (progress == null || a.str(\"state\") == \"paused\")")) }/** At the largest text a long cost value took the whole row and left its name one letter wide. */ @Testfun a_cost_value_takes_at_most_half_the_row() {val you = src("You.kt") assertTrue(you.contains("T(row.str(\"value_line\").orEmpty(), 16.sp, weight = FontWeight.Bold, modifier = Modifier.weight(1f, fill = false))")) }/** TalkBack said "Invented Stuck B, , yesterday": a row's blank second line is left out of its name. */ @Testfun a_rows_spoken_name_skips_blank_parts() {val bits = src("Bits.kt") assertTrue(bits.contains("listOf(title, line, end).filterNot { it.isNullOrBlank() }.joinToString(\", \")")) assertFalse(bits.contains("listOfNotNull(title, line, end).joinToString(\", \")")) }}