File: version-tests.scm

package info (click to toggle)
chicken 5.3.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,892 kB
  • sloc: ansic: 580,083; lisp: 71,987; tcl: 1,445; sh: 588; makefile: 60
file content (38 lines) | stat: -rw-r--r-- 1,754 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(import chicken.irregex chicken.platform chicken.keyword chicken.string)

(let* ((version-tokens (string-split (chicken-version) "."))
       (major (string->number (car version-tokens)))
       (minor (string->number (cadr version-tokens))))

  (display "Checking major and minor version numbers against chicken-version... ")
  (assert (= (foreign-value "C_MAJOR_VERSION" int) major))
  (assert (= (foreign-value "C_MINOR_VERSION" int) minor))
  (print "ok")

  (display "Checking the registered feature chicken-<major>.<minor>... ")
  (let loop ((features (features)))
    (if (null? features)
        (error "Could not find feature chicken-<major>.<minor>")
        (let ((feature (keyword->string (car features))))
          (cond ((irregex-match "chicken-(\\d+)\\.(\\d+)" feature)
                 => (lambda (match)
                      (assert (= (string->number
                                  (irregex-match-substring match 1))
                                 major))
                      (assert (= (string->number
                                  (irregex-match-substring match 2))
                                 minor))))
                (else (loop (cdr features)))))))

  (display "Checking the registered feature chicken-<major>... ")
  (let loop ((features (features)))
    (if (null? features)
        (error "Could not find feature chicken-<major>")
        (let ((feature (keyword->string (car features))))
          (cond ((irregex-match "chicken-(\\d+)" feature)
                 => (lambda (match)
                      (assert (= (string->number
                                  (irregex-match-substring match 1))
                                 major))))
                (else (loop (cdr features)))))))
  (print "ok"))