Add tests for canvas and symbol options

This commit is contained in:
kojix2 2021-01-22 09:39:07 +09:00
parent f4f7267ec7
commit ac0f5d4efa
5 changed files with 93 additions and 0 deletions

View File

@ -0,0 +1,9 @@
┌ ┐
[-60.0, -40.0) ┤@@@@@@@@@@@@@@@@@@@ 1
[-40.0, -20.0) ┤@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
[-20.0, 0.0) ┤@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
[ 0.0, 20.0) ┤@@@@@@@@@@@@@@@@@@@ 1
[ 20.0, 40.0) ┤@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
[ 40.0, 60.0) ┤@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
└ ┘
Frequency

View File

@ -0,0 +1,18 @@
┌────────────────────────────────────────┐
50 │ |│
│ ., /│
│ .\ /│
│ .\ |\ .`│
│ , /\ ,`", . │
│ /|. .` . / \ | │
│ .\. .` \ / l / \ | │
│-----^r----^---r--------r--------r---|--│
│.` \. | \ / | | \ | │
│` \./ . .` |. | \ | │
│ \` |./ . . ", ,` │
│ \` \ | \ / │
│ " |` \ | │
│ / ",` │
-50 │ Y │
└────────────────────────────────────────┘
1 10

View File

@ -0,0 +1,18 @@
┌────────────────────────────────────────┐
50 │ ░│
│ ░ ░│
│ ░░ ░│
│ ░▒ ░░ ░░│
│ ░ ░░ ░░░ ░ │
│ ░░ ░░ ░ ░ ░ ░ │
│ ░▒ ░░ ░ ░ ░ ░ ░ ░ │
│░░▒░░▒░░░░░▒░░░░░░░░▒░░░░░░░░░░░░░░░░▒░░│
│░░ ░ ░ ░ ░ ░ ░ ░ ░ │
│░ ░ ░░ ░░ ░ ░ ░ ░ ░ │
│ ▒░ ░ ░ ░ ░ ░░ ░░ │
│ ░░ ░ ░ ░ ░ │
│ ░ ░░ ░ ░ │
│ ▓ ░░░ │
-50 │ █ │
└────────────────────────────────────────┘
1 10

View File

@ -0,0 +1,18 @@
┌────────────────────────────────────────┐
50 │ :│
│ . :│
│ :: :│
│ .: :: .'│
│ . :: :'. : │
│ :: .' : : : : │
│ .: .' : : : : : : │
│..:..:.....:..:.....:..:.....:..:....:..│
│.' : : : : : : : : │
│' : .' '. : : : : : │
│ :' : : : : '. .' │
│ :: : : : : │
│ ' :: : : │
│ : '.' │
-50 │ : │
└────────────────────────────────────────┘
1 10

View File

@ -212,4 +212,34 @@ class YouPlotSimpleTest < Test::Unit::TestCase
YouPlot::Command.new(['line', '--border', 'barplot']).run
assert_equal fixture('simple-lineplot-border-barplot.txt'), @stderr_file.read
end
test :line_canvas_ascii do
YouPlot::Command.new(['line', '--canvas', 'ascii']).run
assert_equal fixture('simple-lineplot-canvas-ascii.txt'), @stderr_file.read
end
test :line_canvas_braille do
YouPlot::Command.new(['line', '--canvas', 'braille']).run
assert_equal fixture('simple-lineplot.txt'), @stderr_file.read
end
test :line_canvas_density do
YouPlot::Command.new(['line', '--canvas', 'density']).run
assert_equal fixture('simple-lineplot-canvas-density.txt'), @stderr_file.read
end
test :line_canvas_dot do
YouPlot::Command.new(['line', '--canvas', 'dot']).run
assert_equal fixture('simple-lineplot-canvas-dot.txt'), @stderr_file.read
end
# test :line_canvas_block do
# YouPlot::Command.new(['line', '--canvas', 'block']).run
# assert_equal fixture('simple-lineplot-canvas-dot.txt'), @stderr_file.read
# end
test :hist_symbol_atmark do
YouPlot::Command.new(['hist', '--symbol', '@']).run
assert_equal fixture('simple-histogram-symbol-@.txt'), @stderr_file.read
end
end