Add partially filled blocks alongside time

This provides much more intuitive information at a glance than the precise numbers.
This commit is contained in:
George Thomas 2026-01-11 23:26:49 +00:00
parent 5a6727ba05
commit 86f51534bc

View File

@ -364,22 +364,34 @@ displayTestResultsConsole terminalWidth testResult =
<> name
<> maybe
mempty
( \_t@(showTime -> tt) ->
( \t@(showTime -> tt) ->
T.replicate
( fromIntegral $
maybe
3
(\n -> n - (2 * indent + T.length name + T.length tt + 2))
(\n -> n - (2 * indent + T.length name + T.length tt + 4))
terminalWidth
)
" "
<> setColour Dull Blue
<> tt
<> " "
<> T.singleton (timeBarFunction t)
)
time
<> "\n"
paddedAllLines p = T.unlines . map (p <>) . T.lines
indentAllLines indent = paddedAllLines $ T.replicate (indent * 2) " "
timeBarFunction t
| t < 0.01 = ' '
| t < 0.03 = '▁'
| t < 0.1 = '▂'
| t < 0.3 = '▃'
| t < 1 = '▄'
| t < 3 = '▅'
| t < 10 = '▆'
| t < 30 = '▇'
| otherwise = '█'
showTime (nominalDiffTimeToSeconds -> MkFixed duration) =
-- SI prefixes, and always exactly 2 decimal places, or 3 if there's no prefix
T.show res