@@ -314,9 +314,14 @@ class Report(using Environment):
314314
315315 table.tabulate(summaryLines).grid(columns).render.each(Out .println(_))
316316 given Decimalizer = Decimalizer (decimalPlaces = 1 )
317- Out .println(e " $Bold( $White( $passed)) passed ( ${100.0 * passed/ total}%), $Bold( $White( $failed)) failed ( ${100.0 * failed/ total}%), $Bold( $White( ${passed + failed})) total " )
317+ val pass = e " $Bold( $White( $passed)) passed ( ${100.0 * passed/ total}%) "
318+ val fail = e " $Bold( $White( $failed)) failed ( ${100.0 * failed/ total}%) "
319+ val all = e " $Bold( $White( ${passed + failed})) total "
320+ Out .println(e " $pass, $fail, $all" )
318321 Out .println(t " ─ " * 72 )
319- List (Status .Pass , Status .Bench , Status .Throws , Status .Fail , Status .Mixed , Status .CheckThrows ).grouped(3 ).each: statuses =>
322+
323+ import Status .*
324+ List (Pass , Bench , Throws , Fail , Mixed , CheckThrows ).grouped(3 ).each: statuses =>
320325 Out .println:
321326 statuses.map[Teletype ]: status =>
322327 gossamer.pad[Teletype ](e " ${status.symbol} ${status.describe}" )(20 )
@@ -335,7 +340,8 @@ class Report(using Environment):
335340 val ribbon =
336341 Ribbon (DarkGreen .srgb, MediumSeaGreen .srgb, PaleGreen .srgb)
337342
338- Out .println(ribbon.fill(e " ${suite.let(_.id.id).or(t " " )}" , e " Benchmarks " , e " ${suite.let(_.name).or(t " " )}" ))
343+ Out .println:
344+ ribbon.fill(e " ${suite.lay(t " " )(_.id.id)}" , e " Benchmarks " , e " ${suite.lay(t " " )(_.name)}" )
339345
340346 val comparisons : List [ReportLine .Bench ] =
341347 benchmarks.filter(! _.benchmark.baseline.absent).to(List )
@@ -370,36 +376,35 @@ class Report(using Environment):
370376 comparisons.map: c =>
371377 import Baseline .*
372378 val baseline = c.benchmark.baseline.vouch(using Unsafe )
373- Column (e " $Bold( $CadetBlue( ${c.test.id})) " , textAlign = TextAlignment .Right ): (bench : ReportLine .Bench ) =>
374- def op (left : Double , right : Double ): Double = baseline.mode match
375- case Arithmetic => left - right
376- case Geometric => left/ right
377-
378- def metric (value : Double ) = if baseline.metric == ByTime then value else 1 / value
379-
380- val value = baseline.compare match
381- case Compare .Min => op(metric(bench.benchmark.min), metric(c.benchmark.min))
382- case Compare .Mean => op(metric(bench.benchmark.mean), metric(c.benchmark.mean))
383- case Compare .Max => op(metric(bench.benchmark.max), metric(c.benchmark.max))
384-
385- val valueWithUnits = baseline.metric match
386- case ByTime =>
387- showTime(value.toLong)
388-
389- case BySpeed =>
390- e " $Silver( ${value}) $Turquoise(op $Gray(·)s¯¹) "
391-
392- baseline.mode match
393- case Arithmetic => if value == 0 then e " ★ "
394- else if value < 0
395- then e " $Thistle(-) ${valueWithUnits.dropChars(1 )}"
396- else e " $Thistle(+) $valueWithUnits"
397-
398- case Geometric => if value == 1 then e " ★ " else e " $Silver( $value) "
379+ Column (e " $Bold( $CadetBlue( ${c.test.id})) " , textAlign = TextAlignment .Right ):
380+ (bench : ReportLine .Bench ) =>
381+ def op (left : Double , right : Double ): Double = baseline.mode match
382+ case Arithmetic => left - right
383+ case Geometric => left/ right
384+
385+ def metric (value : Double ) = if baseline.metric == ByTime then value else 1 / value
386+
387+ val value = baseline.compare match
388+ case Compare .Min => op(metric(bench.benchmark.min), metric(c.benchmark.min))
389+ case Compare .Mean => op(metric(bench.benchmark.mean), metric(c.benchmark.mean))
390+ case Compare .Max => op(metric(bench.benchmark.max), metric(c.benchmark.max))
391+
392+ val valueWithUnits = baseline.metric match
393+ case ByTime => showTime(value.toLong)
394+ case BySpeed => e " $Silver( ${value}) $Turquoise(op $Gray(·)s¯¹) "
395+
396+ baseline.mode match
397+ case Arithmetic => if value == 0 then e " ★ "
398+ else if value < 0
399+ then e " $Thistle(-) ${valueWithUnits.dropChars(1 )}"
400+ else e " $Thistle(+) $valueWithUnits"
401+
402+ case Geometric => if value == 1 then e " ★ " else e " $Silver( $value) "
399403 ))*
400404 )
401405
402- bench.tabulate(benchmarks.to(List ).sortBy(- _.benchmark.throughput)).grid(columns).render.each(Out .println(_))
406+ bench.tabulate(benchmarks.to(List ).sortBy(- _.benchmark.throughput))
407+ . grid(columns).render.each(Out .println(_))
403408
404409 def showLegend (): Unit =
405410 Out .println(t " ─ " * 74 )
@@ -456,8 +461,11 @@ class Report(using Environment):
456461 e " No tests were active when a fatal error occurred. "
457462
458463 case _ =>
459- val tests = active.to(List ).map { test => e " $Bold( ${test.name}) " }.join(e " " , e " , " , e " and " , e " " )
460464 val were = if active.size == 1 then e " was " else e " were "
465+ val tests =
466+ active.to(List ).map { test => e " $Bold( ${test.name}) " }
467+ . join(e " " , e " , " , e " and " , e " " )
468+
461469 e " A fatal error occurred while $tests $were running. "
462470
463471 Out .println()
0 commit comments