logicgate: tapping a tray chip opens a sheet explaining how it works
- Commit
d3a377dfe82114e7415c283b1f55a66caf8185a9- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-03 03:54 UTC (1 month ago)
- Parents
2b7521f
Until now tapping a chip card in the bottom tray instantly placed the chip in the middle of the board, and the game offered no way to learn what a chip does short of reading the level briefs. With 42 chips, including tick-clocked parts like DFF and RAM16 whose semantics are not obvious, that left players guessing. Tap now opens a ModalBottomSheet (ui/ChipInfoSheet.kt) with the chip's label, NAND cost, input/output pins with bus widths, and a plain-English explanation of its behaviour. Sequential chips mention the implicit clock tick explicitly, since that concept is otherwise invisible until the Memory chapter. An 'Add to board' button in the sheet performs the old tap action (place in the middle of the view), so tap-to-place survives one step deeper; drag-up-to-place and the scroll gesture are unchanged. - Blurbs live in domain/model/ChipInfo.kt as plain English, matching how level briefs and hints already live in domain; they cover all 42 chips and were written against the real behaviours in Chips.kt. - State follows the showBrief pattern: GameUiState.infoChip plus a LogicActions.showChipInfo callback, so previews rendering with LogicActions.Noop and default state are untouched. - BriefSheet's private PinLine was extracted to ui/PinLine.kt (one public composable per file) so both sheets share the pin list. - Tray accessibility label updated to 'Tap for details, or drag it up onto the board'; new lg_add_to_board string, English-only for now like other recently added strings. - ChipInfoTest guards that every chip in Chips.all keeps a non-blank blurb, so a future chip cannot ship without an explanation. - games/logicgate/AGENTS.md updated for the new tap behaviour. Verified with :games:logicgate:compileDevKotlin, :games:logicgate:testDevUnitTest (including the new ChipInfoTest) and ./check games/logicgate (detekt + lint), all green. No previews were added or changed, so no metadata regeneration was needed.
Diff
games/logicgate/AGENTS.md
diff --git a/games/logicgate/AGENTS.md b/games/logicgate/AGENTS.mdindex 9504fdba47..353e09b162 100644--- a/games/logicgate/AGENTS.md+++ b/games/logicgate/AGENTS.md@@ -24,13 +24,13 @@ _Install: ./install games/logicgate (dev by default)._ **Gotchas:** - Pars are asserted equal to the reference solution costs in `src/test/.../domain/LevelSolutionsTest.kt`. Change a chip's `nandCost` and its reference together. - `ui/canvas/` is world-unit geometry (≈dp at 1×). `CameraState.scale` already includes density, so canvas text uses `sizeWorld.toSp()`.-- Nothing edits on finger-down. Chips are created by pulling them up out of the tray (`ChipTray`: an upward drag claims the gesture, a sideways one scrolls) or by tapping them. Gates are deleted by dropping them back on the bottom area (`ui/canvas/TrashZone.kt`) or from the selection bar.+- Nothing edits on finger-down. Chips are created by pulling them up out of the tray (`ChipTray`: an upward drag claims the gesture, a sideways one scrolls) or from `ui/ChipInfoSheet.kt`, opened by tapping a tray card (chip blurbs live in `domain/model/ChipInfo.kt`). Gates are deleted by dropping them back on the bottom area (`ui/canvas/TrashZone.kt`) or from the selection bar. - Test rows carry plain-language titles (`domain/levels/RowTitles.kt`, e.g. `1 OR 1 = 1`), which are shown instead of row numbers. ## Key files ### domain/ — pure, unit-tested - domain/model/Circuit.kt — nodes, pins, wires, immutable edits, `sanitized`-- domain/model/ChipSpec.kt, domain/model/Chips.kt, domain/model/Isa.kt+- domain/model/ChipSpec.kt, domain/model/Chips.kt, domain/model/ChipInfo.kt (tray tap blurbs), domain/model/Isa.kt - domain/sim/Simulator.kt, domain/sim/Scheduler.kt — tick semantics, SCC ordering - domain/sim/Verifier.kt, domain/sim/TestSpec.kt, domain/sim/Scoring.kt - domain/levels/LevelRegistry.kt + {Basics,Routing,Arithmetic,Memory,Cpu}Levels.kt@@ -40,7 +40,7 @@ _Install: ./install games/logicgate (dev by default)._ - platform/LogicAchievements.kt (`assets/achievements.json`, ids `lg2_*`), platform/AppBackupAgent.kt ### ui/ - ui/GameScreen.kt, ui/CircuitCanvas.kt, ui/ChipTray.kt, ui/TestPanel.kt, ui/SelectionBar.kt-- ui/BriefSheet.kt, ui/BusValueDialog.kt, ui/LevelCompleteOverlay.kt, ui/ProgressionScreen.kt, ui/StarRating.kt+- ui/BriefSheet.kt, ui/ChipInfoSheet.kt, ui/PinLine.kt, ui/BusValueDialog.kt, ui/LevelCompleteOverlay.kt, ui/ProgressionScreen.kt, ui/StarRating.kt - ui/canvas/ — Camera, CameraState, GateGeometry (layout), HitTest, CanvasGestures, CanvasController, GatePainter, GateShapes ## Verify (this module only)
games/logicgate/src/main/java/com/vayunmathur/games/logicgate/domain/model/ChipInfo.kt
diff --git a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/domain/model/ChipInfo.kt b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/domain/model/ChipInfo.ktnew file mode 100644index 0000000000..34be2c8e3d--- /dev/null+++ b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/domain/model/ChipInfo.kt@@ -0,0 +1,76 @@+package com.vayunmathur.games.logicgate.domain.model++/**+ * One- or two-sentence explanations of each chip, shown when a chip card in the tray is tapped.+ * Plain English like the level briefs; every chip in [Chips.all] has an entry (guarded by a test).+ */+object ChipInfo {++ private val blurbs = mapOf(+ Chips.NAND to "The gate everything starts from: o is 0 only when a and b are both 1. " ++ "Every other chip in the game is built from NANDs alone.",+ Chips.HIGH to "No inputs; o is always 1.",+ Chips.LOW to "No inputs; o is always 0.",+ Chips.NOT to "o is the opposite of a: 1 becomes 0, 0 becomes 1.",+ Chips.AND to "o is 1 only when a and b are both 1.",+ Chips.OR to "o is 1 when a, b or both are 1.",+ Chips.NOR to "OR then NOT: o is 1 only when a and b are both 0. " ++ "Two NORs wired into each other make an SR latch.",+ Chips.XOR to "o is 1 when a and b differ.",+ Chips.XNOR to "o is 1 when a and b are equal.",++ Chips.MUX to "Picks one of two inputs: o copies a while s is 0, b while s is 1.",+ Chips.DMUX to "The reverse of a MUX: in goes to a while s is 0, to b while s is 1. " ++ "The other output stays 0.",+ Chips.DEC2 to "One-hot decoder: the 2-bit number s1 s0 selects exactly one of y0–y3 to be 1; " ++ "the rest stay 0.",+ Chips.SPLIT8 to "Splits an 8-bit bus into its eight bits, b0 (lowest) to b7 (highest).",+ Chips.JOIN8 to "Packs eight bits, b0 (lowest) to b7 (highest), into one 8-bit bus.",+ Chips.SPLIT4 to "Splits a 4-bit bus into its four bits, b0 (lowest) to b3 (highest).",+ Chips.JOIN4 to "Packs four bits, b0 (lowest) to b3 (highest), into one 4-bit bus.",+ Chips.NIB_SPLIT to "Splits a byte into its two halves: lo is the low 4 bits, hi the high 4.",+ Chips.NIB_JOIN to "Packs a low and a high 4-bit half into one byte.",+ Chips.NOT8 to "Flips all eight bits of a at once.",+ Chips.AND8 to "Bitwise AND on bytes: each output bit is 1 only where a and b both have a 1.",+ Chips.OR8 to "Bitwise OR on bytes: each output bit is 1 where a or b has a 1.",+ Chips.XOR8 to "Bitwise XOR on bytes: each output bit is 1 where a and b differ.",+ Chips.MUX8B to "A byte-wide MUX: o copies a while s is 0, b while s is 1.",+ Chips.MUX4B to "A 4-bit-wide MUX: o copies a while s is 0, b while s is 1.",++ Chips.HALF to "Half adder: s is the sum of a and b, c is the carry into the next column.",+ Chips.FULL to "Full adder: adds a + b + cin; s is the sum bit, cout the carry into the next column.",+ Chips.ADD4 to "Adds two 4-bit numbers and cin; o is the 4-bit sum, cout the carry out. " ++ "Overflow wraps around.",+ Chips.ADD8 to "Adds two bytes and cin; o is the sum, cout the carry out. Overflow wraps around.",+ Chips.INC4 to "Counts up: o is a + 1. 15 wraps back to 0.",+ Chips.SUB8 to "d is a − b, wrapping modulo 256.",+ Chips.ZERO8 to "z is 1 only when every bit of a is 0 — the flag a CPU needs for jumps.",+ Chips.ALU8 to "Arithmetic and logic in one chip: op1 op0 choose 00 = a + b, 01 = a − b, " ++ "10 = a AND b, 11 = b. z is 1 when the result is 0.",++ Chips.DFF to "The memory primitive. q always shows the stored bit, and every tick of the " ++ "clock stores whatever d is — so q is d delayed by one tick. It never reads d while " ++ "settling, which is what breaks feedback loops.",+ Chips.DFF4 to "Four DFFs in one chip: stores a 4-bit number every tick.",+ Chips.DFF8 to "Eight DFFs in one chip: stores a byte every tick.",+ Chips.BIT to "A 1-bit register: on the tick it stores d when load is 1, " ++ "and holds its bit when load is 0.",+ Chips.REG8 to "A byte register: on the tick it stores d when load is 1, " ++ "and holds its byte when load is 0.",+ Chips.PC4 to "Program counter: on each tick it jumps to v when load is 1, " ++ "else counts up when en is 1 (15 wraps to 0), else holds.",+ Chips.RAM4 to "Four bytes of memory. dout always shows the byte at address a1 a0; " ++ "on the tick, din replaces that byte when we is 1.",+ Chips.RAM16 to "Sixteen bytes with two read ports: instr shows the byte at iaddr, dout the " ++ "byte at daddr. On the tick, din is written to daddr when we is 1.",++ Chips.DECODER to "Instruction decoder: from the 4-bit opcode and the z flag it produces the " ++ "CPU's control signals — aluOp1 aluOp0, accLoad, memWrite, useImm, jump and halt.",+ Chips.CPU to "A complete processor. Each tick it executes the instruction on instr, driving " ++ "pc, addr, dout and we to talk to RAM and reading data back; acc is the accumulator and " ++ "halt goes 1 when the program ends.",+ )++ /** The explanation of [chipId], or null for a chip with no entry. */+ fun of(chipId: String): String? = blurbs[chipId]+}
games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicUiContract.kt
diff --git a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicUiContract.kt b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicUiContract.ktindex b3dd68f676..b651eb6955 100644--- a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicUiContract.kt+++ b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicUiContract.kt@@ -61,6 +61,8 @@ data class GameUiState( val cost: Int = 0, val bestCost: Int? = null, val showBrief: Boolean = false,+ /** The tray chip whose info sheet is open. */+ val infoChip: ChipSpec? = null, /** Bumped when the canvas should frame the whole circuit, e.g. on opening a level. */ val fitToken: Int = 0, val nextLevelId: String? = null,@@ -79,6 +81,7 @@ interface LogicActions { fun setInput(index: Int, value: Int) {} fun probe(caseIndex: Int?) {} fun showBrief(show: Boolean) {}+ fun showChipInfo(chip: ChipSpec?) {} fun dismissWin() {} /** Ready-made instances. */
games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicViewModel.kt
diff --git a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicViewModel.kt b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicViewModel.ktindex 3bc94f3004..583e7672a8 100644--- a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicViewModel.kt+++ b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/platform/LogicViewModel.kt@@ -7,6 +7,7 @@ import com.vayunmathur.games.logicgate.data.CircuitStore import com.vayunmathur.games.logicgate.data.ProgressStore import com.vayunmathur.games.logicgate.domain.levels.LevelDef import com.vayunmathur.games.logicgate.domain.levels.LevelRegistry+import com.vayunmathur.games.logicgate.domain.model.ChipSpec import com.vayunmathur.games.logicgate.domain.model.Chips import com.vayunmathur.games.logicgate.domain.model.Circuit import com.vayunmathur.games.logicgate.domain.model.NodeId@@ -161,6 +162,10 @@ class LogicViewModel @JvmOverloads constructor( _game.update { it?.copy(showBrief = show) } } + override fun showChipInfo(chip: ChipSpec?) {+ _game.update { it?.copy(infoChip = chip) }+ }+ override fun dismissWin() { _game.update { it?.copy(won = false) } }
games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/BriefSheet.kt
diff --git a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/BriefSheet.kt b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/BriefSheet.ktindex 9d27eaf0ba..2e578a23f4 100644--- a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/BriefSheet.kt+++ b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/BriefSheet.kt@@ -17,7 +17,6 @@ import androidx.compose.ui.res.stringResource import com.vayunmathur.games.logicgate.R import com.vayunmathur.games.logicgate.domain.levels.LevelDef import com.vayunmathur.games.logicgate.domain.model.Chips-import com.vayunmathur.games.logicgate.domain.model.Pin import com.vayunmathur.library.ui.Button import com.vayunmathur.library.ui.IconLightbulb import com.vayunmathur.library.ui.MaterialTheme@@ -70,16 +69,3 @@ fun BriefSheet(level: LevelDef, number: Int, onDismiss: () -> Unit) { } } }--@Composable-private fun PinLine(title: String, pins: List<Pin>) {- val text = if (pins.isEmpty()) {- stringResource(R.string.lg_brief_none)- } else {- pins.map { if (it.width == 1) it.name else stringResource(R.string.lg_pin_width, it.name, it.width) }.joinToString()- }- Row(horizontalArrangement = Arrangement.spacedBy(Spacing.sm)) {- Text(title, style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)- Text(text, style = MaterialTheme.typography.bodyMedium)- }-}
games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/ChipInfoSheet.kt
diff --git a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/ChipInfoSheet.kt b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/ChipInfoSheet.ktnew file mode 100644index 0000000000..473b417591--- /dev/null+++ b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/ChipInfoSheet.kt@@ -0,0 +1,48 @@+package com.vayunmathur.games.logicgate.ui++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.verticalScroll+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource+import com.vayunmathur.games.logicgate.R+import com.vayunmathur.games.logicgate.domain.model.ChipInfo+import com.vayunmathur.games.logicgate.domain.model.ChipSpec+import com.vayunmathur.library.ui.Button+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.ModalBottomSheet+import com.vayunmathur.library.ui.Spacing+import com.vayunmathur.library.ui.Text++/**+ * What a tray chip is and how it behaves, opened by tapping its card. [onAdd] places it on the+ * board — the same thing tapping the card used to do directly.+ */+@Composable+fun ChipInfoSheet(chip: ChipSpec, onAdd: () -> Unit, onDismiss: () -> Unit) {+ ModalBottomSheet(onDismissRequest = onDismiss) {+ Column(+ Modifier+ .fillMaxWidth()+ .verticalScroll(rememberScrollState())+ .padding(horizontal = Spacing.xl)+ .padding(bottom = Spacing.xl),+ verticalArrangement = Arrangement.spacedBy(Spacing.md),+ ) {+ Text(chip.label, style = MaterialTheme.typography.headlineSmall)+ Text(+ stringResource(R.string.lg_cost, chip.nandCost),+ style = MaterialTheme.typography.labelLarge,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ ChipInfo.of(chip.id)?.let { Text(it, style = MaterialTheme.typography.bodyLarge) }+ PinLine(stringResource(R.string.lg_brief_inputs), chip.inputs)+ PinLine(stringResource(R.string.lg_brief_outputs), chip.outputs)+ Button(onClick = onAdd, modifier = Modifier.fillMaxWidth()) { Text(stringResource(R.string.lg_add_to_board)) }+ }+ }+}
games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/ChipTray.kt
diff --git a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/ChipTray.kt b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/ChipTray.ktindex 1f3977e695..5d2e21fd96 100644--- a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/ChipTray.kt+++ b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/ChipTray.kt@@ -43,8 +43,8 @@ import kotlin.math.abs data class TrayDrag(val chipId: String, val root: Offset) /**- * The chip palette. Pull a card up onto the board to place it where you let go, or tap it to drop- * it in the middle of the view. Sideways swipes scroll the row.+ * The chip palette. Pull a card up onto the board to place it where you let go, or tap it to open+ * its info sheet (which can also place it). Sideways swipes scroll the row. */ @Composable fun ChipTray(
games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/GameScreen.kt
diff --git a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/GameScreen.kt b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/GameScreen.ktindex eede435d26..e3399e7611 100644--- a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/GameScreen.kt+++ b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/GameScreen.kt@@ -109,7 +109,7 @@ fun GameScreen( TestPanel(state, actions) ChipTray( chips = state.chips,- onTap = { placeNear(it, cameraState.centerWorld()) },+ onTap = { id -> Chips[id]?.let(actions::showChipInfo) }, onDragUpdate = { drag -> trayDrag = drag if (trash.carry(drag?.root)) haptics.tick()@@ -135,6 +135,16 @@ fun GameScreen( } } if (state.showBrief) BriefSheet(state.level, number, onDismiss = { actions.showBrief(false) })+ state.infoChip?.let { chip ->+ ChipInfoSheet(+ chip = chip,+ onAdd = {+ placeNear(chip.id, cameraState.centerWorld())+ actions.showChipInfo(null)+ },+ onDismiss = { actions.showChipInfo(null) },+ )+ } } /** Covers the tray while a gate is carried, so it reads as the place to throw it away. */
games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/PinLine.kt
diff --git a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/PinLine.kt b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/PinLine.ktnew file mode 100644index 0000000000..dec2bb91b0--- /dev/null+++ b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/PinLine.kt@@ -0,0 +1,25 @@+package com.vayunmathur.games.logicgate.ui++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Row+import androidx.compose.runtime.Composable+import androidx.compose.ui.res.stringResource+import com.vayunmathur.games.logicgate.R+import com.vayunmathur.games.logicgate.domain.model.Pin+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.Spacing+import com.vayunmathur.library.ui.Text++/** A titled, comma-separated pin list with bus widths, shared by the brief and chip info sheets. */+@Composable+fun PinLine(title: String, pins: List<Pin>) {+ val text = if (pins.isEmpty()) {+ stringResource(R.string.lg_brief_none)+ } else {+ pins.map { if (it.width == 1) it.name else stringResource(R.string.lg_pin_width, it.name, it.width) }.joinToString()+ }+ Row(horizontalArrangement = Arrangement.spacedBy(Spacing.sm)) {+ Text(title, style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(text, style = MaterialTheme.typography.bodyMedium)+ }+}
games/logicgate/src/main/res/values/strings.xml
diff --git a/games/logicgate/src/main/res/values/strings.xml b/games/logicgate/src/main/res/values/strings.xmlindex 8704048c55..d24be67a99 100644--- a/games/logicgate/src/main/res/values/strings.xml+++ b/games/logicgate/src/main/res/values/strings.xml@@ -41,9 +41,11 @@ <string name="lg_cost"><xliff:g id="cost" example="12">%1$d</xliff:g> NAND</string> <!-- Chip tray: accessibility label for a chip card. %1$s = chip name e.g. NAND, %2$d = cost e.g. 1 -->- <string name="lg_cd_chip"><xliff:g id="chip" example="NAND">%1$s</xliff:g>, costs <xliff:g id="cost" example="1">%2$d</xliff:g> NAND. Tap to add it, or drag it up onto the board.</string>+ <string name="lg_cd_chip"><xliff:g id="chip" example="NAND">%1$s</xliff:g>, costs <xliff:g id="cost" example="1">%2$d</xliff:g> NAND. Tap for details, or drag it up onto the board.</string> <!-- Chip tray: badge for a chip with multi-bit pins. %1$d = widest bus width e.g. 8 --> <string name="lg_bus_badge"><xliff:g id="width" example="8">%1$d</xliff:g>-bit</string>+ <!-- Chip info sheet: primary action placing the chip in the middle of the board. Verb phrase -->+ <string name="lg_add_to_board">Add to board</string> <!-- Trash zone: shown over the chip tray while a gate is being dragged. Instruction --> <string name="lg_drag_to_delete">Drag here to delete</string>
games/logicgate/src/test/java/com/vayunmathur/games/logicgate/domain/ChipInfoTest.kt
diff --git a/games/logicgate/src/test/java/com/vayunmathur/games/logicgate/domain/ChipInfoTest.kt b/games/logicgate/src/test/java/com/vayunmathur/games/logicgate/domain/ChipInfoTest.ktnew file mode 100644index 0000000000..698bd5d3ff--- /dev/null+++ b/games/logicgate/src/test/java/com/vayunmathur/games/logicgate/domain/ChipInfoTest.kt@@ -0,0 +1,33 @@+package com.vayunmathur.games.logicgate.domain++import com.vayunmathur.games.logicgate.domain.model.ChipInfo+import com.vayunmathur.games.logicgate.domain.model.Chips+import kotlin.test.Test+import kotlin.test.assertNotNull+import kotlin.test.assertTrue++class ChipInfoTest {++ @Test+ fun everyChipHasABlurb() {+ for (chip in Chips.all) {+ assertTrue(ChipInfo.of(chip.id).orEmpty().isNotBlank(), "missing blurb for ${chip.id}")+ }+ }++ @Test+ fun everyKnownChipIdResolves() {+ // Guards against a blurb written for an id that no chip uses.+ for (id in listOf(+ Chips.NAND, Chips.HIGH, Chips.LOW, Chips.NOT, Chips.AND, Chips.OR, Chips.NOR, Chips.XOR, Chips.XNOR,+ Chips.MUX, Chips.DMUX, Chips.DEC2, Chips.SPLIT8, Chips.JOIN8, Chips.SPLIT4, Chips.JOIN4,+ Chips.NIB_SPLIT, Chips.NIB_JOIN, Chips.NOT8, Chips.AND8, Chips.OR8, Chips.XOR8, Chips.MUX8B, Chips.MUX4B,+ Chips.HALF, Chips.FULL, Chips.ADD4, Chips.ADD8, Chips.INC4, Chips.SUB8, Chips.ZERO8, Chips.ALU8,+ Chips.DFF, Chips.DFF4, Chips.DFF8, Chips.BIT, Chips.REG8, Chips.PC4, Chips.RAM4, Chips.RAM16,+ Chips.DECODER, Chips.CPU,+ )) {+ assertNotNull(Chips[id], id)+ assertNotNull(ChipInfo.of(id), id)+ }+ }+}