]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/math/statistics/statistics-tests.factor
math.statistics: refactor histogram and histogram-by to use
[factor.git] / basis / math / statistics / statistics-tests.factor
index 0166d577e316569cc6067ad998cd9864509aad8c..1595d3ab6cd3e0d17f77a2e2b9c42dc6d1eb08f7 100644 (file)
@@ -104,12 +104,31 @@ IN: math.statistics
 
 {
     H{
-        { 97 2 }
+        { 97 5 }
         { 98 2 }
         { 99 2 }
     }
 } [
     "aabbcc" histogram
+    "aaa" histogram!
+] unit-test
+
+{
+    H{
+        { 97 5 }
+        { 98 2 }
+        { 99 2 }
+    }
+} [
+    "aabbcc" [ ] histogram-by
+    "aaa" [ ] histogram-by!
+] unit-test
+
+{
+    H{ { t 2 } { f 7 } }
+} [
+    "aabbcc" [ even? ] histogram-by
+    "aaa" [ even? ] histogram-by!
 ] unit-test
 
 { H{ { 1 1/2 } { 2 1/6 } { 3 1/3 } } }