Browse Source

+ Added more tests of getprops

michael 26 years ago
parent
commit
ef9fe8db1c
1 changed files with 21 additions and 12 deletions
  1. 21 12
      tests/testrtti.pp

+ 21 - 12
tests/testrtti.pp

@@ -348,19 +348,28 @@ begin
       begin
       Write ('(Examining ',name,' : Type : ',TypeNames[PropType^.Kind],', ');
       If (Proptype^.kind in Ordinaltypes) Then
-        Write ('Value : ',GetOrdProp(O,pri))
-{
-      // Skipping the ord() never gives True !!! ???
-      else If ord(pri^.proptype^.kind) = ord(tkfloat) then
         begin
-        Write (', Value : ');
-        Flush(output);
-        Write(GetFloatProp(O,pri))
+        J:=GetOrdProp(O,pri);
+        Write ('Value : ',j);
+        If PropType^.Kind=tkenumeration then
+          Write ('(=',GetEnumName(Proptype,J),')')
         end
-}
-      else
-        Write ('Not of type ordinal, bool or float:',ord(pri^.proptype^.kind));
-      Writeln (')');
+      else 
+        Case pri^.proptype^.kind of
+          tkfloat :  begin
+                     Write ('Value : ');
+                     Flush(output);
+                     Write(GetFloatProp(O,pri))
+                     end;
+        tkAstring : begin
+                    Write ('value : ');
+                    flush (output);
+                    Write(GetStrProp(O,Pri));
+                    end;
+        else 
+          Write ('Untested type:',ord(pri^.proptype^.kind));
+        end;  
+          Writeln (')');
       end;
     end;
 end;
@@ -372,4 +381,4 @@ begin
   DumpTypeInfo(O);
   PrintObject(O);
   testget(o);
-end.
+end.