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