mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-05 22:31:11 +08:00
Fix order of tests
This commit is contained in:
parent
2005eaf871
commit
72f59887de
@ -15,8 +15,10 @@ module YouPlot
|
||||
arr.value_counts(dropna: false)
|
||||
end
|
||||
.sort do |a, b|
|
||||
r = b[1] <=> a[1] # compare values
|
||||
r = a[0] <=> b[0] if r == 0 # If the values are the same, compare by name
|
||||
# compare values
|
||||
r = b[1] <=> a[1]
|
||||
# If the values are the same, compare by name
|
||||
r = a[0] <=> b[0] if r == 0
|
||||
r
|
||||
end
|
||||
.transpose
|
||||
|
@ -34,19 +34,14 @@ class YouPlotIRISTest < Test::Unit::TestCase
|
||||
File.read(File.expand_path("../fixtures/#{fname}", __dir__))
|
||||
end
|
||||
|
||||
test :bar do
|
||||
YouPlot::Command.new(['bar', '-H', '-d,', '-t', 'IRIS-BARPLOT']).run
|
||||
assert_equal fixture('iris-barplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :barplot do
|
||||
YouPlot::Command.new(['barplot', '-H', '-d,', '-t', 'IRIS-BARPLOT']).run
|
||||
assert_equal fixture('iris-barplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :hist do
|
||||
YouPlot::Command.new(['hist', '-H', '-d,', '-t', 'IRIS-HISTOGRAM']).run
|
||||
assert_equal fixture('iris-histogram.txt'), @stderr_file.read
|
||||
test :bar do
|
||||
YouPlot::Command.new(['bar', '-H', '-d,', '-t', 'IRIS-BARPLOT']).run
|
||||
assert_equal fixture('iris-barplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :histogram do
|
||||
@ -54,9 +49,9 @@ class YouPlotIRISTest < Test::Unit::TestCase
|
||||
assert_equal fixture('iris-histogram.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :line do
|
||||
YouPlot::Command.new(['line', '-H', '-d,', '-t', 'IRIS-LINEPLOT']).run
|
||||
assert_equal fixture('iris-lineplot.txt'), @stderr_file.read
|
||||
test :hist do
|
||||
YouPlot::Command.new(['hist', '-H', '-d,', '-t', 'IRIS-HISTOGRAM']).run
|
||||
assert_equal fixture('iris-histogram.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :lineplot do
|
||||
@ -64,9 +59,9 @@ class YouPlotIRISTest < Test::Unit::TestCase
|
||||
assert_equal fixture('iris-lineplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :lines do
|
||||
YouPlot::Command.new(['lines', '-H', '-d,', '-t', 'IRIS-LINEPLOTS']).run
|
||||
assert_equal fixture('iris-lineplots.txt'), @stderr_file.read
|
||||
test :line do
|
||||
YouPlot::Command.new(['line', '-H', '-d,', '-t', 'IRIS-LINEPLOT']).run
|
||||
assert_equal fixture('iris-lineplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :lineplots do
|
||||
@ -74,9 +69,9 @@ class YouPlotIRISTest < Test::Unit::TestCase
|
||||
assert_equal fixture('iris-lineplots.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :s do
|
||||
YouPlot::Command.new(['s', '-H', '-d,', '-t', 'IRIS-SCATTER']).run
|
||||
assert_equal fixture('iris-scatter.txt'), @stderr_file.read
|
||||
test :lines do
|
||||
YouPlot::Command.new(['lines', '-H', '-d,', '-t', 'IRIS-LINEPLOTS']).run
|
||||
assert_equal fixture('iris-lineplots.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :scatter do
|
||||
@ -84,9 +79,9 @@ class YouPlotIRISTest < Test::Unit::TestCase
|
||||
assert_equal fixture('iris-scatter.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :d do
|
||||
YouPlot::Command.new(['d', '-H', '-d,', '-t', 'IRIS-DENSITY']).run
|
||||
assert_equal fixture('iris-density.txt'), @stderr_file.read
|
||||
test :s do
|
||||
YouPlot::Command.new(['s', '-H', '-d,', '-t', 'IRIS-SCATTER']).run
|
||||
assert_equal fixture('iris-scatter.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :density do
|
||||
@ -94,9 +89,9 @@ class YouPlotIRISTest < Test::Unit::TestCase
|
||||
assert_equal fixture('iris-density.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :box do
|
||||
YouPlot::Command.new(['box', '-H', '-d,', '-t', 'IRIS-BOXPLOT']).run
|
||||
assert_equal fixture('iris-boxplot.txt'), @stderr_file.read
|
||||
test :d do
|
||||
YouPlot::Command.new(['d', '-H', '-d,', '-t', 'IRIS-DENSITY']).run
|
||||
assert_equal fixture('iris-density.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :boxplot do
|
||||
@ -104,6 +99,11 @@ class YouPlotIRISTest < Test::Unit::TestCase
|
||||
assert_equal fixture('iris-boxplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :box do
|
||||
YouPlot::Command.new(['box', '-H', '-d,', '-t', 'IRIS-BOXPLOT']).run
|
||||
assert_equal fixture('iris-boxplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
# test :c do
|
||||
# YouPlot::Command.new(['count', '-H', '-d,']).run
|
||||
# assert_equal fixture('iris-count.txt'), @stderr_file.read
|
||||
|
@ -34,11 +34,8 @@ class YouPlotSimpleTest < Test::Unit::TestCase
|
||||
File.read(File.expand_path("../fixtures/#{fname}", __dir__))
|
||||
end
|
||||
|
||||
test :bar do
|
||||
assert_raise(ArgumentError) do
|
||||
YouPlot::Command.new(['bar']).run
|
||||
end
|
||||
end
|
||||
# Single command
|
||||
# The goal is to verify that the command works without any options.
|
||||
|
||||
test :barplot do
|
||||
assert_raise(ArgumentError) do
|
||||
@ -46,9 +43,10 @@ class YouPlotSimpleTest < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test :hist do
|
||||
YouPlot::Command.new(['hist']).run
|
||||
assert_equal fixture('simple-histogram.txt'), @stderr_file.read
|
||||
test :bar do
|
||||
assert_raise(ArgumentError) do
|
||||
YouPlot::Command.new(['bar']).run
|
||||
end
|
||||
end
|
||||
|
||||
test :histogram do
|
||||
@ -56,9 +54,9 @@ class YouPlotSimpleTest < Test::Unit::TestCase
|
||||
assert_equal fixture('simple-histogram.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :line do
|
||||
YouPlot::Command.new(['line']).run
|
||||
assert_equal fixture('simple-lineplot.txt'), @stderr_file.read
|
||||
test :hist do
|
||||
YouPlot::Command.new(['hist']).run
|
||||
assert_equal fixture('simple-histogram.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :lineplot do
|
||||
@ -66,10 +64,9 @@ class YouPlotSimpleTest < Test::Unit::TestCase
|
||||
assert_equal fixture('simple-lineplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :lines do
|
||||
assert_raise(YouPlot::Backends::UnicodePlot::Error) do
|
||||
YouPlot::Command.new(['lines']).run
|
||||
end
|
||||
test :line do
|
||||
YouPlot::Command.new(['line']).run
|
||||
assert_equal fixture('simple-lineplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :lineplots do
|
||||
@ -78,9 +75,9 @@ class YouPlotSimpleTest < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test :s do
|
||||
test :lines do
|
||||
assert_raise(YouPlot::Backends::UnicodePlot::Error) do
|
||||
YouPlot::Command.new(['s']).run
|
||||
YouPlot::Command.new(['lines']).run
|
||||
end
|
||||
end
|
||||
|
||||
@ -90,9 +87,9 @@ class YouPlotSimpleTest < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test :d do
|
||||
test :s do
|
||||
assert_raise(YouPlot::Backends::UnicodePlot::Error) do
|
||||
YouPlot::Command.new(['d']).run
|
||||
YouPlot::Command.new(['s']).run
|
||||
end
|
||||
end
|
||||
|
||||
@ -102,9 +99,10 @@ class YouPlotSimpleTest < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test :box do
|
||||
YouPlot::Command.new(['box']).run
|
||||
assert_equal fixture('simple-boxplot.txt'), @stderr_file.read
|
||||
test :d do
|
||||
assert_raise(YouPlot::Backends::UnicodePlot::Error) do
|
||||
YouPlot::Command.new(['d']).run
|
||||
end
|
||||
end
|
||||
|
||||
test :boxplot do
|
||||
@ -112,9 +110,9 @@ class YouPlotSimpleTest < Test::Unit::TestCase
|
||||
assert_equal fixture('simple-boxplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :c do
|
||||
YouPlot::Command.new(['count']).run
|
||||
assert_equal fixture('simple-count.txt'), @stderr_file.read
|
||||
test :box do
|
||||
YouPlot::Command.new(['box']).run
|
||||
assert_equal fixture('simple-boxplot.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :count do
|
||||
@ -122,6 +120,11 @@ class YouPlotSimpleTest < Test::Unit::TestCase
|
||||
assert_equal fixture('simple-count.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :c do
|
||||
YouPlot::Command.new(['count']).run
|
||||
assert_equal fixture('simple-count.txt'), @stderr_file.read
|
||||
end
|
||||
|
||||
test :plot_output_stdout do
|
||||
YouPlot::Command.new(['line', '-o']).run
|
||||
assert_equal '', @stderr_file.read
|
||||
|
Loading…
Reference in New Issue
Block a user