merge from 1.8 branch
[bpt/guile.git] / test-suite / tests / threads.test
CommitLineData
5925aed0
KR
1;;;; threads.test --- Tests for Guile threading. -*- scheme -*-
2;;;;
6e7d5622 3;;;; Copyright 2003, 2006 Free Software Foundation, Inc.
5925aed0
KR
4;;;;
5;;;; This program is free software; you can redistribute it and/or modify
6;;;; it under the terms of the GNU General Public License as published by
7;;;; the Free Software Foundation; either version 2, or (at your option)
8;;;; any later version.
9;;;;
10;;;; This program is distributed in the hope that it will be useful,
11;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13;;;; GNU General Public License for more details.
14;;;;
15;;;; You should have received a copy of the GNU General Public License
16;;;; along with this software; see the file COPYING. If not, write to
92205699
MV
17;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18;;;; Boston, MA 02110-1301 USA
5925aed0
KR
19
20(use-modules (ice-9 threads)
21 (test-suite lib))
22
d8d925f3
MV
23(if (provided? 'threads)
24 (with-test-prefix "parallel"
25 (pass-if "no forms"
26 (call-with-values
27 (lambda ()
28 (parallel))
29 (lambda ()
30 #t)))
5925aed0 31
d8d925f3
MV
32 (pass-if "1"
33 (call-with-values
34 (lambda ()
35 (parallel 1))
36 (lambda (x)
37 (equal? x 1))))
38
39 (pass-if "1 2"
40 (call-with-values
41 (lambda ()
42 (parallel 1 2))
43 (lambda (x y)
44 (and (equal? x 1)
45 (equal? y 2)))))
46
47 (pass-if "1 2 3"
48 (call-with-values
49 (lambda ()
50 (parallel 1 2 3))
51 (lambda (x y z)
52 (and (equal? x 1)
53 (equal? y 2)
54 (equal? z 3)))))))