uTestCommon.pas
上传用户:yjb1804
上传日期:2021-01-30
资源大小:3105k
文件大小:1k
- unit uTestCommon;
- interface
- uses Classes,uCommon,TestFramework;
- type
- TTestCommon=class(TTestCase)
- published
- procedure TestStrBeginWith1;
- procedure TestStrEndWith1;
- procedure TestStrBeginWith2;
- procedure TestStrEndWith2;
- procedure TestStrBeginWith3;
- procedure TestStrEndWith3;
- procedure TestPartStr1;
- procedure TestPartStr2;
- end;
- implementation
- { TTestCommon }
- procedure TTestCommon.TestPartStr1;
- begin
- CheckEqualsString('abs',PartStr('abs123','12',False),'PartStr');
- end;
- procedure TTestCommon.TestPartStr2;
- begin
- CheckEqualsString('abs',PartStr('123abs','23',True),'PartStr');
- end;
- procedure TTestCommon.TestStrBeginWith1;
- begin
- CheckEquals(True,StrBeginWith('ab1','ab1234'),'StrBeginWith Error');
- end;
- procedure TTestCommon.TestStrBeginWith2;
- begin
- CheckEquals(True,StrBeginWith('ab1','ab1234'),'StrBeginWith Error');
- end;
- procedure TTestCommon.TestStrBeginWith3;
- begin
- CheckEquals(False,StrBeginWith('aa','a'),'StrBeginWith Error');
- end;
- procedure TTestCommon.TestStrEndWith1;
- begin
- CheckEquals(False,StrEndWith('234','ab1234'),'StrEndWith Error');
- end;
- procedure TTestCommon.TestStrEndWith2;
- begin
- CheckEquals(True,StrEndWith(#32#32,'234ab1'#32#32),'StrBeginWith Error');
- end;
- procedure TTestCommon.TestStrEndWith3;
- begin
- CheckEquals(True,StrEndWith(#$D#$A,'aa'#$D#$A),'StrEndWith Error');
- end;
- initialization
- TestFramework.RegisterTest(TTestCommon.Suite );
- end.