标题: 调不通的代码! [打印本页] 作者: lihongxin 时间: 2007-9-7 17:07 标题: 调不通的代码! 调试代码的过程中老提示:The test run cannot continue due to an unrecoverable error.
Object required: 'f'
Set fso=createobject("Scripting.Filesystemobject")
Set f=fso.opentextfile(datafile,1,false) 'readonly if it ont exist ,dom't create it.
Do While f.AtEndOfStream <> True strx=f.readline()//会提示错误
For i=1 to len(strx)
operator=mid(strx,i,1)
Select case operator
Case "+" zz=split(strx,"="):xx=zz(0):expext=zz(1)
cc=split(xx,"+"):testnumberone=cc(0):testnumbertwo=cc(1)
test_fengzhuang one,two,operator,expect
Case "-" zz=split(strx,"="):xx=zz(0):expect=zz(1)
cc=split(strx,"-"):testnumberone=cc(0):testnumbertwo=cc(1)
test_fengzhuangone,two,operator,expect
Case "*" zz=split(strx,"="):xx=zz(0):expect=zz(1)
cc=split(xx,"*"):testnumberone=cc(0):testnumbertwo=cc(1)
test_fengzhuang one,two,operator,expect
Case "/" zz=split(strx,"="):xx=zz(0):expect=zz(1)
cc=split(xx,"*"):testnumberone=cc(0):testnumbertwo=cc(1)
test_fengzhuang one,two,operator,expect
End Select
Next
num=num+1
f.close
Set f=nothing
Set fso=nothing
Loop
End Sub作者: limengyun326 时间: 2007-9-9 15:40
Sub testmain()
Dim fso1, f1,fso,f
Dim testnumberone,testnumbertwo
Const datafile="D:\calcproject\data\txt\testdata_three.txt"
Const logfile="D:\calcproject\result\testlog.txt"
Set fso1=createobject("Scripting.Filesystemobject")
Set f1=fso1.opentextFile(logfile,8,true)
Set fso=createobject("Scripting.Filesystemobject")
Set f=fso.opentextfile(datafile,1,false) 'readonly if it ont exist ,dom't create it.
Do While f.AtEndOfStream <> True strx=f.readline()//会提示错误
For i=1 to len(strx)
operator=mid(strx,i,1)
Select case operator
Case "+" zz=split(strx,"="):xx=zz(0):expext=zz(1)
cc=split(xx,"+"):testnumberone=cc(0):testnumbertwo=cc(1)
test_fengzhuang one,two,operator,expect
Case "-" zz=split(strx,"="):xx=zz(0):expect=zz(1)
cc=split(strx,"-"):testnumberone=cc(0):testnumbertwo=cc(1)
test_fengzhuangone,two,operator,expect
Case "*" zz=split(strx,"="):xx=zz(0):expect=zz(1)
cc=split(xx,"*"):testnumberone=cc(0):testnumbertwo=cc(1)
test_fengzhuang one,two,operator,expect
Case "/" zz=split(strx,"="):xx=zz(0):expect=zz(1)
cc=split(xx,"*"):testnumberone=cc(0):testnumbertwo=cc(1)
test_fengzhuang one,two,operator,expect
End Select
Next