Commits

Anonymous committed df4abd5

dtest sounds better than vfptest. Additionally, tests much more now.

  • Participants
  • Parent commits 60fd626

Comments (0)

Files changed (4)

dbasetests/dtest.lpi

+<?xml version="1.0"?>
+<CONFIG>
+  <ProjectOptions>
+    <Version Value="9"/>
+    <PathDelim Value="\"/>
+    <General>
+      <Flags>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <MainUnitHasTitleStatement Value="False"/>
+      </Flags>
+      <SessionStorage Value="InProjectDir"/>
+      <MainUnit Value="0"/>
+      <Title Value="dtest"/>
+      <UseAppBundle Value="False"/>
+      <ResourceType Value="res"/>
+    </General>
+    <i18n>
+      <EnableI18N LFM="False"/>
+    </i18n>
+    <VersionInfo>
+      <StringTable ProductVersion=""/>
+    </VersionInfo>
+    <BuildModes Count="1">
+      <Item1 Name="Default" Default="True"/>
+    </BuildModes>
+    <PublishOptions>
+      <Version Value="2"/>
+      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+      <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
+    </PublishOptions>
+    <RunParams>
+      <local>
+        <FormatVersion Value="1"/>
+        <CommandLineParams Value="nullt.dbf"/>
+      </local>
+    </RunParams>
+    <Units Count="1">
+      <Unit0>
+        <Filename Value="dtest.lpr"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="dtest"/>
+      </Unit0>
+    </Units>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="11"/>
+    <PathDelim Value="\"/>
+    <Target>
+      <Filename Value="dtest"/>
+    </Target>
+    <SearchPaths>
+      <IncludeFiles Value="$(ProjOutDir)"/>
+      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+    </SearchPaths>
+    <Other>
+      <CompilerMessages>
+        <MsgFileName Value=""/>
+      </CompilerMessages>
+      <CompilerPath Value="$(CompPath)"/>
+    </Other>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions Count="3">
+      <Item1>
+        <Name Value="EAbort"/>
+      </Item1>
+      <Item2>
+        <Name Value="ECodetoolError"/>
+      </Item2>
+      <Item3>
+        <Name Value="EFOpenError"/>
+      </Item3>
+    </Exceptions>
+  </Debugging>
+</CONFIG>

dbasetests/dtest.lpr

