@@ -72,6 +72,55 @@ class BarplotTest < Test::Unit::TestCase
7272 end
7373 end
7474
75+ sub_test_case ( "with parameters" ) do
76+ test ( "parameters1" ) do
77+ plot = UnicodePlot . barplot (
78+ [ "Paris" , "New York" , "Moskau" , "Madrid" ] ,
79+ [ 2.244 , 8.406 , 11.92 , 3.165 ] ,
80+ title : "Relative sizes of cities" ,
81+ xlabel : "population [in mil]" ,
82+ color : :blue ,
83+ margin : 7 ,
84+ padding : 3
85+ )
86+ _ , output = with_term { plot . render ( $stdout) }
87+ assert_equal ( fixture_path ( "barplot/parameters1.txt" ) . read ,
88+ output )
89+ end
90+
91+ test ( "parameters1_nolabels" ) do
92+ plot = UnicodePlot . barplot (
93+ [ "Paris" , "New York" , "Moskau" , "Madrid" ] ,
94+ [ 2.244 , 8.406 , 11.92 , 3.165 ] ,
95+ title : "Relative sizes of cities" ,
96+ xlabel : "population [in mil]" ,
97+ color : :blue ,
98+ margin : 7 ,
99+ padding : 3 ,
100+ labels : false
101+ )
102+ _ , output = with_term { plot . render ( $stdout) }
103+ assert_equal ( fixture_path ( "barplot/parameters1_nolabels.txt" ) . read ,
104+ output )
105+ end
106+
107+ test ( "parameters2" ) do
108+ plot = UnicodePlot . barplot (
109+ [ "Paris" , "New York" , "Moskau" , "Madrid" ] ,
110+ [ 2.244 , 8.406 , 11.92 , 3.165 ] ,
111+ title : "Relative sizes of cities" ,
112+ xlabel : "population [in mil]" ,
113+ color : :yellow ,
114+ border : :solid ,
115+ symbol : "=" ,
116+ width : 60
117+ )
118+ _ , output = with_term { plot . render ( $stdout) }
119+ assert_equal ( fixture_path ( "barplot/parameters2.txt" ) . read ,
120+ output )
121+ end
122+ end
123+
75124 test ( "ranges" ) do
76125 plot = UnicodePlot . barplot ( 2 ..6 , 11 ..15 )
77126 _ , output = with_term { plot . render ( $stdout) }
0 commit comments