1*48085Sbostic(* 2*48085Sbostic * Copyright (c) 1980 The Regents of the University of California. 3*48085Sbostic * All rights reserved. 4*48085Sbostic * 5*48085Sbostic * %sccs.include.redist.c% 6*48085Sbostic * 7*48085Sbostic * @(#)setest.p 5.1 (Berkeley) 04/16/91 8*48085Sbostic *) 9*48085Sbostic 10*48085Sbosticprogram setest(input,output); 11*48085Sbostic 12*48085Sbostictype 13*48085Sbosticaset = set of 1..41; 14*48085Sbosticsint = 0 .. 30000; 15*48085Sbostic 16*48085Sbosticvar 17*48085Sbosticset1, set2 :aset; 18*48085Sbosticptr :^aset; 19*48085Sbostici :sint; 20*48085Sbostic 21*48085Sbosticbegin 22*48085Sbosticwriteln('Enter a number between 2 and 41.'); 23*48085Sbosticwriteln('Numbers 2, 10..12, 17, and 37 print "false" all others "true".'); 24*48085Sbostici := ord(input^); 25*48085Sbosticread(i); 26*48085Sbosticwriteln('i =',i:2); 27*48085Sbosticwrite('The set opcodes work :'); 28*48085Sbosticset1 := [5..15]; 29*48085Sbosticset2 := [10]; 30*48085Sbosticif set1 * [23] = [] then 31*48085Sbosticwrite(' []') 32*48085Sbosticelse 33*48085Sbosticwrite(false:6); 34*48085Sbosticif set1-set2 <> [5..9,11..15] then 35*48085Sbostic write(false:6); 36*48085Sbosticnew(ptr); 37*48085Sbosticptr^ := [2,10,37,i]; 38*48085Sbosticset1 := ptr^ - [1..3]; 39*48085Sbosticset2 := ptr^ + [10..12,17]; 40*48085Sbosticif ptr^ * set1 = set1 then 41*48085Sbostic write(' mul plus minus') 42*48085Sbosticelse 43*48085Sbostic write(false:6); 44*48085Sbosticif (17 in [10..13,15..20,25..30]) and 45*48085Sbostic (not (22 in [1..17,36..41])) then 46*48085Sbostic write(' in') 47*48085Sbosticelse 48*48085Sbostic write(false:6); 49*48085Sbosticif (set1 <> set2) and 50*48085Sbostic (set1 < set2) and 51*48085Sbostic (set2 > set1) and 52*48085Sbostic (set2 >= ptr^) and 53*48085Sbostic (set1 <= set2) and 54*48085Sbostic (set1 >= set1) and 55*48085Sbostic (set1 <= set1) and 56*48085Sbostic (card(set2) = 7) then 57*48085Sbostic write(' and rel') 58*48085Sbosticelse 59*48085Sbostic write(false:6); 60*48085Sbosticif (set1 <> set1) or 61*48085Sbostic (set2 < set1) or 62*48085Sbostic (set1 > set2) or 63*48085Sbostic (ptr^ >= set2) or 64*48085Sbostic (set2 <= set1) or 65*48085Sbostic (set1 = set2) or 66*48085Sbostic (17 in set2) then 67*48085Sbostic writeln(' or rel') 68*48085Sbosticelse 69*48085Sbostic writeln(false:6); 70*48085Sbostici := pred(i); 71*48085Sbostici := (i + i) div i; 72*48085Sbosticend. 73