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 <> name
<> maybe <> maybe
mempty mempty
( \_t@(showTime -> tt) -> ( \t@(showTime -> tt) ->
T.replicate T.replicate
( fromIntegral $ ( fromIntegral $
maybe maybe
3 3
(\n -> n - (2 * indent + T.length name + T.length tt + 2)) (\n -> n - (2 * indent + T.length name + T.length tt + 4))
terminalWidth terminalWidth
) )
" " " "
<> setColour Dull Blue <> setColour Dull Blue
<> tt <> tt
<> " "
<> T.singleton (timeBarFunction t)
) )
time time
<> "\n" <> "\n"
paddedAllLines p = T.unlines . map (p <>) . T.lines paddedAllLines p = T.unlines . map (p <>) . T.lines
indentAllLines indent = paddedAllLines $ T.replicate (indent * 2) " " 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) = showTime (nominalDiffTimeToSeconds -> MkFixed duration) =
-- SI prefixes, and always exactly 2 decimal places, or 3 if there's no prefix -- SI prefixes, and always exactly 2 decimal places, or 3 if there's no prefix
T.show res T.show res