From 86f0baa047d92c961adb8dc8527e955d1254ad0b Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 13 Nov 2022 15:17:09 +0100 Subject: [PATCH] treat zero as non-empty spark value --- barcat | 2 +- t/t2110-spark_binary.in | 16 +++++++++++++++- t/t2110-spark_binary_--spark_--indicators=XO.out | 2 +- t/t2111-spark_unicode.in | 2 +- ...park_--indicators=-\302\267\342\200\242O.out" | 2 +- ...115-spark-oneliner_--spark_--indicators=1.out | 2 +- t/t2180-spark_combined.in | 2 +- ...k_--indicators=012345_-cs_--maxval=1_-L17.out | 2 +- 8 files changed, 22 insertions(+), 8 deletions(-) mode change 120000 => 100644 t/t2110-spark_binary.in diff --git a/barcat b/barcat index b939ea9..4d3205f 100755 --- a/barcat +++ b/barcat @@ -291,7 +291,7 @@ while ($nr <= $limit) { $val == $order[-1] ? $opt{palette}->[0] : # min $opt{palette}->[ $rel * ($#{$opt{palette}} - 1) + 1 ]; my $indicator = $opt{indicators} && $opt{indicators}->[ - !$val || !$#{$opt{indicators}} ? 0 : # blank + !length($val) || !$#{$opt{indicators}} ? 0 : # blank $#{$opt{indicators}} < 2 ? 1 : $val >= $order[0] ? -1 : $rel * ($#{$opt{indicators}} - 1e-14) + 1 diff --git a/t/t2110-spark_binary.in b/t/t2110-spark_binary.in deleted file mode 120000 index dcd72c5..0000000 --- a/t/t2110-spark_binary.in +++ /dev/null @@ -1 +0,0 @@ -t1005-float.in \ No newline at end of file diff --git a/t/t2110-spark_binary.in b/t/t2110-spark_binary.in new file mode 100644 index 0000000..3252be5 --- /dev/null +++ b/t/t2110-spark_binary.in @@ -0,0 +1,15 @@ +header: +-2 +1 +2 +0 +not 0 +0 again +3 + +8 +3 +.9 +1 +empty + diff --git a/t/t2110-spark_binary_--spark_--indicators=XO.out b/t/t2110-spark_binary_--spark_--indicators=XO.out index d25d0bd..753f76c 100644 --- a/t/t2110-spark_binary_--spark_--indicators=XO.out +++ b/t/t2110-spark_binary_--spark_--indicators=XO.out @@ -1 +1 @@ -OOOOXOOOOOOOOOXOOX +XOOOOXOOXOOOOXX diff --git a/t/t2111-spark_unicode.in b/t/t2111-spark_unicode.in index dcd72c5..cb5106f 120000 --- a/t/t2111-spark_unicode.in +++ b/t/t2111-spark_unicode.in @@ -1 +1 @@ -t1005-float.in \ No newline at end of file +t2110-spark_binary.in \ No newline at end of file diff --git "a/t/t2111-spark_unicode_--spark_--indicators=-\302\267\342\200\242O.out" "b/t/t2111-spark_unicode_--spark_--indicators=-\302\267\342\200\242O.out" index 854d335..6662c52 100644 --- "a/t/t2111-spark_unicode_--spark_--indicators=-\302\267\342\200\242O.out" +++ "b/t/t2111-spark_unicode_--spark_--indicators=-\302\267\342\200\242O.out" @@ -1 +1 @@ -···•-•••••••OO-O·- +-··•·-·•-O•··-- diff --git a/t/t2115-spark-oneliner_--spark_--indicators=1.out b/t/t2115-spark-oneliner_--spark_--indicators=1.out index 60d4268..86eb132 100644 --- a/t/t2115-spark-oneliner_--spark_--indicators=1.out +++ b/t/t2115-spark-oneliner_--spark_--indicators=1.out @@ -1 +1 @@ -111111111111111111 +111111111111111 diff --git a/t/t2180-spark_combined.in b/t/t2180-spark_combined.in index cb5106f..dcd72c5 120000 --- a/t/t2180-spark_combined.in +++ b/t/t2180-spark_combined.in @@ -1 +1 @@ -t2110-spark_binary.in \ No newline at end of file +t1005-float.in \ No newline at end of file diff --git a/t/t2180-spark_combined_--spark_--indicators=012345_-cs_--maxval=1_-L17.out b/t/t2180-spark_combined_--spark_--indicators=012345_-cs_--maxval=1_-L17.out index 777e015..be3a08b 100644 --- a/t/t2180-spark_combined_--spark_--indicators=012345_-cs_--maxval=1_-L17.out +++ b/t/t2180-spark_combined_--spark_--indicators=012345_-cs_--maxval=1_-L17.out @@ -1,2 +1,2 @@ -11230444443455052 +11234444443455052 -7.459 of -7.459 total in 16 values over 18 lines (-3 min, -0.47 avg, 2 max) -- 2.30.0