From bedeeb8931bf46d163e96bc3877704e916c7af01 Mon Sep 17 00:00:00 2001 From: Raymond Date: Sun, 24 Jan 2010 22:17:06 +0000 Subject: [PATCH] Added Array test. git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@463 3f818213-9676-44b0-a9b4-5e4c4e03d09d --- trunk/Projects/PStest/unit1.lfm | 20 +++++++++-- trunk/Projects/PStest/unit1.lrs | 60 +++++++++++++++++++-------------- 2 files changed, 52 insertions(+), 28 deletions(-) diff --git a/trunk/Projects/PStest/unit1.lfm b/trunk/Projects/PStest/unit1.lfm index e83521b..da8adc7 100644 --- a/trunk/Projects/PStest/unit1.lfm +++ b/trunk/Projects/PStest/unit1.lfm @@ -19,7 +19,7 @@ object Form1: TForm1 '' 'var' ' Str,Str1,str2,str3 : String;' - ' Arr : TStringArray;' + ' Arr,Arr1,Arr2,Arr3 : TStringArray;' ' I : integer;' ' p: w_TPoint;' 'begin' @@ -53,11 +53,27 @@ object Form1: TForm1 ' Writeln(''TestStringEdit input failed.'');' ' TestArrayEdit(Arr);' ' For i := 0 to Length(arr) - 1 do' - ' Writeln(Arr[i]); ' + ' Writeln(Arr[i]);' ' Writeln(''it shouldve written: "abcd!"'');' ' Arr := TStringArray([''Dit'',''is'',''een'',''test'']);' ' TestArrayPassing(arr);' ' TestArrayPassing(TStringArray([''Dit'',''is'',''een'',''test'']));' + ' Arr1 := TStringArray([''W'',''a'',''t'']);' + ' Arr2 := TStringArray([''T'',''es'',''t'',''ing'']);' + ' Arr3 := TStringArray([''Wowing'',''!'']);' + ' Arr3 := TestArrayFull(Arr1,Arr2);' + ' Writeln(''Should writeln: Hoi Hoe Gaat Het?'');' + ' for i := 0 to high(arr1) do' + ' Writeln(arr1[i]);' + ' Writeln('''');' + ' Writeln(''Should writeln: Ik ben een geest!'');' + ' for i := 0 to high(arr2) do' + ' writeln(arr2[i]);' + ' writeln('''');' + ' Writeln(''Should writeln: Waza? Gaat alles goed'');' + ' for I := 0 to high(arr3) do' + ' Writeln(arr3[i]);' + '' 'end.' ) OnChange = Memo1Change diff --git a/trunk/Projects/PStest/unit1.lrs b/trunk/Projects/PStest/unit1.lrs index 7ff15f2..4947017 100644 --- a/trunk/Projects/PStest/unit1.lrs +++ b/trunk/Projects/PStest/unit1.lrs @@ -6,30 +6,38 @@ LazarusResources.Add('TForm1','FORMDATA',[ +'pt for Lazarus'#12'ClientHeight'#3','#1#11'ClientWidth'#3#144#1#10'LCLVersi' +'on'#6#6'0.9.29'#0#5'TMemo'#5'Memo1'#4'Left'#2#0#6'Height'#3#137#0#3'Top'#2 +'7'#5'Width'#3#144#1#5'Align'#7#8'alBottom'#13'Lines.Strings'#1#6#15'program' - +' TestPS;'#6#0#6#3'var'#6#30' Str,Str1,str2,str3 : String;'#6#21' Arr : TS' - +'tringArray;'#6#14' I : integer;'#6#14' p: w_TPoint;'#6#5'begin'#6#30' Te' - +'stParameters(1,2,3,4,5,6);'#6'1 if TestResult(1,2,3,4,5,6) = (1+2+3+4+5+6)' - +' then'#6'M Writeln(''Result = '' + inttostr(1+2+3+4+5+6) + ''. Passed th' - +'e result test'')'#6#6' else'#6'> Writeln(''Result = '' + Inttostr(Test' - +'Result(1,2,3,4,5,6)) +'#6#31' ''. Failed @ result test'');'#6#22' p :=' - +' makePoint(2,2);'#6'8 writeln(''p: '' + inttostr(p.x) + '', '' + inttostr(' - +'p.y));'#6#14' Str1 := ''l'';'#6#14' Str2 := ''o'';'#6#14' Str3 := ''l'';' - +#6'* if TestString(Str1,Str2,Str3) = ''a'' then'#6'% Writeln(''String te' - +'st succesful.'')'#6#6' else'#6'# Writeln(''String test failed.'');'#6'8' - +' if (str1 = ''l'') and (str2 = ''o'') and (str3 = ''l'') then'#6'( Writ' - +'eln(''String test passed again.'')'#6#6' else'#6'# Writeln(''String tes' - +'t failed.'');'#6#16' Str := ''Test'';'#6''' if TestStringEdit(Str) = ''ho' - +'pla'' then'#6', Writeln(''TestStringEdit result passed.'')'#6#6' else'#6 - +'- Writeln(''TestStringEdit result failed.'');'#6#22' if Str = ''tseT'' ' - +'then'#6'+ Writeln(''TestStringEdit input passed.'')'#6#6' else'#6', ' - +'Writeln(''TestStringEdit input failed.'');'#6#21' TestArrayEdit(Arr);'#6'"' - +' For i := 0 to Length(arr) - 1 do'#6#21' Writeln(Arr[i]); '#6'* Writel' - +'n(''it shouldve written: "abcd!"'');'#6'1 Arr := TStringArray([''Dit'',''i' - +'s'',''een'',''test'']);'#6#24' TestArrayPassing(arr);'#6'< TestArrayPassi' - +'ng(TStringArray([''Dit'',''is'',''een'',''test'']));'#6#4'end.'#0#8'OnChang' - +'e'#7#11'Memo1Change'#8'TabOrder'#2#0#0#0#5'TMemo'#5'Memo2'#4'Left'#2#0#6'He' - +'ight'#2'l'#3'Top'#3#192#0#5'Width'#3#144#1#5'Align'#7#8'alBottom'#8'TabOrde' - +'r'#2#1#0#0#7'TButton'#7'Button1'#4'Left'#2#0#6'Height'#2'7'#3'Top'#2#0#5'Wi' - +'dth'#3#144#1#5'Align'#7#8'alClient'#7'Caption'#6#7'Compile'#7'OnClick'#7#12 - +'Button1Click'#8'TabOrder'#2#2#0#0#0 + +' TestPS;'#6#0#6#3'var'#6#30' Str,Str1,str2,str3 : String;'#6'$ Arr,Arr1,A' + +'rr2,Arr3 : TStringArray;'#6#14' I : integer;'#6#14' p: w_TPoint;'#6#5'beg' + +'in'#6#30' TestParameters(1,2,3,4,5,6);'#6'1 if TestResult(1,2,3,4,5,6) = ' + +'(1+2+3+4+5+6) then'#6'M Writeln(''Result = '' + inttostr(1+2+3+4+5+6) + ' + +'''. Passed the result test'')'#6#6' else'#6'> Writeln(''Result = '' + ' + +'Inttostr(TestResult(1,2,3,4,5,6)) +'#6#31' ''. Failed @ result test'');' + +#6#22' p := makePoint(2,2);'#6'8 writeln(''p: '' + inttostr(p.x) + '', '' ' + +'+ inttostr(p.y));'#6#14' Str1 := ''l'';'#6#14' Str2 := ''o'';'#6#14' Str' + +'3 := ''l'';'#6'* if TestString(Str1,Str2,Str3) = ''a'' then'#6'% Writel' + +'n(''String test succesful.'')'#6#6' else'#6'# Writeln(''String test fai' + +'led.'');'#6'8 if (str1 = ''l'') and (str2 = ''o'') and (str3 = ''l'') then' + +#6'( Writeln(''String test passed again.'')'#6#6' else'#6'# Writeln(' + +'''String test failed.'');'#6#16' Str := ''Test'';'#6''' if TestStringEdit' + +'(Str) = ''hopla'' then'#6', Writeln(''TestStringEdit result passed.'')'#6 + +#6' else'#6'- Writeln(''TestStringEdit result failed.'');'#6#22' if Str' + +' = ''tseT'' then'#6'+ Writeln(''TestStringEdit input passed.'')'#6#6' e' + +'lse'#6', Writeln(''TestStringEdit input failed.'');'#6#21' TestArrayEdi' + +'t(Arr);'#6'" For i := 0 to Length(arr) - 1 do'#6#20' Writeln(Arr[i]);'#6 + +'* Writeln(''it shouldve written: "abcd!"'');'#6'1 Arr := TStringArray([''' + +'Dit'',''is'',''een'',''test'']);'#6#24' TestArrayPassing(arr);'#6'< TestA' + +'rrayPassing(TStringArray([''Dit'',''is'',''een'',''test'']));'#6'& Arr1 :=' + +' TStringArray([''W'',''a'',''t'']);'#6'- Arr2 := TStringArray([''T'',''es' + +''',''t'',''ing'']);'#6''' Arr3 := TStringArray([''Wowing'',''!'']);'#6'# ' + +'Arr3 := TestArrayFull(Arr1,Arr2);'#6'/ Writeln(''Should writeln: Hoi Hoe G' + +'aat Het?'');'#6#29' for i := 0 to high(arr1) do'#6#21' Writeln(arr1[i])' + +';'#6#14' Writeln('''');'#6'/ Writeln(''Should writeln: Ik ben een geest!' + +''');'#6#29' for i := 0 to high(arr2) do'#6#20' writeln(arr2[i]);'#6#14' ' + +' writeln('''');'#6'3 Writeln(''Should writeln: Waza? Gaat alles goed'');'#6 + +#29' for I := 0 to high(arr3) do'#6#21' Writeln(arr3[i]);'#6#0#6#4'end.' + +#0#8'OnChange'#7#11'Memo1Change'#8'TabOrder'#2#0#0#0#5'TMemo'#5'Memo2'#4'Lef' + +'t'#2#0#6'Height'#2'l'#3'Top'#3#192#0#5'Width'#3#144#1#5'Align'#7#8'alBottom' + +#8'TabOrder'#2#1#0#0#7'TButton'#7'Button1'#4'Left'#2#0#6'Height'#2'7'#3'Top' + +#2#0#5'Width'#3#144#1#5'Align'#7#8'alClient'#7'Caption'#6#7'Compile'#7'OnCli' + +'ck'#7#12'Button1Click'#8'TabOrder'#2#2#0#0#0 ]);