>From 3fb3b71571b266ab5e105d17b8c7023956a33356 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 17 Apr 2014 23:32:09 -0300 Subject: [PATCH] Add tests/version-tests.scm Basic version tests. Check if chicken-version matches the values for C_MAJOR_VERSION/C_MINOR_VERSION and the registered chicken-. feature. --- tests/runtests.bat | 4 ++++ tests/runtests.sh | 2 ++ tests/version-tests.scm | 27 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 tests/version-tests.scm diff --git a/tests/runtests.bat b/tests/runtests.bat index 03e7684..b037cb7 100644 --- a/tests/runtests.bat +++ b/tests/runtests.bat @@ -20,6 +20,10 @@ set interpret=..\csi -n -include-path %TEST_DIR%/.. del /f /q *.exe *.so *.o *.import.* ..\foo.import.* +echo ======================================== version tests ... +%interpret% -s version-tests.scm +if errorlevel 1 exit /b 1 + echo ======================================== compiler tests ... %compile% compiler-tests.scm if errorlevel 1 exit /b 1 diff --git a/tests/runtests.sh b/tests/runtests.sh index b3570de..d2ffe72 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -70,6 +70,8 @@ interpret="../csi -n -include-path ${TEST_DIR}/.." rm -f *.exe *.so *.o *.import.* a.out ../foo.import.* +echo "======================================== version tests ..." +$interpret -s version-tests.scm echo "======================================== compiler tests ..." $compile compiler-tests.scm diff --git a/tests/version-tests.scm b/tests/version-tests.scm new file mode 100644 index 0000000..0976984 --- /dev/null +++ b/tests/version-tests.scm @@ -0,0 +1,27 @@ +(use irregex) + +(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... ") + ;; Those fudges are mapped to C_MAJOR_VERSION and C_MINOR_VERSION + (assert (= (##sys#fudge 41) major)) + (assert (= (##sys#fudge 43) minor)) + (print "ok") + + (display "Checking the registered feature chicken-.... ") + (let loop ((features (features))) + (if (null? features) + (error "Could not find feature chicken-.") + (let ((feature (symbol->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))))))) + (print "ok")) -- 1.7.10.4