mirror of
				https://github.com/red-data-tools/YouPlot.git
				synced 2025-11-04 11:38:10 +08:00 
			
		
		
		
	Add tests for canvas and symbol options
This commit is contained in:
		
							
								
								
									
										9
									
								
								test/fixtures/simple-histogram-symbol-@.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/fixtures/simple-histogram-symbol-@.txt
									
									
									
									
										vendored
									
									
										Normal 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
 | 
				
			||||||
							
								
								
									
										18
									
								
								test/fixtures/simple-lineplot-canvas-ascii.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								test/fixtures/simple-lineplot-canvas-ascii.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					       ┌────────────────────────────────────────┐ 
 | 
				
			||||||
 | 
					    50 │                                       |│ 
 | 
				
			||||||
 | 
					       │                              .,       /│ 
 | 
				
			||||||
 | 
					       │                              .\       /│ 
 | 
				
			||||||
 | 
					       │                     .\       |\      .`│ 
 | 
				
			||||||
 | 
					       │             ,       /\      ,`",     . │ 
 | 
				
			||||||
 | 
					       │            /|.     .` .     /  \     | │ 
 | 
				
			||||||
 | 
					       │   .\.     .` \     /  l     /  \     | │ 
 | 
				
			||||||
 | 
					       │-----^r----^---r--------r--------r---|--│ 
 | 
				
			||||||
 | 
					       │.`    \.  |    \   /    |   |    \   |  │ 
 | 
				
			||||||
 | 
					       │`      \./      . .`    |.  |    \   |  │ 
 | 
				
			||||||
 | 
					       │        \`      |./      . .     ", ,`  │ 
 | 
				
			||||||
 | 
					       │                 \`      \ |      \ /   │ 
 | 
				
			||||||
 | 
					       │                 "        |`      \ |   │ 
 | 
				
			||||||
 | 
					       │                          /       ",`   │ 
 | 
				
			||||||
 | 
					   -50 │                                   Y    │ 
 | 
				
			||||||
 | 
					       └────────────────────────────────────────┘ 
 | 
				
			||||||
 | 
					       1                                       10
 | 
				
			||||||
							
								
								
									
										18
									
								
								test/fixtures/simple-lineplot-canvas-density.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								test/fixtures/simple-lineplot-canvas-density.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					       ┌────────────────────────────────────────┐ 
 | 
				
			||||||
 | 
					    50 │                                       ░│ 
 | 
				
			||||||
 | 
					       │                               ░       ░│ 
 | 
				
			||||||
 | 
					       │                              ░░       ░│ 
 | 
				
			||||||
 | 
					       │                     ░▒       ░░      ░░│ 
 | 
				
			||||||
 | 
					       │             ░       ░░       ░░░     ░ │ 
 | 
				
			||||||
 | 
					       │            ░░      ░░ ░     ░  ░     ░ │ 
 | 
				
			||||||
 | 
					       │   ░▒      ░░ ░     ░  ░     ░  ░     ░ │ 
 | 
				
			||||||
 | 
					       │░░▒░░▒░░░░░▒░░░░░░░░▒░░░░░░░░░░░░░░░░▒░░│ 
 | 
				
			||||||
 | 
					       │░░    ░   ░    ░   ░    ░   ░    ░   ░  │ 
 | 
				
			||||||
 | 
					       │░      ░ ░░    ░░  ░    ░   ░    ░   ░  │ 
 | 
				
			||||||
 | 
					       │        ▒░      ░ ░      ░ ░     ░░ ░░  │ 
 | 
				
			||||||
 | 
					       │                 ░░      ░ ░      ░ ░   │ 
 | 
				
			||||||
 | 
					       │                 ░        ░░      ░ ░   │ 
 | 
				
			||||||
 | 
					       │                          ▓       ░░░   │ 
 | 
				
			||||||
 | 
					   -50 │                                   █    │ 
 | 
				
			||||||
 | 
					       └────────────────────────────────────────┘ 
 | 
				
			||||||
 | 
					       1                                       10
 | 
				
			||||||
							
								
								
									
										18
									
								
								test/fixtures/simple-lineplot-canvas-dot.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								test/fixtures/simple-lineplot-canvas-dot.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					       ┌────────────────────────────────────────┐ 
 | 
				
			||||||
 | 
					    50 │                                       :│ 
 | 
				
			||||||
 | 
					       │                               .       :│ 
 | 
				
			||||||
 | 
					       │                              ::       :│ 
 | 
				
			||||||
 | 
					       │                     .:       ::      .'│ 
 | 
				
			||||||
 | 
					       │             .       ::       :'.     : │ 
 | 
				
			||||||
 | 
					       │            ::      .' :     :  :     : │ 
 | 
				
			||||||
 | 
					       │   .:      .' :     :  :     :  :     : │ 
 | 
				
			||||||
 | 
					       │..:..:.....:..:.....:..:.....:..:....:..│ 
 | 
				
			||||||
 | 
					       │.'    :   :    :   :    :   :    :   :  │ 
 | 
				
			||||||
 | 
					       │'      : .'    '.  :    :   :    :   :  │ 
 | 
				
			||||||
 | 
					       │        :'      : :      : :     '. .'  │ 
 | 
				
			||||||
 | 
					       │                 ::      : :      : :   │ 
 | 
				
			||||||
 | 
					       │                 '        ::      : :   │ 
 | 
				
			||||||
 | 
					       │                          :       '.'   │ 
 | 
				
			||||||
 | 
					   -50 │                                   :    │ 
 | 
				
			||||||
 | 
					       └────────────────────────────────────────┘ 
 | 
				
			||||||
 | 
					       1                                       10
 | 
				
			||||||
@@ -212,4 +212,34 @@ class YouPlotSimpleTest < Test::Unit::TestCase
 | 
				
			|||||||
    YouPlot::Command.new(['line', '--border', 'barplot']).run
 | 
					    YouPlot::Command.new(['line', '--border', 'barplot']).run
 | 
				
			||||||
    assert_equal fixture('simple-lineplot-border-barplot.txt'), @stderr_file.read
 | 
					    assert_equal fixture('simple-lineplot-border-barplot.txt'), @stderr_file.read
 | 
				
			||||||
  end
 | 
					  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
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user