mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 23:30:37 +02:00
* extend test for 64-bit subranges
git-svn-id: trunk@35179 -
This commit is contained in:
parent
00751d257e
commit
8e765ef807
@ -6,6 +6,17 @@ uses
|
|||||||
var
|
var
|
||||||
error: LongInt = 0;
|
error: LongInt = 0;
|
||||||
|
|
||||||
|
const
|
||||||
|
RangedInt64Min = $FFFFFFFF00000000;
|
||||||
|
RangedInt64Max = $100000000;
|
||||||
|
|
||||||
|
RangedQWordMin = QWord($100000000);
|
||||||
|
RangedQWordMax = QWord($8000000000000000);
|
||||||
|
|
||||||
|
type
|
||||||
|
TRangedInt64 = RangedInt64Min..RangedInt64Max;
|
||||||
|
TRangedQWord = RangedQWordMin..RangedQWordMax;
|
||||||
|
|
||||||
procedure TestOrdTypeInfo(aTI: PTypeInfo; aTypeKind: TTypeKind; aOrdType: TOrdType);
|
procedure TestOrdTypeInfo(aTI: PTypeInfo; aTypeKind: TTypeKind; aOrdType: TOrdType);
|
||||||
var
|
var
|
||||||
td: PTypeData;
|
td: PTypeData;
|
||||||
@ -21,6 +32,25 @@ begin
|
|||||||
Halt(error);
|
Halt(error);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TestMinMax64(aTI: PTypeInfo; aMin, aMax: Int64);
|
||||||
|
var
|
||||||
|
td: PTypeData;
|
||||||
|
begin
|
||||||
|
td := GetTypeData(aTI);
|
||||||
|
|
||||||
|
Inc(error);
|
||||||
|
if (td^.OrdType=otSQWord) and (td^.MinInt64Value<>Int64(aMin)) then
|
||||||
|
Halt(error);
|
||||||
|
if (td^.OrdType=otUQWord) and (td^.MinQWordValue<>QWord(aMin)) then
|
||||||
|
Halt(error);
|
||||||
|
|
||||||
|
Inc(error);
|
||||||
|
if (td^.OrdType=otSQWord) and (td^.MaxInt64Value<>Int64(aMax)) then
|
||||||
|
Halt(error);
|
||||||
|
if (td^.OrdType=otUQWord) and (td^.MaxQWordValue<>QWord(aMax)) then
|
||||||
|
Halt(error);
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
TestOrdTypeInfo(PTypeInfo(TypeInfo(Int8)), tkInteger, otSByte);
|
TestOrdTypeInfo(PTypeInfo(TypeInfo(Int8)), tkInteger, otSByte);
|
||||||
TestOrdTypeInfo(PTypeInfo(TypeInfo(Int16)), tkInteger, otSWord);
|
TestOrdTypeInfo(PTypeInfo(TypeInfo(Int16)), tkInteger, otSWord);
|
||||||
@ -32,19 +62,8 @@ begin
|
|||||||
TestOrdTypeInfo(PTypeInfo(TypeInfo(UInt32)), tkInteger, otULong);
|
TestOrdTypeInfo(PTypeInfo(TypeInfo(UInt32)), tkInteger, otULong);
|
||||||
TestOrdTypeInfo(PTypeInfo(TypeInfo(UInt64)), tkQWord, otUQWord);
|
TestOrdTypeInfo(PTypeInfo(TypeInfo(UInt64)), tkQWord, otUQWord);
|
||||||
|
|
||||||
Inc(error);
|
TestMinMax64(PTypeInfo(TypeInfo(Int64)), Low(Int64), High(Int64));
|
||||||
if GetTypeData(PTypeInfo(TypeInfo(Int64)))^.MinInt64Value <> Low(Int64) then
|
TestMinMax64(PTypeInfo(TypeInfo(TRangedInt64)), RangedInt64Min, RangedInt64Max);
|
||||||
Halt(error);
|
TestMinMax64(PTypeInfo(TypeInfo(QWord)), Int64(Low(QWord)), Int64(High(QWord)));
|
||||||
|
TestMinMax64(PTypeInfo(TypeInfo(TRangedQWord)), Int64(RangedQWordMin), Int64(RangedQWordMax));
|
||||||
Inc(error);
|
|
||||||
if GetTypeData(PTypeInfo(TypeInfo(Int64)))^.MaxInt64Value <> High(Int64) then
|
|
||||||
Halt(error);
|
|
||||||
|
|
||||||
Inc(error);
|
|
||||||
if GetTypeData(PTypeInfo(TypeInfo(UInt64)))^.MinQWordValue <> Low(QWord) then
|
|
||||||
Halt(error);
|
|
||||||
|
|
||||||
Inc(error);
|
|
||||||
if GetTypeData(PTypeInfo(TypeInfo(UInt64)))^.MaxQWordValue <> High(QWord) then
|
|
||||||
Halt(error);
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user