From ce39b5fd65a91e241b2edbb9fd6a9a12967a064d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 15 Oct 2022 12:32:28 -0700 Subject: ref(seqstat): rewrite from go to python This is a simple script, there's no benefit in having this in go. Having it Python makes it easier to extend with panda or other libraries in the future if I need more statistics too. --- tools/seqstat/sequence_test.go | 49 ------------------------------------------ 1 file changed, 49 deletions(-) delete mode 100644 tools/seqstat/sequence_test.go (limited to 'tools/seqstat/sequence_test.go') diff --git a/tools/seqstat/sequence_test.go b/tools/seqstat/sequence_test.go deleted file mode 100644 index 1299086..0000000 --- a/tools/seqstat/sequence_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package main - -import ( - "testing" -) - -func TestHistogram(t *testing.T) { - cases := []struct { - in []float64 - histogram []rune - }{ - {[]float64{1, 2}, []rune{'▁', '█'}}, - {[]float64{1, 10, 4}, []rune{'▁', '█', '▃'}}, - {[]float64{1, 5, 22, 13, 53}, []rune{'▁', '▁', '▃', '▂', '█'}}, - } - - for _, c := range cases { - seq := newSequence(c.in) - if string(seq.histogram()) != string(c.histogram) { - t.Errorf("Not matching: got %q, want %q", string(seq.histogram()), string(c.histogram)) - } - } -} - -func TestStats(t *testing.T) { - cases := []struct { - in []float64 - min float64 - max float64 - p999 float64 - }{ - {[]float64{1, 10, 52, 12}, 1, 52, 52}, - } - - for _, c := range cases { - seq := newSequence(c.in) - if seq.min != c.min { - t.Errorf("Not matching: got min %f want %f", seq.min, c.min) - } - if seq.max != c.max { - if seq.max != c.max { - t.Errorf("Not matching: got max %f want %f", seq.max, c.max) - } - if seq.p999() != c.p999 { - t.Errorf("Not matching: got p999 %f want %f", seq.p999(), c.p999) - } - } - } -} -- cgit v1.2.3