Browse Source

fcl-db: tests: add more information to be able find point where test fails.

git-svn-id: trunk@22990 -
lacak 12 years ago
parent
commit
9e5c31331e

+ 2 - 2
packages/fcl-db/tests/testbufdatasetstreams.pas

@@ -571,8 +571,8 @@ begin
   ADataset.Close;
 
   ADataset.LoadFromFile(TestXMLFileName,dfXML);
-  AssertEquals(ADataset.FieldByName('ID').AsInteger,1);
-  AssertEquals(ADataset.FieldByName('NAME').AsString,'TestName1');
+  AssertEquals(1, ADataset.FieldByName('ID').AsInteger);
+  AssertEquals('TestName1', ADataset.FieldByName('NAME').AsString);
   ADataset.Close;
 end;
 

+ 5 - 5
packages/fcl-db/tests/testdbbasics.pas

@@ -76,7 +76,7 @@ type
     procedure TestClosedIndexFieldNames; // bug 16695
     procedure TestFileNameProperty;
     procedure TestClientDatasetAsMemDataset;
-    procedure TestSafeAsXML;
+    procedure TestSaveAsXML;
     procedure TestIsEmpty;
     procedure TestBufDatasetCancelUpd; //bug 6938
     procedure TestBufDatasetCancelUpd1;
@@ -1310,7 +1310,7 @@ begin
   bufds.CompareBookmarks(nil,nil);
 end;
 
-procedure TTestBufDatasetDBBasics.TestSafeAsXML;
+procedure TTestBufDatasetDBBasics.TestSaveAsXML;
 var ds    : TDataset;
     LoadDs: TCustomBufDataset;
 begin
@@ -1532,7 +1532,7 @@ begin
   CheckEquals(2,ADataset.Fields.Count);
   CheckTrue(SameText('ID',ADataset.Fields[0].FieldName));
   CheckTrue(SameText('NAME',ADataset.Fields[1].FieldName));
-  CheckTrue(ADataset.fields[1].DataType=ftString,'Incorrect fieldtype');
+  CheckEquals(ord(ftString), ord(ADataset.Fields[1].DataType), 'Incorrect FieldType');
   i := 1;
   while not ADataset.EOF do
     begin
@@ -2481,7 +2481,7 @@ begin
     open;
     AField := fieldbyname('name');
     AParam.AssignField(AField);
-    CheckTrue(ftString=AParam.DataType);
+    CheckEquals(ord(ftString), ord(AParam.DataType), 'DataType');
     close;
     end;
   AParam.Free;
@@ -2498,7 +2498,7 @@ begin
     AField := fieldbyname('name');
     (AField as tstringfield).FixedChar := true;
     AParam.AssignField(AField);
-    CheckTrue(ftFixedChar=AParam.DataType);
+    CheckEquals(ord(ftFixedChar), ord(AParam.DataType), 'DataType');
     close;
     end;
   AParam.Free;

+ 8 - 8
packages/fcl-db/tests/testfieldtypes.pas

@@ -1517,8 +1517,8 @@ begin
     Query.ApplyUpdates;
     Query.Close;
     Query.Open;
-    AssertEquals(query.FieldByName('NAME').AsString,FieldValue);
-    query.Close;
+    AssertEquals(FieldValue, Query.FieldByName('NAME').AsString);
+    Query.Close;
     end;
 end;
 
@@ -2107,21 +2107,21 @@ var ds : TSQLQuery;
 begin
   ds := DBConnector.GetNDataset(1) as TSQLQuery;
   ds.Open;
-  AssertEquals(1,ds.ServerIndexDefs.count);
+  AssertEquals('ServerIndexDefs.Count', 1, ds.ServerIndexDefs.Count);
   inddefs := HackedDataset(ds).GetIndexDefs(ds.ServerIndexDefs,[ixPrimary]);
-  AssertEquals(1,inddefs.count);
+  AssertEquals('ixPrimary', 1, inddefs.count);
   AssertTrue(CompareText('ID',inddefs[0].Fields)=0);
-  Asserttrue(inddefs[0].Options=[ixPrimary,ixUnique]);
+  AssertTrue(inddefs[0].Options=[ixPrimary,ixUnique]);
   inddefs.Free;
 
   inddefs := HackedDataset(ds).GetIndexDefs(ds.ServerIndexDefs,[ixPrimary,ixUnique]);
-  AssertEquals(1,inddefs.count);
+  AssertEquals('ixPrimary,ixUnique', 1, inddefs.count);
   AssertTrue(CompareText('ID',inddefs[0].Fields)=0);
-  Asserttrue(inddefs[0].Options=[ixPrimary,ixUnique]);
+  AssertTrue(inddefs[0].Options=[ixPrimary,ixUnique]);
   inddefs.Free;
 
   inddefs := HackedDataset(ds).GetIndexDefs(ds.ServerIndexDefs,[ixDescending]);
-  AssertEquals(0,inddefs.count);
+  AssertEquals('ixDescending', 0, inddefs.count);
   inddefs.Free;
 end;