Declare function Randomlong(min as long,max as long) as long
Function Randomlong(min as long,max as long) as long
dim i,j,k as integer
dim m,tmp as long
m=rnd*25551/139
j=fix(log(min))+1
k=fix(log(max))+1
i=fix((j+k)/5)+3
do while(tmp<min or tmp>max)
randomize timer()+m
tmp=clng(rnd*(10^i))
loop
randomlong=tmp
end function
Sub Main
Dim Result As variant
dim Push_Num(1 to 9) as integer
dim oper (1 to 4) as integer
dim Push_object as string
dim i,j,k as long
dim cal_rec as variant
select case j
case 1
sqaconsolewrite "+"
result= i + k
case 2
sqaconsolewrite "-"
result = i - k
case 3
sqaconsolewrite "*"
result = i * k
case 4
sqaconsolewrite "/"
result = i / k
end select
sqaconsolewrite cstr(k)
sqaconsolewrite "正确结果应该是:" & cstr(result)
Window SetContext, "Caption=计算器", ""
Label Click, "objectindex=1"
result =sqagetproperty("Type=Label;ObjectIndex=1","Text",cal_rec)
if result = sqaSuccess then
sqaconsolewrite "计算器的结果是" & cal_rec
else
sqaconsolewrite "Failed !! "
end if
next m
End Sub