]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.profiler.sampling: assert that profile-data is created.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 13 Aug 2020 21:50:52 +0000 (14:50 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 13 Aug 2020 21:50:52 +0000 (14:50 -0700)
basis/tools/profiler/sampling/sampling-tests.factor

index 9cd91beef86d41c160c1aa9d1fd3079815022022..6493f3c9bdc22b4540f781d5ff0a2083c3983184 100644 (file)
@@ -1,6 +1,7 @@
-USING: assocs byte-arrays calendar kernel kernel.private math memory
-namespaces parser random sequences threads tools.profiler.sampling
-tools.profiler.sampling.private tools.test ;
+USING: assocs byte-arrays calendar kernel kernel.private math
+memory namespaces parser random sequences threads
+tools.profiler.sampling tools.profiler.sampling.private
+tools.test ;
 IN: tools.profiler.sampling.tests
 
 ! collect-tops: top is the last element in the array
@@ -13,12 +14,34 @@ IN: tools.profiler.sampling.tests
 TUPLE: boom ;
 { } [ 10 [ [ ] profile ] times ] unit-test
 [ 10 [ [ boom new throw ] profile ] times ] [ boom? ] must-fail-with
-{ } [ 10 [ [ 100 [ 1000 random (byte-array) drop ] times gc ] profile ] times ] unit-test
-{ } [ 10 [ [ 100 [ 1000 random (byte-array) drop ] times compact-gc ] profile ] times ] unit-test
-{ } [ 2 [ [ 1 seconds sleep ] profile ] times ] unit-test
 
-{ } [ [ 1,000,000 <iota> [ sq sq sq ] map drop ] profile flat profile. ] unit-test
-{ } [ [ 1,000,000 <iota> [ sq sq sq ] map drop ] profile top-down profile. ] unit-test
+{ t t t t t t t t t t } [
+    10 [
+        [
+            100 [ 1000 random (byte-array) >boolean t assert= ] times gc
+        ] profile raw-profile-data get-global >boolean
+    ] times
+] unit-test
+
+{ t t t t t t t t t t } [
+    10 [
+        [
+            100 [ 1000 random (byte-array) >boolean t assert= ] times compact-gc
+        ] profile raw-profile-data get-global >boolean
+    ] times
+] unit-test
+
+{ t t } [
+    2 [
+        [ 1 seconds sleep ] profile
+        raw-profile-data get-global >boolean
+    ] times
+] unit-test
+
+{ t } [
+    [ 1,000,000 <iota> [ sq sq sq ] map >boolean t assert= ] profile
+    raw-profile-data get-global >boolean
+] unit-test
 
 f raw-profile-data set-global
 gc