1
0
mirror of synced 2024-09-19 01:36:08 +00:00

Added: DUnit tests for X2UtBits

This commit is contained in:
Mark van Renswoude 2004-09-20 12:01:08 +00:00
parent 39eda1a4a5
commit 7c1d749af9
4 changed files with 302 additions and 0 deletions

92
UnitTests/Units/UBits.pas Normal file
View File

@ -0,0 +1,92 @@
unit UBits;
interface
uses
TestFramework;
type
TBitsTest = class(TTestCase)
published
procedure testGet();
procedure testSet();
procedure testCombine();
procedure testBitsToString();
procedure testStringToBits();
end;
implementation
uses
X2UtBits;
const
BitsTest = [bit1, bit2, bit4, bit7];
BitsValue = 150;
BitsString = '10010110';
{ TBitsTest }
procedure TBitsTest.testGet;
var
bValue: Byte;
eBits: T8Bits absolute bValue;
begin
bValue := BitsValue;
Check(eBits = BitsTest, 'Bits do not match the value!');
end;
procedure TBitsTest.testSet;
var
bValue: Byte;
eBits: T8Bits absolute bValue;
begin
eBits := BitsTest;
Check(bValue = BitsValue, 'Value does not match the bits!');
end;
procedure TBitsTest.testCombine;
var
eBits1: T8Bits;
eBits2: T8Bits;
bValue: Byte absolute eBits1;
begin
eBits1 := [bit1, bit7];
eBits2 := [bit2, bit4];
eBits1 := eBits1 + eBits2;
Check(bValue = BitsValue, 'Value does not match the bits!');
end;
procedure TBitsTest.testBitsToString;
var
eBits: T8Bits;
sValue: String;
begin
eBits := BitsTest;
sValue := BitsToString(eBits, bs8);
Check(sValue = BitsString, 'Bits do not match the string!');
end;
procedure TBitsTest.testStringToBits;
var
eBits: T8Bits;
sValue: String;
begin
sValue := BitsString;
eBits := StringToBits(sValue);
Check(eBits = BitsTest, 'String does not match the bits!');
end;
initialization
RegisterTest(TBitsTest.Suite);
end.

View File

@ -0,0 +1,35 @@
-$A8
-$B-
-$C+
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J+
-$K-
-$L+
-$M-
-$N+
-$O+
-$P+
-$Q-
-$R+
-$S-
-$T-
-$U-
-$V+
-$W-
-$X+
-$YD
-$Z1
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-LE"c:\delphi6\Projects\Bpl"
-LN"c:\delphi6\Projects\Bpl"

164
UnitTests/X2UtUnitTests.dof Normal file
View File

