xref: /titanic_41/usr/src/lib/efcode/fcode_test/arithmetic.fth (revision c5024742c2f7d10880eae26cc592353b20a58f4a)
1\ #ident	"%Z%%M%	%I%	%E% SMI"
2\ purpose:
3\ copyright: Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
4\ copyright: Use is subject to license terms.
5\ copyright:
6\ copyright: CDDL HEADER START
7\ copyright:
8\ copyright: The contents of this file are subject to the terms of the
9\ copyright: Common Development and Distribution License, Version 1.0 only
10\ copyright: (the "License").  You may not use this file except in compliance
11\ copyright: with the License.
12\ copyright:
13\ copyright: You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14\ copyright: or http://www.opensolaris.org/os/licensing.
15\ copyright: See the License for the specific language governing permissions
16\ copyright: and limitations under the License.
17\ copyright:
18\ copyright: When distributing Covered Code, include this CDDL HEADER in each
19\ copyright: file and include the License file at usr/src/OPENSOLARIS.LICENSE.
20\ copyright: If applicable, add the following below this CDDL HEADER, with the
21\ copyright: fields enclosed by brackets "[]" replaced with your own identifying
22\ copyright: information: Portions Copyright [yyyy] [name of copyright owner]
23\ copyright:
24\ copyright: CDDL HEADER END
25\ copyright:
26
27." Simple 0 Logic Tests: "
28	" 0 invert"	0 invert		.passed?
29	" 0 0="		0 0=			.passed?
30	" -1 invert"	-1 invert 0=		.passed?
31	" 1 0<>"	1 0<>			.passed?
32	" 1 0="		1 0= invert		.passed?
33	" 1 0<>"	1 0<>			.passed?
34	" 0 0>="	0 0>=			.passed?
35	" 1 0>="	1 0>=			.passed?
36	" -1 0>="	-1 0>= invert		.passed?
37	" 1 0>"		1 0>			.passed?
38	" 0 0>"		0 0> invert		.passed?
39	" -1 0<"	-1 0<			.passed?
40	" 0 0<"		0 0< invert		.passed?
41	" 0 0<="	0 0<=			.passed?
42	" -1 0<="	-1 0<=			.passed?
43	" 1 0<="	1 0<= invert		.passed?
44cr
45
46." Positive Arithmetic Comparision Tests: "
47	" 1 0 >"	1 0 >			.passed?
48	" 1 1 >="	1 1 >=			.passed?
49	" 1 1 >"	1 1 > invert		.passed?
50	" 0 1 <"	0 1 <			.passed?
51	" 0 0 <="	0 0 <=			.passed?
52	" 1 0 <"	1 0 < invert		.passed?
53	" 0 0 ="	0 0 =			.passed?
54	" 0 1 ="	0 1 = invert		.passed?
55	" 0 1 <>"	0 1 <>			.passed?
56	" 1 1 <>"	1 1 <> invert		.passed?
57cr
58
59." Signed Comparison Tests: "
60	" -1 1 >"	-1 1 > invert		.passed?
61	" -1 -2 >"	-1 -2 >			.passed?
62	" -1 0 <"	-1 0 <			.passed?
63	" -2 -1 <"	-2 -1 <			.passed?
64cr
65
66." Unsigned Comparison Tests: "
67	" -1 0 u>"	-1 0 u>			.passed?
68	" -1 0 u>="	1 1 u>=			.passed?
69	" 1 -1 <"	2 1 >=			.passed?
70	" 0 1 >="	0 1 >= invert		.passed?
71	" 0 -1 u<"	0 -1 u<			.passed?
72	" 0 -1 u<="	0 -1 u<=		.passed?
73	" 2 -2 u<="	2 -2 u<=		.passed?
74cr
75
76." Arithmetic Tests: "
77	" 1 1 +"	1 1 + 2 =		.passed?
78	" 1 1 -"	1 1 - 0 =		.passed?
79	" 1 negate "	1 negate 1+ 0=		.passed?
80	" 0 1 -"	0 1 - -1 =		.passed?
81	" -1 abs"	-1 abs 1 =		.passed?
82	" -1 2 min"	-1 2 min 1+ 0=		.passed?
83	" 2 -1 min"	2 -1 min 1+ 0=		.passed?
84	" 3 2 max"	3 2 max 3 =		.passed?
85	" 2 3 max"	2 3 max 3 =		.passed?
86cr
87
88." Binary Logic: "
89	" 3 1 and"	3 1 and 1 =		.passed?
90	" 2 1 and"	2 1 and 0=		.passed?
91	" 1 1 or"	1 1 or 1 =		.passed?
92	" 3 1 xor"	3 1 xor 2 =		.passed?
93cr
94
95." Shifting: "
96	" (short) lshift"	h# 11 8 lshift  h# 1100 = .passed?
97	" (short) rshift"	h# 1122 8 rshift h# 11  = .passed?
98	" (long) lshift"	h# 1 d# 31 lshift 1- h# 7fffffff = .passed?
99	" (long) rshift"	h# 80 d# 24 lshift d# 31 rshift 1 = .passed?
100	" >>a"			-4 1 >>a -2 = .passed?
101cr
102
103." Sized Arithmetic Tests: "
104	" u2/"		0 0 0 h# 80 bljoin u2/ h# 4000.0000 = .passed?
105	" 2/"		-4 2/ -2 = .passed?
106	" 2*"		h# 4000.0000 dup 1 lshift swap 2* = .passed?
107	" /c"		1 /c = .passed?
108	" /w"		2 /w = .passed?
109	" /l"		4 /l = .passed?
110	" /n"		4 /n = 8 /n = or .passed?
111        " ca+"		h# 4000 3 ca+ h# 4003 = .passed?
112        " wa+"		h# 4000 3 wa+ h# 4006 = .passed?
113        " la+"		h# 4000 3 la+ h# 400c = .passed?
114	" na+"		h# 4000 3 na+ h# 4000 3 /n * + = .passed?
115	" char+"	h# 4000 char+ h# 4001 = .passed?
116	" wa1+"		h# 4000 wa1+ h# 4002 = .passed?
117	" la1+"		h# 4000 la1+ h# 4004 = .passed?
118	" cell+"	h# 4000 cell+ h# 4000 /n + = .passed?
119	" chars"	4 chars 4 = .passed?
120	" /w*"		8 /w* h# 10 = .passed?
121	" /l*"		4 /l* h# 10 = .passed?
122	" cells"	4 cells 4 /n * = .passed?
123cr
124
125." Division related Tests: "
126	" /mod (+ +)"	 5  2 /mod 2 = swap 1 = and .passed?
127	" /mod (- -)"	-5 -2 /mod 2 = swap -1 = and .passed?
128	" /mod (+ -)"	 5 -2 /mod -3 = swap -1 = and .passed?
129	" /mod (- +)"	-5  2 /mod -3 = swap 1 = and .passed?
130	" / (+ +)"	 5  2 / 2 = .passed?
131	" / (- -)"	-5 -2 / 2 = .passed?
132	" / (+ -)"	 5 -2 / -3 = .passed?
133	" / (- +)"	-5  2 / -3 = .passed?
134	" mod (+ +)"     5  2 mod 1 = .passed?
135	" mod (- -)"    -5 -2 mod -1 = .passed?
136	" mod (+ -)"     5 -2 mod -1 = .passed?
137	" mod (- +)"    -5  2 mod 1 = .passed?
138cr
139
140." Signed Multiply/Divide Tests:"
141	" * (+ +)"      2  3    *              6 = .passed?
142	" * (- +)"     -3  3    *             -9 = .passed?
143	" * (+ -)"      4 -2    *             -8 = .passed?
144	" * (- -)"     -4 -3    *             12 = .passed?
145cr
146
147." Unsigned Multiply/Divide Tests: "
148	" um*"          1 2     um*    0= swap 2 = and  .passed?
149	" um/mod"	5 0 2   um/mod 2 = swap 1 = and .passed?
150	" u/mod"	5 2     u/mod  2 = swap 1 = and .passed?
151cr
152
153." Ranged Tests: "
154	" within (!0)"		2  1 3 within .passed?
155	" within (0 hi)"	3  1 3 within 0= .passed?
156	" within (!0 lo)"	1  1 3 within .passed?
157	" within (0 >)"		0  1 3 within 0= .passed?
158	" within (0 <)"		4  1 3 within 0= .passed?
159	" within (-ve)"		0 -5 5 within .passed?
160	" within (- -)"      -7 -10 -5 within .passed?
161	" between (!0)"		2  1 3 between .passed?
162	" between (!0 lo)"	1  1 3 between .passed?
163	" between (!0 hi)"	3  1 3 between .passed?
164	" between (0 >)"	4  1 3 between 0= .passed?
165	" between (0 <)"	0  1 3 between 0= .passed?
166	" between (-ve)"	0 -5 5 between .passed?
167	" between (- -)"     -7 -10 -5 between .passed?
168	" bounds"		-1 3 bounds -1 = swap 2 = and .passed?
169cr
170
171." Double Arithmetic: "
172	" d+"       1 2 3 4 d+ 6 = swap 4 = and .passed?
173	" d-"       3 4 2 1 d- 3 = swap 1 = and .passed?
174cr
175