From dadf1e71a2fb2f1f331d830636d286ab98b4034a Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 7 Oct 2019 01:48:38 +0200 Subject: [PATCH] number of lines distinct from values in statistics Indicate ignored (non-numeric) rows if any. Unchanged otherwise. --- barcat | 5 +-- ..._--minval=1.1_--maxval=1.11_-L10-30_-s.out | 2 +- t/t1602-float_statistics_-sL0.out | 2 +- t/t1603-added_statistics.in | 1 + t/t1603-added_statistics_-sL2-.out | 31 +++++++++++++++++++ t/t1901-technicolor_-cs_--header.out | 2 +- ...--minval=1.1_--maxval=1.11_-L10-30_-cs.out | 2 +- 7 files changed, 39 insertions(+), 6 deletions(-) create mode 120000 t/t1603-added_statistics.in create mode 100644 t/t1603-added_statistics_-sL2-.out diff --git a/barcat b/barcat index fc4cb3c..5676228 100755 --- a/barcat +++ b/barcat @@ -273,12 +273,13 @@ sub show_stat { if ($opt{hidemin} or $opt{hidemax}) { $opt{hidemin} ||= 1; $opt{hidemax} ||= @lines; - printf '%s of ', sum(@values[$opt{hidemin} - 1 .. $opt{hidemax} - 1]) // 0; + printf '%s of ', sum(grep {length} @values[$opt{hidemin} - 1 .. $opt{hidemax} - 1]) // 0; } if (@order) { my $total = sum @order; printf '%s total', color(1) . $total . color(0); - printf ' in %d values', scalar @values; + printf ' in %d values', scalar @order; + printf ' over %d lines', scalar @lines if @order != @lines; printf(' (%s min, %s avg, %s max)', color(31) . $order[-1] . color(0), color(36) . (sprintf '%*.*f', 0, 2, $total / @order) . color(0), diff --git a/t/t1312-currency-crop_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-s.out b/t/t1312-currency-crop_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-s.out index 7cca89b..e89c5cc 100644 --- a/t/t1312-currency-crop_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-s.out +++ b/t/t1312-currency-crop_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-s.out @@ -19,4 +19,4 @@ 2019-08-22 1.1083 ------------------ 2019-08-21 1.1104 ----------------------- 2019-08-20 1.1076 ----------------- -23.1939 of 6386.71270000003 total in 5373 values (0.8252 min, 1.20 avg, 1.5990 max) +23.1939 of 6386.71270000003 total in 5306 values over 5373 lines (0.8252 min, 1.20 avg, 1.5990 max) diff --git a/t/t1602-float_statistics_-sL0.out b/t/t1602-float_statistics_-sL0.out index f6d0731..e067ae3 100644 --- a/t/t1602-float_statistics_-sL0.out +++ b/t/t1602-float_statistics_-sL0.out @@ -1 +1 @@ --7.4589999998 total in 18 values (-3 min, -0.47 avg, 2 max) +-7.4589999998 total in 16 values over 18 lines (-3 min, -0.47 avg, 2 max) diff --git a/t/t1603-added_statistics.in b/t/t1603-added_statistics.in new file mode 120000 index 0000000..7d1fc98 --- /dev/null +++ b/t/t1603-added_statistics.in @@ -0,0 +1 @@ +t1008-unicode.in \ No newline at end of file diff --git a/t/t1603-added_statistics_-sL2-.out b/t/t1603-added_statistics_-sL2-.out new file mode 100644 index 0000000..b0c7b03 --- /dev/null +++ b/t/t1603-added_statistics_-sL2-.out @@ -0,0 +1,31 @@ + 920 B -<- + 476 C -< + 619 Ĉ -< +2094 D -<----+ +6552 E -<----+-=--->---------- +1062 F -<-- + 766 G -<- + 738 Ĝ -<- + 371 H - + 7 Ĥ +5513 I -<----+-=--->------- +1140 J -<-- + 38 Ĵ +2558 K -<----+-= +4253 L -<----+-=--->-- +2183 M -<----+- +6321 N -<----+-=--->--------- +8110 O -<----+-=--->---------------- +2266 P -<----+- +4387 R -<----+-=--->--- +5462 S -<----+-=--->------ + 331 Ŝ - +3534 T -<----+-=---> +2579 U -<----+-= + 320 Ŭ - +1458 V -<--- + 383 Z - +# 23731 whitespace +4217 … -<----+-=--->-- + 0 +68658 of 77982 total in 29 values over 31 lines (7 min, 2689.03 avg, 9324 max) diff --git a/t/t1901-technicolor_-cs_--header.out b/t/t1901-technicolor_-cs_--header.out index a08916e..415ea16 100644 --- a/t/t1901-technicolor_-cs_--header.out +++ b/t/t1901-technicolor_-cs_--header.out @@ -17,4 +17,4 @@  1-2 -------<--=-|-----  -2.0 ---- --1 -------<--=-| --7.4589999998 total in 18 values (-3 min, -0.47 avg, 2 max) +-7.4589999998 total in 16 values over 18 lines (-3 min, -0.47 avg, 2 max) diff --git a/t/t1912-currency_part_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-cs.out b/t/t1912-currency_part_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-cs.out index eec7fb8..4ae6263 100644 --- a/t/t1912-currency_part_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-cs.out +++ b/t/t1912-currency_part_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-cs.out @@ -19,4 +19,4 @@ 2019-08-22 1.1083 ------------------ 2019-08-21 1.1104 ----------------------- 2019-08-20 1.1076 ----------------- -23.1939 of 6386.71270000003 total in 5373 values (0.8252 min, 1.20 avg, 1.5990 max) +23.1939 of 6386.71270000003 total in 5306 values over 5373 lines (0.8252 min, 1.20 avg, 1.5990 max) -- 2.30.0