Closed xordspar0 closed 6 years ago
If each data point in the input is the same, asciigraph panics. This can be demonstrated simply using the command line interface:
> echo 1 1 | asciigraph panic: runtime error: index out of range goroutine 1 [running]: github.com/guptarohit/asciigraph.Plot(0xc420057c18, 0x2, 0x40, 0xc420057eb8, 0x4, 0x4, 0x17, 0x115f6c0) /home/me/go/src/github.com/guptarohit/asciigraph/asciigraph.go:92 +0x1525 main.main() /home/me/go/src/github.com/guptarohit/asciigraph/cmd/asciigraph/main.go:56 +0x5e0
I've also written a test that demonstrates it: https://github.com/xordspar0/asciigraph/commit/f02e7a51539d4db8dff95971007e1b208e30ff41
There's a division by zero when calculating the ratio at asciigraph.go:35.
If each data point in the input is the same, asciigraph panics. This can be demonstrated simply using the command line interface:
I've also written a test that demonstrates it: https://github.com/xordspar0/asciigraph/commit/f02e7a51539d4db8dff95971007e1b208e30ff41