charts.lines: add tests for drawable-chunks
parent
f366f1f790
commit
29a8b9285b
|
@ -1,6 +1,7 @@
|
||||||
! Copyright (C) 2017 Alexander Ilin.
|
! Copyright (C) 2017 Alexander Ilin.
|
||||||
|
|
||||||
USING: tools.test charts.lines charts.lines.private ;
|
USING: kernel sequences tools.test charts.lines
|
||||||
|
charts.lines.private ;
|
||||||
IN: charts.lines.tests
|
IN: charts.lines.tests
|
||||||
|
|
||||||
{ -2/3 } [ { 1 3 } { -2 5 } calc-line-slope ] unit-test
|
{ -2/3 } [ { 1 3 } { -2 5 } calc-line-slope ] unit-test
|
||||||
|
@ -22,6 +23,95 @@ IN: charts.lines.tests
|
||||||
[ { 1 } last2 ] must-fail
|
[ { 1 } last2 ] must-fail
|
||||||
[ { } last2 ] must-fail
|
[ { } last2 ] must-fail
|
||||||
|
|
||||||
|
! tight bounds
|
||||||
|
{
|
||||||
|
{ { { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } }
|
||||||
|
} [
|
||||||
|
{ { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } { 0 5 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
! loose bounds
|
||||||
|
{
|
||||||
|
{ { { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } }
|
||||||
|
} [
|
||||||
|
{ { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } { -1 6 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
! only bottom element accepted
|
||||||
|
{
|
||||||
|
{ { { 0 0 } } }
|
||||||
|
} [
|
||||||
|
{ { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } { -1 0 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
! only top element accepted
|
||||||
|
{
|
||||||
|
{ { { 2 5 } } }
|
||||||
|
} [
|
||||||
|
{ { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } { 5 10 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
! top half of the elements accepted
|
||||||
|
{
|
||||||
|
{ { { 1 2 } { 1 3 } { 2 5 } } }
|
||||||
|
} [
|
||||||
|
{ { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } { 2 10 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
! bottom half of the elements accepted
|
||||||
|
{
|
||||||
|
{ { { 0 0 } { 0 1 } { 1 2 } } }
|
||||||
|
} [
|
||||||
|
{ { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } { -2 2 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
! middle section of the elements accepted
|
||||||
|
{
|
||||||
|
{ { { 0 1 } { 1 2 } { 1 3 } } }
|
||||||
|
} [
|
||||||
|
{ { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } { 1 3 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
! two sections, including first but not last
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{ { 0 0 } { 1 2 } { 2 3 } }
|
||||||
|
{ { 5 3 } { 6 2 } { 7 0 } }
|
||||||
|
}
|
||||||
|
} [
|
||||||
|
{ { 0 0 } { 1 2 } { 2 3 } { 3 5 } { 4 5 } { 5 3 } { 6 2 } { 7 0 } { 8 -1 } { 9 -2 } } { 0 3 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
! two sections, including last but not first
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{ { 2 0 } { 3 3 } { 4 3 } }
|
||||||
|
{ { 7 3 } { 8 2 } { 9 0 } }
|
||||||
|
}
|
||||||
|
} [
|
||||||
|
{ { 0 -2 } { 1 -1 } { 2 0 } { 3 3 } { 4 3 } { 5 5 } { 6 9 } { 7 3 } { 8 2 } { 9 0 } } { 0 3 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
! single-element sequences, same x coord
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{ { 0 0 } }
|
||||||
|
{ { 0 3 } }
|
||||||
|
}
|
||||||
|
} [
|
||||||
|
{ { 0 -2 } { 0 0 } { 0 5 } { 0 3 } { 0 -1 } } { 0 3 }
|
||||||
|
drawable-chunks [ { } like ] map
|
||||||
|
] unit-test
|
||||||
|
|
||||||
{ { } }
|
{ { } }
|
||||||
[ { } { } clip-data ] unit-test
|
[ { } { } clip-data ] unit-test
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue