]> gitweb.factorcode.org Git - factor.git/commitdiff
charts.lines: add tests for fix-right-chunk, fix implementation
authorAlexander Iljin <ajsoft@yandex.ru>
Thu, 19 Jan 2017 10:28:49 +0000 (13:28 +0300)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 17 Apr 2017 20:54:51 +0000 (13:54 -0700)
lines/lines-tests.factor
lines/lines.factor

index 129e8f3f309b5e25b5f07a70ed0b5c6d6f36093f..43c888e1aaeab5296a031e4555c1a125b3e22280 100644 (file)
@@ -79,6 +79,38 @@ IN: charts.lines.tests
     -3 3 fix-left-chunk
 ] unit-test
 
+! fix-right-chunk: y coord = top limit
+{
+    { { 5 3 } { 6 0 } }
+} [
+    { { -6 6 } { -3 4 } } { { 5 3 } { 6 0 } }
+    -3 3 fix-right-chunk
+] unit-test
+
+! fix-right-chunk: y coord = bottom limit
+{
+    { { 5 -3 } { 6 0 } }
+} [
+    { { -6 -6 } { -3 -4 } } { { 5 -3 } { 6 0 } }
+    -3 3 fix-right-chunk
+] unit-test
+
+! fix-right-chunk: going upwards
+{
+    { { -3 -3 } { -2 -2 } { 6 0 } }
+} [
+    { { -6 -6 } { -4 -4 } } { { -2 -2 } { 6 0 } }
+    -3 3 fix-right-chunk
+] unit-test
+
+! fix-right-chunk: going downwards
+{
+    { { -3 3 } { -2 2 } { 6 0 } }
+} [
+    { { -6 6 } { -4 4 } } { { -2 2 } { 6 0 } }
+    -3 3 fix-right-chunk
+] unit-test
+
 ! tight bounds
 {
     { { { 0 0 } { 0 1 } { 1 2 } { 1 3 } { 2 5 } } }
index 9753b80b2c001c27670441a3162a505ffe2db4f7..da0946863fd8efc4cbc7c299ad5dbedfb495aac7 100644 (file)
@@ -154,7 +154,7 @@ ALIAS: y second
             left-point right-point calc-line-slope
             y-coord left-point calc-point-y
         ] if
-        right rest-slice swap suffix
+        right swap prefix
     ] if ;
 
 : first-point ( chunks -- first-point ) first first ;