diff --git a/.gitattributes b/.gitattributes index e4e4d4a8c3..886c25219e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13011,6 +13011,7 @@ tests/test/trtti10.pp svneol=native#text/pascal tests/test/trtti11.pp svneol=native#text/pascal tests/test/trtti12.pp svneol=native#text/pascal tests/test/trtti13.pp svneol=native#text/pascal +tests/test/trtti14.pp svneol=native#text/pascal tests/test/trtti2.pp svneol=native#text/plain tests/test/trtti3.pp svneol=native#text/plain tests/test/trtti4.pp svneol=native#text/plain diff --git a/tests/test/trtti14.pp b/tests/test/trtti14.pp new file mode 100644 index 0000000000..2145fcbfe6 --- /dev/null +++ b/tests/test/trtti14.pp @@ -0,0 +1,86 @@ +program trtti14; + +uses + TypInfo; + +var + error: LongInt = 0; + +procedure TestBooleanInfo(aTI: PTypeInfo; aOrdType: TOrdType; aWinBool: Boolean); +var + td: PTypeData; +begin + Inc(error); + if aTI^.Kind <> tkBool then + Halt(error); + + td := GetTypeData(aTI); + + Inc(error); + if td^.OrdType <> aOrdType then + Halt(error); + + if aWinBool then begin + case td^.OrdType of + otSQWord: begin + Inc(error); + if td^.MaxInt64Value <> High(Int64) then + Halt(error); + Inc(error); + if td^.MinInt64Value <> Low(Int64) then + Halt(error); + end; + otUByte, + otUWord, + otULong, + otUQWord: begin + Inc(error); + Halt(error); + end; + else + Inc(error); + if td^.MaxValue <> High(LongInt) then + Halt(error); + Inc(error); + if td^.MinValue <> Low(LongInt) then + Halt(error); + end; + end else begin + case td^.OrdType of + otUQWord: begin + Inc(error); + if td^.MaxQWordValue <> 1 then + Halt(error); + Inc(error); + if td^.MinQWordValue <> 0 then + Halt(error); + end; + otSByte, + otSWord, + otSLong, + otSQWord: begin + Inc(error); + Halt(error); + end; + else + Inc(error); + if td^.MaxValue <> 1 then + Halt(error); + Inc(error); + if td^.MinValue <> 0 then + Halt(error); + end; + end; +end; + +begin + TestBooleanInfo(PTypeInfo(TypeInfo(Boolean)), otUByte, False); + TestBooleanInfo(PTypeInfo(TypeInfo(Boolean16)), otUWord, False); + TestBooleanInfo(PTypeInfo(TypeInfo(Boolean32)), otULong, False); + TestBooleanInfo(PTypeInfo(TypeInfo(Boolean64)), otUQWord, False); + + TestBooleanInfo(PTypeInfo(TypeInfo(ByteBool)), otSByte, True); + TestBooleanInfo(PTypeInfo(TypeInfo(WordBool)), otSWord, True); + TestBooleanInfo(PTypeInfo(TypeInfo(LongBool)), otSLong, True); + TestBooleanInfo(PTypeInfo(TypeInfo(QWordBool)), otSQWord, True); +end.