+program dtest;
+
+{$mode objfpc}{$H+}
+
+uses
+  {$IFDEF UNIX}{$IFDEF UseCThreads}
+  cthreads,
+  {$ENDIF}{$ENDIF}
+  Classes, db, dbf,dbf_fields,dbf_common,
+  SysUtils,dateutils;
+
+procedure CreateDBF(FileName: string; TableLevel: integer);
+const
+  UseID=true;
+  UseName= true;
+  UseFloater=true;
+  UseMyMemo=true;
+  UseBCDF=false;
+var
+  NewDBF: TDBF;
+  i: integer;
+begin
+  NewDBF:=TDBF.Create(nil);
+  try
+    NewDBF.TableLevel:=TableLevel;
+    NewDBF.TableName:=FileName;
+    writeln('Creating ',FileName,' with table level ',NewDBF.TableLevel);
+    if UseID then
+      if TableLevel>=30 then
+        begin
+          NewDBF.FieldDefs.Add('ID', ftAutoInc)
+        end
+        else
+          NewDBF.FieldDefs.Add('ID', ftInteger);
+    if UseName then
+      NewDBF.FieldDefs.Add('NAME', ftString, 5);
+    if UseFloater then
+      NewDBF.FieldDefs.Add('FLOATER', ftFloat);
+    if UseMyMemo then
+      NewDBF.FieldDefs.Add('MYMEMO', ftMemo);
+    // Only in visual foxpro ('Y' field)
+    if (TableLevel>=30) and (UseBCDF) then
+      NewDBF.FieldDefs.Add('BCDF',ftBCD);
+    NewDBF.CreateTable;
+    NewDBF.Open;
+    writeln('Codepage: ',NewDBF.CodePage);
+    for i := 1 to 5 do //keep size manageable until we have working files
+    begin
+      NewDBF.Append;
+      if (UseID) and (TableLevel<30) then
+        NewDBF.FieldByName('ID').AsInteger := i;
+      if UseName then
+        NewDBF.FieldByName('NAME').AsString := 'Test' + IntToStr(i);
+      if UseFloater then
+        NewDBF.FieldByName('FLOATER').AsFloat := 2/i;
+      if UseMyMemo then
+        NewDBF.FieldByName('MYMEMO').AsString := 'Test' + IntToStr(i);
+      // Only in visual foxpro ('Y' field)
+      if (TableLevel>=30) and (UseBCDF) then
+        NewDBF.FieldByName('BCDF').AsCurrency:= 2/i;
+      NewDBF.Post;
+    end;
+    writeln('After assigning fields & data: tablelevel: ',NewDBF.TableLevel);
+    NewDBF.Close;
+  finally
+    NewDBF.Free;
+  end;
+end;
+
+procedure ListDBFs(Results: TstringList);
+var r:TSearchRec;
+begin
+  results.Clear;
+  if FindFirst('*.dbf', faAnyFile-{$WARNINGS OFF}faVolumeID-faSymLink{$WARNINGS ON}, r)=0 then
+  begin
+    repeat
+      if (r.Attr and faDirectory) <> faDirectory then
+      begin
+        results.add(expandfilename(r.Name))
+      end;
+    until (FindNext(r)<>0);
+    findclose(r);
+  end;
+end;
+
+procedure PrintRecord(DBf: TDBf; RecordNumber: integer);
+var
+  i:integer;
+begin
+  writeln('Record ' + inttostr(RecordNumber));
+  for i:=0 to DBf.Fields.Count-1 do
+  begin
+    if DBF.fields[i].IsNull then
+      writeln('Field ',DBf.Fields[i].FieldName,' is          ***NULL***')
+    else
+      writeln('Field ',DBf.Fields[i].FieldName,' has value: '+DBf.fields[i].asstring);
+  end;
+end;
+
+var
+  DBFs: TStringList;
+  DBFFile: integer;
+  MyDbf: TDbf;
+  RecCount: integer;
+  SomeDate: TDateTime;
+
+procedure w32_functionstest;
+begin
+  if lowercase(mydbf.tablename)='w32_functions.dbf' then
+  begin
+    SomeDate:=ScanDateTime('yyyymmdd hhnnss','20051216 154425');
+    if SomeDate=mydbf.FieldByName('MODIFIED').AsDateTime then
+      writeln('modified field is equal to somedate!');
+    {
+    if mydbf.fieldbyname('EXAMPLEID').Asinteger=503 then
+      begin
+        somedate:=mydbf.FieldByName('MODIFIED').AsDateTime;
+        writeln('Copied modified date value which is: ');
+        writeln(FormatDateTime('yyyymmdd hhnnss zzzz',SomeDate));
+      end;
+    }
+  end;
+end;
+
+procedure w32_examplestest;
+begin
+  if lowercase(mydbf.tablename)='w32_examples.dbf' then
+  begin
+    writeln('Testing locate:');
+    try
+      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
+      SomeDate:=ScanDateTime('yyyymmdd hhnnss zzz','20051216 154425 999');
+      writeln('trying to find modified at date '+FormatDateTime('yyyymmdd hhnnss zzz',SomeDate));
+      if MyDBF.Locate('MODIFIED',SomeDate,[]) then
+      begin
+        writeln('Recno is now: '+inttostr(MyDBF.RecNo));
+        PrintRecord(MyDBF,RecCount)
+      end
+      else
+      begin
+        writeln('Locate did not work/find anything.');
+      end;
+
+      writeln('Testing locate partial key with inexact date which should fail:');
+      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
+      SomeDate:=ScanDateTime('yyyymmdd hhnnss zzz','20051216 154425 000');
+      writeln('trying to find modified at/after '+FormatDateTime('yyyymmdd hhnnss zzz',SomeDate));
+      if MyDBF.Locate('MODIFIED',SomeDate,[loPartialKey]) then
+      begin
+        writeln('Recno is now: '+inttostr(MyDBF.RecNo));
+        PrintRecord(MyDBF,RecCount)
+      end
+      else
+      begin
+        writeln('Locate partial key did not work/find anything.');
+      end;
+      writeln('End locate partial test');
+
+      writeln('Testing locate partial key with inexact string which should work:');
+      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
+      writeln('trying to find EXAMPLENAM GDI+');
+      if MyDBF.Locate('EXAMPLENAM','GDI+',[loPartialKey]) then
+      begin
+        writeln('Recno is now: '+inttostr(MyDBF.RecNo));
+        PrintRecord(MyDBF,RecCount)
+      end
+      else
+      begin
+        writeln('Locate partial key did not work/find anything.');
+      end;
+      writeln('End locate partial test');
+    except
+      on E: EDbfError do
+      begin
+        writeln('Locate test: dbf error '+E.Message);
+      end;
+      on F: EDatabaseError do
+      begin
+        writeln('Locate test: database error '+F.Message);
+      end;
+    end;
+  //w32_examples.dbf
+  end;
+end;
+
+procedure w32_ordersstest;
+begin
+  if lowercase(mydbf.tablename)='orders.dbf' then
+  begin
+    //todo: set descending index
+    writeln('Testing locate for orders:');
+    try
+      mydbf.AddIndex('orderiddesc','ORDER_ID',[ixDescending]);
+      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
+
+      writeln('Testing locate partial key with inexact orderid which should fail:');
+      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
+      writeln('trying to find ORDER_ID at/after '+inttostr(10006));
+      if MyDBF.Locate('ORDER_ID',10006,[loPartialKey]) then
+      begin
+        writeln('Recno is now: '+inttostr(MyDBF.RecNo));
+        PrintRecord(MyDBF,RecCount)
+      end
+      else
+      begin
+        writeln('Locate partial key did not work/find anything.');
+      end;
+      writeln('End locate partial test');
+
+    except
+      on E: EDbfError do
+      begin
+        writeln('Locate test: dbf error '+E.Message);
+      end;
+      on F: EDatabaseError do
+      begin
+        writeln('Locate test: database error '+F.Message);
+      end;
+    end;
+  //orders.dbf
+  end;
+end;
+
+begin
+  // Don't create if we specify one dbf to read as paramstr(1)
+  if (paramstr(1)='--create') then
+  begin
+    writeln('** Going to create databases: ');
+    if (paramstr(1)='')
+      or (uppercase(paramstr(1))='FOXPRO')
+      or (uppercase(paramstr(1))='FOXPRO.DBF') then
+      CreateDBF('foxpro.dbf',25);
+    if (paramstr(1)='')
+      or (uppercase(paramstr(1))='VFOXPRO')
+      or (uppercase(paramstr(1))='VFOXPRO.DBF') then
+      CreateDBF('vfoxpro.dbf',30);
+    if (paramstr(1)='')
+      or (uppercase(paramstr(1))='DBASE7')
+      or (uppercase(paramstr(1))='DBASE7.DBF') then
+      CreateDBF('dbase7.dbf',7);
+    if (paramstr(1)='')
+      or (uppercase(paramstr(1))='DBASE4')
+      or (uppercase(paramstr(1))='DBASE4.DBF') then
+      CreateDBF('dbase4.dbf',4);
+    if (paramstr(1)='')
+      or (uppercase(paramstr(1))='DBASE3')
+      or (uppercase(paramstr(1))='DBASE3.DBF') then
+      CreateDBF('dbase3.dbf',3);
+  end;
+
+  begin
+    DBFs:=TStringList.Create;
+    try
+      // Argument 1: dbf file name; if not given, show all names in directory
+      if Paramstr(1)='' then
+        ListDBFs(DBFs)
+      else
+        // If dbf specified, only show for that one
+        DBFs.Add(ExpandFileName(paramstr(1)));
+      for DBFFile:=0 to DBFs.Count-1 do
+      begin
+        MyDbf := TDbf.Create(nil);
+        try
+          try
+            MyDbf.FilePath := ExtractFilePath(DBFs[DBFFile]);
+            MyDbf.TableName := ExtractFileName(DBFs[DBFFile]);
+            MyDbf.ReadOnly:=true;
+            writeln('*** Opening: '+DBFs[DBFFile]);
+            MyDbf.Open;
+            writeln('Database tablelevel: '+inttostr(MyDbf.TableLevel));
+            //MyDBF.Filter:='DTOS(MODIFIED) > "20060102 163400"';
+            //MyDBF.Filtered:=true;
+            //todo: test multiple locate
+            RecCount:=1;
+            while not(MyDbf.EOF) do
+            begin
+              PrintRecord(MyDBF, RecCount);
+              {
+              //Some extra tests for specific dbfs
+              w32_functionstest;
+              }
+              MyDBF.Next;
+              RecCount:=RecCount+1;
+              writeln('');
+            end;
+            {
+            //another set of tests for a specific file
+            w32_examplestest;
+
+            //and another one
+            w32_ordersstest;
+            }
+            MyDbf.Close;
+          except
+            on E: Exception do
+            begin
+              writeln('File ',DBFFile,': error ',E.Message);
+            end;
+          end;
+        finally
+          MyDbf.Free;
+        end;
+      end;
+    finally
+      DBFs.Free;
+    end;
+  end;
+  {
+  writeln('Press enter to continue.');
+  readln;
+  }
+end.
+

