3(require "main.rkt" rackunit)
5;; Helper for test cases with multiple outputs
6;; See: https://stackoverflow.com/questions/41081395/unit-testing-in-racket-with-multiple-outputs
7(define-syntax check-values-equal?
9 [(_ a b) (check-equal? (call-with-values (thunk a) list) b)]))
12;; Named POSIX semaphores
14 (define test-sem-name "/test-nix-1")
16 ;; Unlink if already exists
17 (sem-unlink test-sem-name)
20 (define test-sem-p (sem-open test-sem-name (+ O_CREAT O_EXCL)))
21 (check-not-false test-sem-p)
22 (check-not-equal? test-sem-p (void))
24 (lambda () (sem-open test-sem-name (+ O_CREAT O_EXCL)))
27 (lambda () (sem-open test-sem-name (+ O_CREAT O_EXCL))))
30 (check-equal? (sem-getvalue test-sem-p) 0)
32 (check-equal? (sem-getvalue test-sem-p) 1)
34 (check-equal? (sem-getvalue test-sem-p) 0)
36 (check-equal? (sem-getvalue test-sem-p) 1)
38 (check-equal? (sem-getvalue test-sem-p) 2)
39 (sem-trywait test-sem-p)
40 (check-equal? (sem-getvalue test-sem-p) 2)
43 (check-not-false (sem-unlink test-sem-name))
44 (check-false (sem-unlink test-sem-name)))
47;; Named POSIX shared memory
49 (define test-shm-name "test-nix-mem-1")
52 (shm-unlink test-shm-name)
53 (define test-shm-fd (shm-open test-shm-name (+ O_EXCL O_CREAT O_RDWR) #o644))
54 (check > test-shm-fd 0)
55 (check-not-false (shm-unlink test-shm-name))
56 (check-false (shm-unlink test-shm-name)))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list