]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/sorting/specification/specification-tests.factor
sorting.specification: add quot to sort specs for working with json etc
[factor.git] / basis / sorting / specification / specification-tests.factor
index 05fdbb8ff8576b4a353a8755939028cc5ca5aa24..84edff50866ad5bc58cc9242eb9d329ff72c6382 100644 (file)
@@ -4,6 +4,7 @@ USING: accessors math.order sorting.specification tools.test
 arrays sequences kernel assocs multiline sorting.functor ;
 IN: sorting.specification.tests
 
+
 TUPLE: sort-test a b c tuple2 ;
 
 TUPLE: tuple2 d ;
@@ -44,6 +45,25 @@ TUPLE: tuple2 d ;
     } { { a>> <=> } { b>> >=< } { c>> <=> } } sort-with-spec
 ] unit-test
 
+! Test with quotations too even though it's basically the same
+{
+    {
+        T{ sort-test { a 1 } { b 3 } { c 9 } }
+        T{ sort-test { a 1 } { b 1 } { c 10 } }
+        T{ sort-test { a 1 } { b 1 } { c 11 } }
+        T{ sort-test { a 2 } { b 5 } { c 2 } }
+        T{ sort-test { a 2 } { b 5 } { c 3 } }
+    }
+} [
+    {
+        T{ sort-test f 1 3 9 }
+        T{ sort-test f 1 1 10 }
+        T{ sort-test f 1 1 11 }
+        T{ sort-test f 2 5 3 }
+        T{ sort-test f 2 5 2 }
+    } { { [ a>> ] <=> } { [ b>> ] >=< } { [ c>> ] <=> } } sort-with-spec
+] unit-test
+
 { { } } [
     { } { { a>> <=> } { b>> >=< } { c>> <=> } } sort-with-spec
 ] unit-test