1 \ #ident "%Z%%M% %I% %E% SMI"
2 \ Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 \ Use is subject to license terms.
7 \ The contents of this file are subject to the terms of the
8 \ Common Development and Distribution License, Version 1.0 only
9 \ (the "License"). You may not use this file except in compliance
12 \ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13 \ or http://www.opensolaris.org/os/licensing.
14 \ See the License for the specific language governing permissions
15 \ and limitations under the License.
17 \ When distributing Covered Code, include this CDDL HEADER in each
18 \ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19 \ If applicable, add the following below this CDDL HEADER, with the
20 \ fields enclosed by brackets "[]" replaced with your own identifying
21 \ information: Portions Copyright [yyyy] [name of copyright owner]
26 cr ." Simple interpreted IF THEN test: "
27 1 if .passed then space
28 0 if .failed then space
31 ." Simple interpreted IF ELSE THEN test: "
32 0 if .failed else .passed then space
33 1 if .passed else .failed then space
36 ." Nested interpreted IF test: "
38 if if .failed else .failed then space
39 else if .failed else .passed then space
41 if if .failed else .passed then space
42 else if .failed else .failed then space
44 if if .failed else .failed then space
45 else if .passed else .failed then space
47 if if .passed else .failed then space
48 else if .failed else .failed then space
52 ." Compiled single IF tests:" space
53 : if-true? if .passed space 0 exit then .failed space 0 ; 1 if-true?
54 : if-false? if .failed space 1 exit then .passed space 1 ; if-false?
55 : true? if .passed else .failed then space 0 ; true?
56 : false? if .failed else .passed then space ; false?
60 ." Nested compiled IF test: "
67 if .failed else .passed then
74 : .passed? ( str,len flag )
75 if if then if then .passed space else cr type space .failed cr then
78 : if-test2 ( x x x -- )
110 " if-test2.0" 0 0 0 if-test2 0 = .passed?
111 " if-test2.1" 1 0 0 if-test2 1 = .passed?
112 " if-test2.2" 0 1 0 if-test2 2 = .passed?
113 " if-test2.3" 1 1 0 if-test2 3 = .passed?
114 " if-test2.4" 0 0 1 if-test2 4 = .passed?
115 " if-test2.5" 1 0 1 if-test2 5 = .passed?
116 " if-test2.6" 0 1 1 if-test2 6 = .passed?
117 " if-test2.7" 1 1 1 if-test2 7 = .passed?