fm: remove sparc-only modules
[unleashed.git] / usr / src / lib / efcode / fcode_test / iftest.fth
blobb087cff1d1bbf4c550ea65a4d7af56685ad39f0e
1 \ #ident        "%Z%%M% %I%     %E% SMI"
2 \ Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3 \ Use is subject to license terms.
5 \ CDDL HEADER START
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
10 \ with the License.
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]
23 \ CDDL HEADER END
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: "
37 1 1 1 0 0 1 0 0
38 if      if .failed      else .failed    then space
39 else    if .failed      else .passed    then space
40 then
41 if      if .failed      else .passed    then space
42 else    if .failed      else .failed    then space
43 then
44 if      if .failed      else .failed    then space
45 else    if .passed      else .failed    then space
46 then
47 if      if .passed      else .failed    then space
48 else    if .failed      else .failed    then space
49 then
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: "
61 : if-test1 ( -- )
62    0 1 0 if
63       .failed
64    else
65       if
66          dup if .failed then
67          if .failed else .passed then
68       else
69          .failed
70       then
71    then
72 ; if-test1 space
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 -- )
79    if
80       if
81          if
82             7
83          else
84             6
85          then
86       else
87          if
88             5
89          else
90             4
91          then
92       then
93    else
94       if
95          if
96             3
97          else
98             2
99          then
100       else
101          if
102             1
103          else
104             0
105          then
106       then
107    then
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?