factor/library/test/gadgets/rectangles.factor

48 lines
1.1 KiB
Factor
Raw Normal View History

USING: gadgets kernel namespaces test ;
2005-10-21 19:46:14 -04:00
[ << rect f @{ 10 10 0 }@ @{ 20 20 0 }@ >> ]
[
<< rect f @{ 10 10 0 }@ @{ 50 50 0 }@ >>
<< rect f @{ -10 -10 0 }@ @{ 40 40 0 }@ >>
2005-10-21 19:46:14 -04:00
intersect-rect
] unit-test
[ << rect f @{ 200 200 0 }@ @{ 0 0 0 }@ >> ]
[
<< rect f @{ 100 100 0 }@ @{ 50 50 0 }@ >>
<< rect f @{ 200 200 0 }@ @{ 40 40 0 }@ >>
2005-10-21 19:46:14 -04:00
intersect-rect
] unit-test
[ << rect f @{ -10 -10 0 }@ @{ 70 70 0 }@ >> ]
[
<< rect f @{ 10 10 0 }@ @{ 50 50 0 }@ >>
<< rect f @{ -10 -10 0 }@ @{ 40 40 0 }@ >>
union-rect
] unit-test
[ << rect f @{ 100 100 0 }@ @{ 140 140 0 }@ >> ]
[
<< rect f @{ 100 100 0 }@ @{ 50 50 0 }@ >>
<< rect f @{ 200 200 0 }@ @{ 40 40 0 }@ >>
union-rect
] unit-test
[ f ] [
<< rect f @{ 100 100 0 }@ @{ 50 50 0 }@ >>
<< rect f @{ 200 200 0 }@ @{ 40 40 0 }@ >>
intersects?
] unit-test
[ t ] [
<< rect f @{ 100 100 0 }@ @{ 50 50 0 }@ >>
<< rect f @{ 120 120 0 }@ @{ 40 40 0 }@ >>
intersects?
] unit-test
[ f ] [
<< rect f @{ 1000 100 0 }@ @{ 50 50 0 }@ >>
<< rect f @{ 120 120 0 }@ @{ 40 40 0 }@ >>
intersects?
] unit-test