mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-07 23:51:12 +08:00
Add barplot test
This commit is contained in:
parent
0ff8c6a9f0
commit
a0c3863b4c
153
test/fixtures/iris-bar.txt
vendored
Normal file
153
test/fixtures/iris-bar.txt
vendored
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
sepal_width
|
||||||
|
┌ ┐
|
||||||
|
5.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.5
|
||||||
|
4.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
4.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
4.6 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.6
|
||||||
|
5.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.9
|
||||||
|
4.6 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
4.4 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
4.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
5.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.7
|
||||||
|
4.8 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
4.8 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
4.3 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
5.8 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 4.0
|
||||||
|
5.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 4.4
|
||||||
|
5.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.9
|
||||||
|
5.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.5
|
||||||
|
5.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.8
|
||||||
|
5.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.8
|
||||||
|
5.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
5.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.7
|
||||||
|
4.6 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.6
|
||||||
|
5.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.3
|
||||||
|
4.8 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
5.2 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.5
|
||||||
|
5.2 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
4.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
4.8 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
5.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
5.2 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 4.1
|
||||||
|
5.5 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 4.2
|
||||||
|
4.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
5.5 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.5
|
||||||
|
4.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
4.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
5.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.5
|
||||||
|
4.5 ┤■■■■■■■■■■■■■■■■■■ 2.3
|
||||||
|
4.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.5
|
||||||
|
5.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.8
|
||||||
|
4.8 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
5.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.8
|
||||||
|
4.6 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
5.3 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.7
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.3
|
||||||
|
7.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
6.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
6.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
5.5 ┤■■■■■■■■■■■■■■■■■■ 2.3
|
||||||
|
6.5 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
5.7 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.3 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.3
|
||||||
|
4.9 ┤■■■■■■■■■■■■■■■■■■■ 2.4
|
||||||
|
6.6 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
5.2 ┤■■■■■■■■■■■■■■■■■■■■■ 2.7
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■ 2.0
|
||||||
|
5.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.0 ┤■■■■■■■■■■■■■■■■■■ 2.2
|
||||||
|
6.1 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
5.6 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
6.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
5.6 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
5.8 ┤■■■■■■■■■■■■■■■■■■■■■ 2.7
|
||||||
|
6.2 ┤■■■■■■■■■■■■■■■■■■ 2.2
|
||||||
|
5.6 ┤■■■■■■■■■■■■■■■■■■■■ 2.5
|
||||||
|
5.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
6.1 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.3 ┤■■■■■■■■■■■■■■■■■■■■ 2.5
|
||||||
|
6.1 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.4 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
6.6 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.8 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.0 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
5.7 ┤■■■■■■■■■■■■■■■■■■■■■ 2.6
|
||||||
|
5.5 ┤■■■■■■■■■■■■■■■■■■■ 2.4
|
||||||
|
5.5 ┤■■■■■■■■■■■■■■■■■■■ 2.4
|
||||||
|
5.8 ┤■■■■■■■■■■■■■■■■■■■■■ 2.7
|
||||||
|
6.0 ┤■■■■■■■■■■■■■■■■■■■■■ 2.7
|
||||||
|
5.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
6.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
6.3 ┤■■■■■■■■■■■■■■■■■■ 2.3
|
||||||
|
5.6 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
5.5 ┤■■■■■■■■■■■■■■■■■■■■ 2.5
|
||||||
|
5.5 ┤■■■■■■■■■■■■■■■■■■■■■ 2.6
|
||||||
|
6.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
5.8 ┤■■■■■■■■■■■■■■■■■■■■■ 2.6
|
||||||
|
5.0 ┤■■■■■■■■■■■■■■■■■■ 2.3
|
||||||
|
5.6 ┤■■■■■■■■■■■■■■■■■■■■■ 2.7
|
||||||
|
5.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
5.7 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
6.2 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
5.1 ┤■■■■■■■■■■■■■■■■■■■■ 2.5
|
||||||
|
5.7 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.3 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.3
|
||||||
|
5.8 ┤■■■■■■■■■■■■■■■■■■■■■ 2.7
|
||||||
|
7.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.3 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
6.5 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
7.6 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
4.9 ┤■■■■■■■■■■■■■■■■■■■■ 2.5
|
||||||
|
7.3 ┤■■■■■■■■■■■■■■■■■■■■■■■ 2.9
|
||||||
|
6.7 ┤■■■■■■■■■■■■■■■■■■■■ 2.5
|
||||||
|
7.2 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.6
|
||||||
|
6.5 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
6.4 ┤■■■■■■■■■■■■■■■■■■■■■ 2.7
|
||||||
|
6.8 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
5.7 ┤■■■■■■■■■■■■■■■■■■■■ 2.5
|
||||||
|
5.8 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
6.5 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
7.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.8
|
||||||
|
7.7 ┤■■■■■■■■■■■■■■■■■■■■■ 2.6
|
||||||
|
6.0 ┤■■■■■■■■■■■■■■■■■■ 2.2
|
||||||
|
6.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
5.6 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
7.7 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.3 ┤■■■■■■■■■■■■■■■■■■■■■ 2.7
|
||||||
|
6.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.3
|
||||||
|
7.2 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
6.2 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.1 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.4 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
7.2 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
7.4 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
7.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.8
|
||||||
|
6.4 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.3 ┤■■■■■■■■■■■■■■■■■■■■■■ 2.8
|
||||||
|
6.1 ┤■■■■■■■■■■■■■■■■■■■■■ 2.6
|
||||||
|
7.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.3 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
6.4 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
6.0 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
6.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
6.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.1
|
||||||
|
5.8 ┤■■■■■■■■■■■■■■■■■■■■■ 2.7
|
||||||
|
6.8 ┤■■■■■■■■■■■■■■■■■■■■■■■■■ 3.2
|
||||||
|
6.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.3
|
||||||
|
6.7 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.3 ┤■■■■■■■■■■■■■■■■■■■■ 2.5
|
||||||
|
6.5 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
6.2 ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■ 3.4
|
||||||
|
5.9 ┤■■■■■■■■■■■■■■■■■■■■■■■■ 3.0
|
||||||
|
└ ┘
|
@ -4,20 +4,38 @@ require "tempfile"
|
|||||||
require_relative '../test_helper'
|
require_relative '../test_helper'
|
||||||
|
|
||||||
class YouPlotCommandTest < Test::Unit::TestCase
|
class YouPlotCommandTest < Test::Unit::TestCase
|
||||||
|
def startup
|
||||||
|
end
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@ta = "ta"
|
|
||||||
@stdin = $stdin.dup
|
@stdin = $stdin.dup
|
||||||
|
$stdin = File.open(File.expand_path("../fixtures/iris.csv", __dir__), "r")
|
||||||
@stderr = $stderr.dup
|
@stderr = $stderr.dup
|
||||||
end
|
end
|
||||||
|
|
||||||
test :scatter do
|
def cleanup
|
||||||
$stdin = File.open(File.expand_path("../fixtures/iris.csv", __dir__), "r")
|
|
||||||
Tempfile.new("iris-scatter") do |tmp_file|
|
|
||||||
$stderr = tmp_file
|
|
||||||
YouPlot::Command.new(["scatter", "-H", "-d,", "-t", "IRIS"]).run
|
|
||||||
assert_equal File.read(File.expand_path("../fixtures/iris-scatter.txt", __dir__)), tmp_file.read
|
|
||||||
end
|
|
||||||
$stdin = @stdin
|
$stdin = @stdin
|
||||||
$stderr = @stderr
|
$stderr = @stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fixture(fname)
|
||||||
|
File.read(File.expand_path("../fixtures/#{fname}", __dir__))
|
||||||
|
end
|
||||||
|
|
||||||
|
test :scatter do
|
||||||
|
Tempfile.new do |tmp_file|
|
||||||
|
$stderr = tmp_file
|
||||||
|
YouPlot::Command.new(["scatter", "-H", "-d,", "-t", "IRIS"]).run
|
||||||
|
assert_equal fixture('iris-scatter.txt'), tmp_file.read
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test :barplot do
|
||||||
|
Tempfile.new do |tmp_file|
|
||||||
|
$stderr = tmp_file
|
||||||
|
YouPlot::Command.new(["barplot", "-H", "-d,", "-t", "IRIS"]).run
|
||||||
|
assert_equal fixture('iris-bar.txt'), tmp_file.read
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user