Coverage report: /home/ellis/comp/core/std/tests/seq.lisp

KindCoveredAll%
expression08 0.0
branch00nil
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; seq.lisp --- Sequence Tests
2
 
3
 ;; 
4
 
5
 ;;; Code:
6
 (in-package :std/tests)
7
 (in-suite :std)
8
 
9
 (deftest vector-queue ()
10
   (let ((q (make-queue :capacity 1000 :initial-contents (make-array 10 :element-type 'fixnum :initial-element 42))))
11
     (istype 'vector-queue q)
12
     (istype 'simple-vector (data q))
13
     (dotimes (i 10)
14
       (is= 42 (try-pop-queue q)))
15
     (is (queue-empty-p* q))
16
     (let ((th (make-thread (lambda () (is= most-positive-fixnum (try-pop-queue q))))))
17
       (push-queue* most-positive-fixnum q)
18
       (join-thread th))
19
     (is (queue-empty-p q))))
20
 
21
 (deftest cons-queue ()
22
   (let ((q (make-queue)))
23
     (istype 'cons-queue q)
24
     (istype 'list (data q))
25
     (is (queue-empty-p* q))
26
     (dotimes (i 10) 
27
       (is= (push-queue i q) i)
28
       (is= (pop-queue i q) i))
29
     (is queue-empty-p* q)))
30
 
31
 (deftest spin-queue ()
32
   (let ((q (make-spin-queue)))
33
     (istype 'spin-queue q)
34
     (dotimes (i 100)
35
       (push-spin-queue i q)
36
       (is= i (spin-queue-count q))
37
       (is= i (pop-spin-queue q)))
38
     (is (spin-queue-empty-p q))))
39
 
40
 (deftest priority-queue ()
41
   (let ((q (make-queue :prioritize t)))
42
     (istype 'priority-queue q)))
43
 
44
 (deftest accumulator ()
45
   (let ((acc (make-instance 'max-accumulator)))
46
     (istype 'accumulator acc)
47
     (accumulate acc 40)
48
     (accumulate acc 32)
49
     (is= (accumulated acc) 40)
50
     (accumulate acc 2)
51
     (is= (accumulated acc) 40)))
52
 
53
 ;; TODO 2025-07-14: 
54
 (deftest iter ()
55
   (with-iter (it (make-instance 'iterator))
56
     (iszero (idx it))))