MCPcopy
hub / github.com/guptarohit/asciigraph / TestPlotMany

Function TestPlotMany

asciigraph_test.go:409–559  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

407}
408
409func TestPlotMany(t *testing.T) {
410 cases := []struct {
411 data [][]float64
412 opts []Option
413 expected string
414 }{
415 {
416 [][]float64{{0}, {1}, {2}},
417 nil,
418 `
419 2.00 ┼
420 1.00 ┼
421 0.00 ┼`},
422 {
423 [][]float64{{0, 0, 2, 2, math.NaN()}, {1, 1, 1, 1, 1, 1, 1}, {math.NaN(), math.NaN(), math.NaN(), 0, 0, 2, 2}},
424 nil,
425 `
426 2.00 ┤ ╭─╴╭─
427 1.00 ┼────│─
428 0.00 ┼─╯╶─╯`},
429 {
430 [][]float64{{0, 0, 0}, {math.NaN(), 0, 0}, {math.NaN(), math.NaN(), 0}},
431 nil,
432 ` 0.00 ┼╶╶`},
433 {
434 [][]float64{{0, 1, 0}, {2, 3, 4, 3, 2}, {4, 5, 6, 7, 6, 5, 4}},
435 []Option{Width(21), Caption("interpolation test")},
436 `
437 7.00 ┤ ╭──╮
438 6.00 ┤ ╭───╯ ╰───╮
439 5.00 ┤ ╭──╯ ╰──╮
440 4.00 ┼─╯ ╭───╮ ╰─
441 3.00 ┤ ╭──╯ ╰──╮
442 2.00 ┼─╯ ╰─╴
443 1.00 ┤ ╭───╮
444 0.00 ┼─╯ ╰╴
445 interpolation test`},
446
447 {
448 [][]float64{{0, 0}, {math.NaN(), 0}},
449 []Option{SeriesColors(Red)},
450 " 0.00 ┼╶"},
451 {
452 [][]float64{{0, 0}, {math.NaN(), 0}},
453 []Option{SeriesColors(Default, Red)},
454 " 0.00 ┼\x1b[91m╶\x1b[0m"},
455 {
456 [][]float64{{math.NaN(), 0, 2}, {0, 2}},
457 []Option{SeriesColors(Red, Red)},
458 `
459 2.00 ┤\x1b[91m╭╭\x1b[0m
460 1.00 ┤\x1b[91m││\x1b[0m
461 0.00 ┼\x1b[91m╯╯\x1b[0m`},
462 {
463 [][]float64{{0, 1, 0}, {2, 3, 4, 3, 2}},
464 []Option{SeriesColors(Red, Blue), SeriesLegends("Red", "Blue"),
465 Caption("legends with caption test")},
466 `

Callers

nothing calls this directly

Calls 9

WidthFunction · 0.85
CaptionFunction · 0.85
SeriesColorsFunction · 0.85
SeriesLegendsFunction · 0.85
YAxisValueFormatterFunction · 0.85
XAxisRangeFunction · 0.85
XAxisTickCountFunction · 0.85
PlotManyFunction · 0.85
configureFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…