@ -0,0 +1,164 @@
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=1
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=1
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=vcl;rtl;dbrtl;vcldb;vclx;dss;dsnapcrba;dsnapcon;inetdb;webdsnap;websnap;dbxcds;Irc;parsdpk;hotspotter
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=ip-to-country.csv countries.csv geo.db
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1043
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[Excluded Packages]
C:\Delphi6\Bin\dcldb60.bpl=Borland Database Components
C:\Program Files\madCollection\madBasic\Delphi 6\madHelp_.bpl=madHelp 1.1 · www.madshi.net
c:\delphi6\Projects\Bpl\X2CompsD6.bpl=X²Software Components - Designtime
c:\delphi6\Projects\Bpl\VirtualTreesD6D.bpl=Virtual Treeview
c:\delphi6\Bin\dcl31w60.bpl=Delphi 1.0 Compatibility Components
c:\delphi6\Bin\dclact60.bpl=Borland ActionBar Components
c:\delphi6\Bin\applet60.bpl=Borland Control Panel Applet Package
C:\Delphi6\Bin\dbx60.bpl=Borland SQL Explorer UI Package
C:\Delphi6\Projects\Bpl\tb2k_d6.bpl=Toolbar2000 Components (Jordan Russell)
c:\delphi6\Projects\Bpl\tb2kdsgn_d6.bpl=Toolbar2000 Design Package (Jordan Russell)
c:\delphi6\Bin\DCLNMF60.bpl=NetMasters Fastnet Tools
c:\delphi6\Bin\dclado60.bpl=Borland ADO DB Components
c:\delphi6\Bin\dclclxdb60.bpl=Borland CLX Database Components
C:\Delphi6\Bin\dclclxstd60.bpl=Borland CLX Standard Components
c:\delphi6\Bin\dclie60.bpl=Internet Explorer Components
C:\Delphi6\Projects\Bpl\aSQLitepkg.bpl=Aducom Software -- SQLite RunTime Components
c:\delphi6\Projects\Bpl\asqlite.bpl=Aducom Software -- SQLite Design Time Components
c:\delphi6\Projects\Bpl\PCtrlExd6.bpl=PageControlEx
c:\delphi6\Projects\Bpl\JvCoreD6D.bpl=JVCL Core Components
c:\delphi6\Projects\Bpl\JvSystemD6D.bpl=JVCL System Components
c:\delphi6\Projects\Bpl\JvStdCtrlsD6D.bpl=JVCL Standard Controls
c:\delphi6\Projects\Bpl\JvCtrlsD6D.bpl=JVCL Visual Controls
c:\delphi6\Projects\Bpl\JvCmpD6D.bpl=JVCL Non-Visual Components
c:\delphi6\Projects\Bpl\JvCustomD6D.bpl=JVCL Custom Controls
c:\delphi6\Projects\Bpl\JvDlgsD6D.bpl=JVCL Dialog Components
c:\delphi6\Projects\Bpl\JvCryptD6D.bpl=JVCL Encryption and Compression Components
c:\delphi6\Projects\Bpl\JvMMD6D.bpl=JVCL Multimedia and Image Components
c:\delphi6\Projects\Bpl\JvNetD6D.bpl=JVCL Network Components
c:\delphi6\Projects\Bpl\JvAppFrmD6D.bpl=JVCL Application and Form Components
c:\delphi6\Projects\Bpl\JvDBD6D.bpl=JVCL Database Components
c:\delphi6\Projects\Bpl\JvBDED6D.bpl=JVCL BDE Components
c:\delphi6\Projects\Bpl\JvInterpreterD6D.bpl=JVCL Interpreter Components
c:\delphi6\Projects\Bpl\JvBandsD6D.bpl=JVCL Band Objects
c:\delphi6\Projects\Bpl\JvPluginD6D.bpl=JVCL Plugin Components
c:\delphi6\Projects\Bpl\JvJansD6D.bpl=JVCL Jans Components
c:\delphi6\Projects\Bpl\JvGlobusD6D.bpl=JVCL Globus Components
c:\delphi6\Projects\Bpl\JvPrintPreviewD6D.bpl=JVCL Print Preview Components
c:\delphi6\Projects\Bpl\JvPageCompsD6D.bpl=JVCL Page Style Components
c:\delphi6\Projects\Bpl\JvValidatorsD6D.bpl=JVCL Validators and Error Provider Components
c:\delphi6\Projects\Bpl\JvUIBD6D.bpl=JVCL Unified Interbase Components
c:\delphi6\Projects\Bpl\JvWizardD6D.bpl=JVCL Wizard Design Time Package
c:\delphi6\Projects\Bpl\JvTimeFrameworkD6D.bpl=JVCL Time Framework
c:\delphi6\Projects\Bpl\JvHMID6D.bpl=JVCL HMI Controls design time unit
c:\delphi6\Projects\Bpl\JvManagedThreadsD6D.bpl=JVCL Managed Threads
c:\delphi6\Projects\Bpl\JvXPCtrlsD6D.bpl=JVCL XP Controls
c:\delphi6\Projects\Bpl\JvDockingD6D.bpl=JVCL Docking Components
c:\delphi6\Projects\Bpl\JvDotNetCtrlsD6D.bpl=JVCL DotNet Controls
c:\delphi6\Projects\Bpl\dclIndyCore60.bpl=Indy 10 Core Design Time
c:\delphi6\Projects\Bpl\dclIndyProtocols60.bpl=Indy 10 Protocols Design Time
c:\delphi6\Projects\Bpl\SysILS.bpl=System ImageList
c:\delphi6\Projects\Bpl\DragDropD6.bpl=Drag and Drop Component Suite
C:\Projects\Components\DevExpress\OrgChart Suite\Lib\dcldxOrgCD6.bpl=ExpressOrgChart by Developer Express Inc.
C:\Projects\Components\DevExpress\OrgChart Suite\Lib\dcldxDBOrD6.bpl=ExpressDBOrgChart by Developer Express Inc.
c:\delphi6\Projects\Bpl\BalloonD6.bpl=Balloon 2.0
c:\delphi6\Projects\Bpl\DIPasDocD6.bpl=DiPasDoc - Designtime
C:\Delphi6\Projects\Bpl\DIContainers_D6.bpl=The Delphi Inspiration -- DIContainers
c:\delphi6\Bin\dclshlctrls60.bpl=Shell Control Property and Component Editors
c:\delphi6\Bin\dclsmp60.bpl=Borland Sample Components
c:\delphi6\Bin\dclbde60.bpl=Borland BDE DB Components
c:\delphi6\Bin\dclcds60.bpl=Borland Base Cached ClientDataset Component
C:\Delphi6\Bin\dclmid60.bpl=Borland MyBase DataAccess Components
c:\delphi6\Bin\dclbdecds60.bpl=Borland Local BDE ClientDataset Components
c:\delphi6\Bin\dclib60.bpl=InterBase Data Access Components
c:\delphi6\Bin\DBWEBXPRT.BPL=Borland Web Wizard Package
c:\delphi6\Bin\dcloffice2k60.bpl=Microsoft Office 2000 Sample Automation Server Wrapper Components
c:\delphi6\Bin\dcltee60.bpl=TeeChart Components
c:\delphi6\Bin\dcltqr60.bpl=TeeChart for QuickReport Components
c:\delphi6\Bin\dclnet60.bpl=Borland Internet Components
c:\delphi6\Bin\dclite60.bpl=Borland Integrated Translation Environment
c:\delphi6\Bin\dcldbx60.bpl=Borland dbExpress Components
c:\delphi6\Bin\dclsoap60.bpl=Borland SOAP Components
c:\delphi6\Bin\dclocx60.bpl=Borland Sample Imported ActiveX Controls
c:\delphi6\Bin\dcldbxcds60.bpl=Borland Local DBX ClientDataset Components
C:\WINDOWS\System32\ibevnt60.bpl=Borland Interbase Event Alerter Component
C:\Program Files\madCollection\madRemote\Delphi 6\madRemote_.bpl=madRemote 1.1b · www.madshi.net
C:\Program Files\madCollection\madKernel\Delphi 6\madKernel_.bpl=madKernel 1.3 · www.madshi.net
C:\Program Files\madCollection\madCodeHook\Delphi 6\madCodeHook_.bpl=madCodeHook 2.1b · www.madshi.net
C:\Program Files\madCollection\madSecurity\Delphi 6\madSecurity_.bpl=madSecurity 1.1n · www.madshi.net
C:\Program Files\madCollection\madShell\Delphi 6\madShell_.bpl=madShell 1.3k · www.madshi.net
c:\delphi6\Projects\Bpl\PsychoTidyD6.bpl=PsychoTidy IDE Expert

View File

@ -0,0 +1,11 @@
program X2UtUnitTests;
uses
TestFramework,
GUITestRunner,
UBits in 'Units\UBits.pas';
begin
RunRegisteredTests();
end.