Commit | Line | Data |
---|---|---|
4ed29c73 MV |
1 | ;;;; goops.test --- test suite for GOOPS -*- scheme -*- |
2 | ;;;; | |
bdd2c6f4 | 3 | ;;;; Copyright (C) 2001 Free Software Foundation, Inc. |
4ed29c73 MV |
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 | |
17 | ;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
18 | ;;;; Boston, MA 02111-1307 USA | |
19 | ||
20 | (use-modules (test-suite lib)) | |
21 | ||
22 | (pass-if "GOOPS loads" | |
23 | (false-if-exception | |
24 | (begin (resolve-module '(oop goops)) | |
25 | #t))) | |
26 | ||
27 | (use-modules (oop goops)) | |
28 | ||
29 | ;;; more tests here... | |
bdd2c6f4 DH |
30 | |
31 | (with-test-prefix "basic classes" | |
32 | ||
33 | (with-test-prefix "<top>" | |
34 | ||
35 | (pass-if "instance?" | |
36 | (instance? <top>)) | |
37 | ||
38 | (pass-if "class-of" | |
39 | (eq? (class-of <top>) <class>)) | |
40 | ||
41 | (pass-if "is a class?" | |
42 | (is-a? <top> <class>)) | |
43 | ||
44 | (pass-if "class-name" | |
45 | (eq? (class-name <top>) '<top>)) | |
46 | ||
47 | (pass-if "direct superclasses" | |
48 | (equal? (class-direct-supers <top>) '())) | |
49 | ||
50 | (pass-if "superclasses" | |
51 | (equal? (class-precedence-list <top>) (list <top>))) | |
52 | ||
53 | (pass-if "direct slots" | |
54 | (equal? (class-direct-slots <top>) '())) | |
55 | ||
56 | (pass-if "slots" | |
57 | (equal? (class-slots <top>) '()))) | |
58 | ||
59 | (with-test-prefix "<object>" | |
60 | ||
61 | (pass-if "instance?" | |
62 | (instance? <object>)) | |
63 | ||
64 | (pass-if "class-of" | |
65 | (eq? (class-of <object>) <class>)) | |
66 | ||
67 | (pass-if "is a class?" | |
68 | (is-a? <object> <class>)) | |
69 | ||
70 | (pass-if "class-name" | |
71 | (eq? (class-name <object>) '<object>)) | |
72 | ||
73 | (pass-if "direct superclasses" | |
74 | (equal? (class-direct-supers <object>) (list <top>))) | |
75 | ||
76 | (pass-if "superclasses" | |
77 | (equal? (class-precedence-list <object>) (list <object> <top>))) | |
78 | ||
79 | (pass-if "direct slots" | |
80 | (equal? (class-direct-slots <object>) '())) | |
81 | ||
82 | (pass-if "slots" | |
83 | (equal? (class-slots <object>) '()))) | |
84 | ||
85 | (with-test-prefix "<class>" | |
86 | ||
87 | (pass-if "instance?" | |
88 | (instance? <class>)) | |
89 | ||
90 | (pass-if "class-of" | |
91 | (eq? (class-of <class>) <class>)) | |
92 | ||
93 | (pass-if "is a class?" | |
94 | (is-a? <class> <class>)) | |
95 | ||
96 | (pass-if "class-name" | |
97 | (eq? (class-name <class>) '<class>)) | |
98 | ||
99 | (pass-if "direct superclass" | |
100 | (equal? (class-direct-supers <class>) (list <object>))))) |