Consolidate related tests

This commit is contained in:
Michael Camilleri 2022-01-21 12:58:22 +09:00
parent f2f421a0a2
commit 2f3b4c8bfb
No known key found for this signature in database
GPG Key ID: 7EB218A48DF8B572
2 changed files with 14 additions and 13 deletions

View File

@ -123,12 +123,12 @@
(defer (:close outstream)
(:write outstream "123\n")
(:write outstream "456\n"))
(def outstream (os/open "unique.txt" :r))
(defer (:close outstream)
(assert (= "123\n456\n" (string (:read outstream :all))) "File reading 1.2"))
(os/rm "unique.txt")))
# ev/gather
(assert (deep= @[1 2 3] (ev/gather 1 2 3)) "ev/gather 1")
@ -266,4 +266,13 @@
(ev/rselect c2)
(assert (= (slice arr) (slice (range 100))) "ev/chan-close 3")
# threaded channels
(def ch (ev/thread-chan 2))
(def att (ev/thread-chan 109))
(assert att "`att` was nil after creation")
(ev/give ch att)
(ev/do-thread
(assert (ev/take ch) "channel packing bug for threaded abstracts on threaded channels."))
(end-suite)

View File

@ -21,18 +21,10 @@
(import ./helper :prefix "" :exit true)
(start-suite 11)
(assert (< 11899423.08 (math/gamma 11.5) 11899423.085)
"math/gamma")
# math gamma
(assert (< 2605.1158 (math/log-gamma 500) 2605.1159)
"math/log-gamma")
(def ch (ev/thread-chan 2))
(def att (ev/thread-chan 109))
(assert att "`att` was nil after creation")
(ev/give ch att)
(ev/do-thread
(assert (ev/take ch) "channel packing bug for threaded abstracts on threaded channels."))
(assert (< 11899423.08 (math/gamma 11.5) 11899423.085) "math/gamma")
(assert (< 2605.1158 (math/log-gamma 500) 2605.1159) "math/log-gamma")
(end-suite)