dbasetests/vfptest.lpi

-<?xml version="1.0"?>
-<CONFIG>
-  <ProjectOptions>
-    <Version Value="9"/>
-    <PathDelim Value="\"/>
-    <General>
-      <Flags>
-        <MainUnitHasCreateFormStatements Value="False"/>
-        <MainUnitHasTitleStatement Value="False"/>
-      </Flags>
-      <SessionStorage Value="InProjectDir"/>
-      <MainUnit Value="0"/>
-      <Title Value="vfptest"/>
-      <UseAppBundle Value="False"/>
-      <ResourceType Value="res"/>
-    </General>
-    <i18n>
-      <EnableI18N LFM="False"/>
-    </i18n>
-    <VersionInfo>
-      <StringTable ProductVersion=""/>
-    </VersionInfo>
-    <BuildModes Count="1">
-      <Item1 Name="Default" Default="True"/>
-    </BuildModes>
-    <PublishOptions>
-      <Version Value="2"/>
-      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
-      <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
-    </PublishOptions>
-    <RunParams>
-      <local>
-        <FormatVersion Value="1"/>
-      </local>
-    </RunParams>
-    <Units Count="1">
-      <Unit0>
-        <Filename Value="vfptest.lpr"/>
-        <IsPartOfProject Value="True"/>
-        <UnitName Value="vfptest"/>
-      </Unit0>
-    </Units>
-  </ProjectOptions>
-  <CompilerOptions>
-    <Version Value="11"/>
-    <PathDelim Value="\"/>
-    <Target>
-      <Filename Value="vfptest"/>
-    </Target>
-    <SearchPaths>
-      <IncludeFiles Value="$(ProjOutDir)"/>
-      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
-    </SearchPaths>
-    <Other>
-      <CompilerMessages>
-        <MsgFileName Value=""/>
-      </CompilerMessages>
-      <CompilerPath Value="$(CompPath)"/>
-    </Other>
-  </CompilerOptions>
-  <Debugging>
-    <Exceptions Count="3">
-      <Item1>
-        <Name Value="EAbort"/>
-      </Item1>
-      <Item2>
-        <Name Value="ECodetoolError"/>
-      </Item2>
-      <Item3>
-        <Name Value="EFOpenError"/>
-      </Item3>
-    </Exceptions>
-  </Debugging>
-</CONFIG>

