refactoring draw test
Vladimir Bauer
6 years ago
| 14 | 14 | barWidth int |
| 15 | 15 | trimSpace bool |
| 16 | 16 | reverse bool |
| 17 | rup int64 | |
| 17 | refill int64 | |
| 18 | 18 | want string |
| 19 | 19 | }{ |
| 20 | 20 | 0: { |
| 231 | 231 | want: "[------------------------------------------------------------------<===============================]", |
| 232 | 232 | }, |
| 233 | 233 | { |
| 234 | name: "t,c,rup{100,33,33}", | |
| 234 | name: "t,c,refill{100,33,33}", | |
| 235 | 235 | total: 100, |
| 236 | 236 | current: 33, |
| 237 | rup: 33, | |
| 237 | refill: 33, | |
| 238 | 238 | want: " [+++++++++++++++++++++++++++++++>----------------------------------------------------------------] ", |
| 239 | 239 | }, |
| 240 | 240 | { |
| 241 | name: "t,c,rup{100,33,33}trim", | |
| 241 | name: "t,c,refill{100,33,33}trim", | |
| 242 | 242 | total: 100, |
| 243 | 243 | current: 33, |
| 244 | rup: 33, | |
| 244 | refill: 33, | |
| 245 | 245 | trimSpace: true, |
| 246 | 246 | want: "[+++++++++++++++++++++++++++++++>------------------------------------------------------------------]", |
| 247 | 247 | }, |
| 248 | 248 | { |
| 249 | name: "t,c,rup{100,33,33}trim,rev", | |
| 249 | name: "t,c,refill{100,33,33}trim,rev", | |
| 250 | 250 | total: 100, |
| 251 | 251 | current: 33, |
| 252 | rup: 33, | |
| 252 | refill: 33, | |
| 253 | 253 | trimSpace: true, |
| 254 | 254 | reverse: true, |
| 255 | 255 | want: "[------------------------------------------------------------------<+++++++++++++++++++++++++++++++]", |
| 256 | 256 | }, |
| 257 | 257 | { |
| 258 | name: "t,c,rup{100,40,33}", | |
| 258 | name: "t,c,refill{100,40,33}", | |
| 259 | 259 | total: 100, |
| 260 | 260 | current: 40, |
| 261 | rup: 33, | |
| 261 | refill: 33, | |
| 262 | 262 | want: " [++++++++++++++++++++++++++++++++=====>----------------------------------------------------------] ", |
| 263 | 263 | }, |
| 264 | 264 | { |
| 265 | name: "t,c,rup{100,40,33}trim", | |
| 265 | name: "t,c,refill{100,40,33}trim", | |
| 266 | 266 | total: 100, |
| 267 | 267 | current: 40, |
| 268 | rup: 33, | |
| 268 | refill: 33, | |
| 269 | 269 | trimSpace: true, |
| 270 | 270 | want: "[++++++++++++++++++++++++++++++++======>-----------------------------------------------------------]", |
| 271 | 271 | }, |
| 296 | 296 | want: "[==================================================================================================]", |
| 297 | 297 | }, |
| 298 | 298 | { |
| 299 | name: "[=の-] t,c{100,100}", | |
| 299 | name: "[=の-] t,c{100,1}", | |
| 300 | 300 | style: "[=の-]", |
| 301 | 301 | total: 100, |
| 302 | 302 | current: 1, |
| 313 | 313 | s.total = tc.total |
| 314 | 314 | s.current = tc.current |
| 315 | 315 | s.trimSpace = tc.trimSpace |
| 316 | if tc.rup > 0 { | |
| 316 | if tc.refill > 0 { | |
| 317 | 317 | if f, ok := s.filler.(interface{ SetRefill(int64) }); ok { |
| 318 | f.SetRefill(tc.rup) | |
| 318 | f.SetRefill(tc.refill) | |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | tmpBuf.Reset() |