Retro: an 80s vacuum fluorescent cluster with seven-segment digits, bar graphs and a lit P R N D selector. Futuristic: a hairline HUD with an animated energy flow between battery and wheel, a turning speed ring and a power arc. Both show unread values as dashes. The Overview now reads the car five times a second. Emulator only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
36 lines
1.4 KiB
Java
36 lines
1.4 KiB
Java
package com.evsuite.abrp;
|
|
|
|
import static org.junit.Assert.assertArrayEquals;
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import org.junit.Test;
|
|
|
|
/** Seven-segment digits for the Retro style — pure JVM. */
|
|
public class SevenSegmentTest {
|
|
|
|
@Test
|
|
public void digitsLightTheRightSegments() {
|
|
assertEquals(SevenSegment.ALL, SevenSegment.mask('8'));
|
|
assertEquals(SevenSegment.B | SevenSegment.C, SevenSegment.mask('1'));
|
|
assertEquals(SevenSegment.ALL & ~SevenSegment.G, SevenSegment.mask('0'));
|
|
assertEquals(SevenSegment.G, SevenSegment.mask('-'));
|
|
assertEquals(0, SevenSegment.mask(' '));
|
|
assertEquals(0, SevenSegment.mask('x'));
|
|
}
|
|
|
|
@Test
|
|
public void textIsRightAligned() {
|
|
assertArrayEquals(new char[] { ' ', '8', '7' }, SevenSegment.cells("87", 3));
|
|
assertArrayEquals(new char[] { '1', '2', '3' }, SevenSegment.cells("9123", 3));
|
|
assertArrayEquals(new char[] { ' ', ' ', ' ' }, SevenSegment.cells(null, 3));
|
|
}
|
|
|
|
@Test
|
|
public void decimalPointsFoldIntoTheDigitBefore() {
|
|
assertArrayEquals(new char[] { '1', '5', '8' }, SevenSegment.cells("15.8", 3));
|
|
assertArrayEquals(new boolean[] { false, true, false }, SevenSegment.dots("15.8", 3));
|
|
assertArrayEquals(new boolean[] { false, false, true, false }, SevenSegment.dots("5.8", 4));
|
|
assertArrayEquals(new boolean[] { false, false }, SevenSegment.dots("42", 2));
|
|
}
|
|
}
|