dbasetests/vfptest.lpr

-program vfptest;
-
-{$mode objfpc}{$H+}
-
-uses
-  {$IFDEF UNIX}{$IFDEF UseCThreads}
-  cthreads,
-  {$ENDIF}{$ENDIF}
-  Classes, db, dbf,dbf_fields,dbf_common,
-  SysUtils,dateutils;
-
-procedure CreateDBF(FileName: string; TableLevel: integer);
-const
-  UseID=true;
-  UseName= true;
-  UseFloater=true;
-  UseMyMemo=true;
-  UseBCDF=false;
-var
-  NewDBF: TDBF;
-  i: integer;
-begin
-  NewDBF:=TDBF.Create(nil);
-  try
-    NewDBF.TableLevel:=TableLevel;
-    NewDBF.TableName:=FileName;
-    writeln('Creating ',FileName,' with table level ',NewDBF.TableLevel);
-    if UseID then
-      NewDBF.FieldDefs.Add('ID', ftInteger);
-    if UseName then
-      NewDBF.FieldDefs.Add('NAME', ftString, 5);
-    if UseFloater then
-      NewDBF.FieldDefs.Add('FLOATER', ftFloat);
-    if UseMyMemo then
-      NewDBF.FieldDefs.Add('MYMEMO', ftMemo);
-    // Only in visual foxpro ('Y' field)
-    if (TableLevel>=30) and (UseBCDF) then
-      NewDBF.FieldDefs.Add('BCDF',ftBCD);
-    NewDBF.CreateTable;
-    NewDBF.Open;
-    writeln('Codepage: ',NewDBF.CodePage);
-    for i := 1 to 5 do //keep size manageable until we have working files
-    begin
-      NewDBF.Append;
-      if UseID then
-        NewDBF.FieldByName('ID').AsInteger := i;
-      if UseName then
-        NewDBF.FieldByName('NAME').AsString := 'Test' + IntToStr(i);
-      if UseFloater then
-        NewDBF.FieldByName('FLOATER').AsFloat := 2/i;
-      if UseMyMemo then
-        NewDBF.FieldByName('MYMEMO').AsString := 'Test' + IntToStr(i);
-      // Only in visual foxpro ('Y' field)
-      if (TableLevel>=30) and (UseBCDF) then
-        NewDBF.FieldByName('BCDF').AsCurrency:= 2/i;
-      NewDBF.Post;
-    end;
-    writeln('After assigning fields & data: tablelevel: ',NewDBF.TableLevel);
-    NewDBF.Close;
-  finally
-    NewDBF.Free;
-  end;
-end;
-
-procedure ListDBFs(Results: TstringList);
-var r:TSearchRec;
-begin
-  results.Clear;
-  if FindFirst('*.dbf', faAnyFile-{$WARNINGS OFF}faVolumeID-faSymLink{$WARNINGS ON}, r)=0 then
-  begin
-    repeat
-      if (r.Attr and faDirectory) <> faDirectory then
-      begin
-        results.add(expandfilename(r.Name))
-      end;
-    until (FindNext(r)<>0);
-    findclose(r);
-  end;
-end;
-
-procedure PrintRecord(DBf: TDBf; RecordNumber: integer);
-var
-  i:integer;
-begin
-  writeln('Record ' + inttostr(RecordNumber));
-  for i:=0 to DBf.Fields.Count-1 do
-  begin
-    writeln('Field '+DBf.Fields[i].FieldName+' has value: '+DBf.fields[i].asstring);
-  end;
-end;
-
-var
-  DBFs: TStringList;
-  DBFFile: integer;
-  MyDbf: TDbf;
-  RecCount: integer;
-  SomeDate: TDateTime;
-
-procedure w32_functionstest;
-begin
-  if lowercase(mydbf.tablename)='w32_functions.dbf' then
-  begin
-    SomeDate:=ScanDateTime('yyyymmdd hhnnss','20051216 154425');
-    if SomeDate=mydbf.FieldByName('MODIFIED').AsDateTime then
-      writeln('modified field is equal to somedate!');
-    {
-    if mydbf.fieldbyname('EXAMPLEID').Asinteger=503 then
-      begin
-        somedate:=mydbf.FieldByName('MODIFIED').AsDateTime;
-        writeln('Copied modified date value which is: ');
-        writeln(FormatDateTime('yyyymmdd hhnnss zzzz',SomeDate));
-      end;
-    }
-  end;
-end;
-
-procedure w32_examplestest;
-begin
-  if lowercase(mydbf.tablename)='w32_examples.dbf' then
-  begin
-    writeln('Testing locate:');
-    try
-      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
-      SomeDate:=ScanDateTime('yyyymmdd hhnnss zzz','20051216 154425 999');
-      writeln('trying to find modified at date '+FormatDateTime('yyyymmdd hhnnss zzz',SomeDate));
-      if MyDBF.Locate('MODIFIED',SomeDate,[]) then
-      begin
-        writeln('Recno is now: '+inttostr(MyDBF.RecNo));
-        PrintRecord(MyDBF,RecCount)
-      end
-      else
-      begin
-        writeln('Locate did not work/find anything.');
-      end;
-
-      writeln('Testing locate partial key with inexact date which should fail:');
-      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
-      SomeDate:=ScanDateTime('yyyymmdd hhnnss zzz','20051216 154425 000');
-      writeln('trying to find modified at/after '+FormatDateTime('yyyymmdd hhnnss zzz',SomeDate));
-      if MyDBF.Locate('MODIFIED',SomeDate,[loPartialKey]) then
-      begin
-        writeln('Recno is now: '+inttostr(MyDBF.RecNo));
-        PrintRecord(MyDBF,RecCount)
-      end
-      else
-      begin
-        writeln('Locate partial key did not work/find anything.');
-      end;
-      writeln('End locate partial test');
-
-      writeln('Testing locate partial key with inexact string which should work:');
-      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
-      writeln('trying to find EXAMPLENAM GDI+');
-      if MyDBF.Locate('EXAMPLENAM','GDI+',[loPartialKey]) then
-      begin
-        writeln('Recno is now: '+inttostr(MyDBF.RecNo));
-        PrintRecord(MyDBF,RecCount)
-      end
-      else
-      begin
-        writeln('Locate partial key did not work/find anything.');
-      end;
-      writeln('End locate partial test');
-    except
-      on E: EDbfError do
-      begin
-        writeln('Locate test: dbf error '+E.Message);
-      end;
-      on F: EDatabaseError do
-      begin
-        writeln('Locate test: database error '+F.Message);
-      end;
-    end;
-  //w32_examples.dbf
-  end;
-end;
-
-procedure w32_ordersstest;
-begin
-  if lowercase(mydbf.tablename)='orders.dbf' then
-  begin
-    //todo: set descending index
-    writeln('Testing locate for orders:');
-    try
-      mydbf.AddIndex('orderiddesc','ORDER_ID',[ixDescending]);
-      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
-
-      writeln('Testing locate partial key with inexact orderid which should fail:');
-      writeln('Recno is now: '+inttostr(MyDBF.RecNo));
-      writeln('trying to find ORDER_ID at/after '+inttostr(10006));
-      if MyDBF.Locate('ORDER_ID',10006,[loPartialKey]) then
-      begin
-        writeln('Recno is now: '+inttostr(MyDBF.RecNo));
-        PrintRecord(MyDBF,RecCount)
-      end
-      else
-      begin
-        writeln('Locate partial key did not work/find anything.');
-      end;
-      writeln('End locate partial test');
-
-    except
-      on E: EDbfError do
-      begin
-        writeln('Locate test: dbf error '+E.Message);
-      end;
-      on F: EDatabaseError do
-      begin
-        writeln('Locate test: database error '+F.Message);
-      end;
-    end;
-  //orders.dbf
-  end;
-end;
-
-begin
-  // Don't create if we specify one dbf to read as paramstr(1)
-  if (paramstr(1)='--create') or (paramstr(1)='') then
-  begin
-    writeln('** Going to create databases: ');
-    CreateDBF('foxpro.dbf',25);
-    CreateDBF('vfoxpro.dbf',30);
-    CreateDBF('dbase7.dbf',7);
-    CreateDBF('dbase4.dbf',4);
-    CreateDBF('dbase3.dbf',3);
-  end;
-
-  begin
-    DBFs:=TStringList.Create;
-    try
-      // Argument 1: dbf file name; if not given, show all names in directory
-      if Paramstr(1)='' then
-        ListDBFs(DBFs)
-      else
-        // If dbf specified, only show for that one
-        DBFs.Add(ExpandFileName(paramstr(1)));
-      for DBFFile:=0 to DBFs.Count-1 do
-      begin
-        MyDbf := TDbf.Create(nil);
-        try
-          try
-            MyDbf.FilePath := ExtractFilePath(DBFs[DBFFile]);
-            MyDbf.TableName := ExtractFileName(DBFs[DBFFile]);
-            MyDbf.ReadOnly:=true;
-            writeln('*** Opening: '+DBFs[DBFFile]);
-            MyDbf.Open;
-            writeln('Database tablelevel: '+inttostr(MyDbf.TableLevel));
-            //MyDBF.Filter:='DTOS(MODIFIED) > "20060102 163400"';
-            //MyDBF.Filtered:=true;
-            //todo: test multiple locate
-            RecCount:=1;
-            while not(MyDbf.EOF) do
-            begin
-              PrintRecord(MyDBF, RecCount);
-              //Some extra tests for specific dbfs
-              w32_functionstest;
-              MyDBF.Next;
-              RecCount:=RecCount+1;
-              writeln('');
-            end;
-
-            //another set of tests for a specific file
-            w32_examplestest;
-
-            //and another one
-            w32_ordersstest;
-
-            MyDbf.Close;
-          except
-            on E: Exception do
-            begin
-              writeln('File ',DBFFile,': error ',E.Message);
-            end;
-          end;
-        finally
-          MyDbf.Free;
-        end;
-      end;
-    finally
-      DBFs.Free;
-    end;
-  end;
-  {
-  writeln('Press enter to continue.');
-  readln;
-  }
-end.
-