***************************************** preParse_Test.txt ***************************************** #preParse_Script_Test_preParse_All.txt #Test_preParse_File.txt #By D@CC #On 2023LDec01 m?a" "c}>>>m?a"&20"c} m?a' 'c}>>>m?a'&20'c} }>>>} m}>>>m} inStr}>>>inStr} m?a"b c"e}>>>m?a"b&20c"e} m?a"b"c d}>>>m?a"b"c d} m?a}>>>m?a} m?a"b}>>>m?a"b} macro_ix.py?abc"def ghi"jkl}>>>macro_ix.py?abc"def&20ghi"jkl} m n}>>>m n} macro_ix.py}>>>macro_ix.py} m?a"b c"d"e f"g}>>>m?a"b&20c"d"e&20f"g} m?a"b c"d e"f g"h}>>>m?a"b&20c"d e"f&20g"h} m?aa"bb cc"dd ee"ff gg"hh}>>>m?aa"bb&20cc"dd ee"ff&20gg"hh} # 4 10 16 22 m?nam="Ed Lo"}>>>m?nam="Ed&20Lo"} macro_ix.py?count=4,count2=2}>>>macro_ix.py?count=4,count2=2} m?nam="'JP'"}>>>m?nam="'JP'"} m?nam="'"}>>>m?nam="'"} m?nam='"'}>>>m?nam='"'} #/Test_preParse_File.txt ######################################### #Script_Test_preParse_v00.py from getSub import getSub #from getSub_v00 import getSub_v00 from preParse import preParse #from preParse_v00 import preParse_v00 from replSub import replSub #from replSub_v00 import replSub_v00 from requires import requires def Script_Test_preParse_v00(): #By: D@CC date= "2023LDec01" #Status: works well #ToDo: a only replace spaces between pairs of q='"' # ok b also do it for q="'" # ok c version of preParse() for requires() # ok d line up results when F # e document my first use of a testFile # (to validate results of examples) requires("preParse(s)") cnt=0 isAllPass=True testFileName="Script_Test_File_preParse.txt" print("31 date:"+date) print("32 scriptFileName:"+testFileName) print("rec T/F inStr} >>> result") for rec in open(testFileName): cnt+=1 #print("cnt:",cnt) r=rec.strip("\n") if not r[0:1]=="#": #if cnt==31: if True: #print("r:",r) cSq1=r.find("}",0) #print("46 cSq1:",cSq1) parm1=r[0:cSq1] #print("48 parm1{"+parm1+"}") cR1=cSq1+4 eR1=r.find("}",cR1) #print("53 eR1:",eR1) goodResult=r[cR1:eR1] #print("55 goodResult{"+goodResult+"}") #result=goodResult #this result is good #result=goodResult+" X" #this result is bad ################################################# result=preParse(parm1) #Function Being Tested ################################################# skip=8+len(parm1) if cnt<10: pre=" " # make columns line up else: pre="" if not result==goodResult: #print("65"+" "*39+"0123456789012345678901234567890") print(pre,cnt,"F {"+parm1+"} >>> {"+goodResult+"}") print(pre,cnt,"F"+" "*skip+"{"+result+"}") isAllPass=False else: print(pre,cnt,"T {"+parm1+"} >>> {"+goodResult+"}") #if end #break #if end #for end if isAllPass : print("All Passed") else : print("NOT all Passed") #def end Doh=Script_Test_preParse_v00() #/Script_Test_preParse_v00.py ######################################### Test_preParse_Result.txt fut. requires(preParse(s)) 31 date:2023LDec01 32 scriptFileName:Script_Test_File_preParse.txt rec T/F inStr} >>> result 3 T {m?a" "c} >>> {m?a"&20"c} 4 T {m?a' 'c} >>> {m?a'&20'c} 5 T {} >>> {} 6 T {m} >>> {m} 7 T {inStr} >>> {inStr} 8 T {m?a"b c"e} >>> {m?a"b&20c"e} 9 T {m?a"b"c d} >>> {m?a"b"c d} 10 T {m?a} >>> {m?a} p 61: Warning:found odd number of ' or " 11 T {m?a"b} >>> {m?a"b} 12 T {macro_ix.py?abc"def ghi"jkl} >>> {macro_ix.py?abc"def&20ghi"jkl} 13 T {m n} >>> {m n} 14 T {macro_ix.py} >>> {macro_ix.py} 15 T {m?a"b c"d"e f"g} >>> {m?a"b&20c"d"e&20f"g} 16 T {m?a"b c"d e"f g"h} >>> {m?a"b&20c"d e"f&20g"h} 17 T {m?aa"bb cc"dd ee"ff gg"hh} >>> {m?aa"bb&20cc"dd ee"ff&20gg"hh} 19 T {m?nam="Ed Lo"} >>> {m?nam="Ed&20Lo"} 20 T {macro_ix.py?count=4,count2=2} >>> {macro_ix.py?count=4,count2=2} 21 T {m?nam="'JP'"} >>> {m?nam="'JP'"} 22 T {m?nam="'"} >>> {m?nam="'"} 23 T {m?nam='"'} >>> {m?nam='"'} All Passed #/Test_preParse_Result.txt ################################################ #/Script_Test_preParse_All.txt #Script_Test_preParse_All.txt #Test_preParse_File.txt #By D@CC #On 2023LDec01 m?a" "c}>>>m?a"&20"c} m?a' 'c}>>>m?a'&20'c} }>>>} m}>>>m} inStr}>>>inStr} m?a"b c"e}>>>m?a"b&20c"e} m?a"b"c d}>>>m?a"b"c d} m?a}>>>m?a} m?a"b}>>>m?a"b} macro_ix.py?abc"def ghi"jkl}>>>macro_ix.py?abc"def&20ghi"jkl} m n}>>>m n} macro_ix.py}>>>macro_ix.py} m?a"b c"d"e f"g}>>>m?a"b&20c"d"e&20f"g} m?a"b c"d e"f g"h}>>>m?a"b&20c"d e"f&20g"h} m?aa"bb cc"dd ee"ff gg"hh}>>>m?aa"bb&20cc"dd ee"ff&20gg"hh} # 4 10 16 22 m?nam="Ed Lo"}>>>m?nam="Ed&20Lo"} macro_ix.py?count=4,count2=2}>>>macro_ix.py?count=4,count2=2} m?nam="'JP'"}>>>m?nam="'JP'"} m?nam="'"}>>>m?nam="'"} m?nam='"'}>>>m?nam='"'} #/Test_preParse_File.txt ######################################### #Script_Test_preParse_v00.py from getSub import getSub #from getSub_v00 import getSub_v00 from preParse import preParse #from preParse_v00 import preParse_v00 from replSub import replSub #from replSub_v00 import replSub_v00 from requires import requires def Script_Test_preParse_v00(): #By: D@CC date= "2023LDec01" #Status: works well #ToDo: a only replace spaces between pairs of q='"' # ok b also do it for q="'" # ok c version of preParse() for requires() # ok d line up results when F # e document my first use of a testFile # (to validate results of examples) requires("preParse(s)") cnt=0 isAllPass=True testFileName="Script_Test_File_preParse.txt" print("31 date:"+date) print("32 scriptFileName:"+testFileName) print("rec T/F inStr} >>> result") for rec in open(testFileName): cnt+=1 #print("cnt:",cnt) r=rec.strip("\n") if not r[0:1]=="#": #if cnt==31: if True: #print("r:",r) cSq1=r.find("}",0) #print("46 cSq1:",cSq1) parm1=r[0:cSq1] #print("48 parm1{"+parm1+"}") cR1=cSq1+4 eR1=r.find("}",cR1) #print("53 eR1:",eR1) goodResult=r[cR1:eR1] #print("55 goodResult{"+goodResult+"}") #result=goodResult #this result is good #result=goodResult+" X" #this result is bad ################################################# result=preParse(parm1) #Function Being Tested ################################################# skip=8+len(parm1) if cnt<10: pre=" " # make columns line up else: pre="" if not result==goodResult: #print("65"+" "*39+"0123456789012345678901234567890") print(pre,cnt,"F {"+parm1+"} >>> {"+goodResult+"}") print(pre,cnt,"F"+" "*skip+"{"+result+"}") isAllPass=False else: print(pre,cnt,"T {"+parm1+"} >>> {"+goodResult+"}") #if end #break #if end #for end if isAllPass : print("All Passed") else : print("NOT all Passed") #def end Doh=Script_Test_preParse_v00() #/Script_Test_preParse_v00.py ######################################### Test_preParse_Result.txt fut. requires(preParse(s)) 31 date:2023LDec01 32 scriptFileName:Script_Test_File_preParse.txt rec T/F inStr} >>> result 3 T {m?a" "c} >>> {m?a"&20"c} 4 T {m?a' 'c} >>> {m?a'&20'c} 5 T {} >>> {} 6 T {m} >>> {m} 7 T {inStr} >>> {inStr} 8 T {m?a"b c"e} >>> {m?a"b&20c"e} 9 T {m?a"b"c d} >>> {m?a"b"c d} 10 T {m?a} >>> {m?a} p 61: Warning:found odd number of ' or " 11 T {m?a"b} >>> {m?a"b} 12 T {macro_ix.py?abc"def ghi"jkl} >>> {macro_ix.py?abc"def&20ghi"jkl} 13 T {m n} >>> {m n} 14 T {macro_ix.py} >>> {macro_ix.py} 15 T {m?a"b c"d"e f"g} >>> {m?a"b&20c"d"e&20f"g} 16 T {m?a"b c"d e"f g"h} >>> {m?a"b&20c"d e"f&20g"h} 17 T {m?aa"bb cc"dd ee"ff gg"hh} >>> {m?aa"bb&20cc"dd ee"ff&20gg"hh} 19 T {m?nam="Ed Lo"} >>> {m?nam="Ed&20Lo"} 20 T {macro_ix.py?count=4,count2=2} >>> {macro_ix.py?count=4,count2=2} 21 T {m?nam="'JP'"} >>> {m?nam="'JP'"} 22 T {m?nam="'"} >>> {m?nam="'"} 23 T {m?nam='"'} >>> {m?nam='"'} All Passed #/Test_preParse_Result.txt ################################################ #/preParse_Test.txt