diff --git a/testsuite/tests/dda/basic/arrays.ads b/testsuite/tests/dda/basic/arrays.ads new file mode 100644 index 000000000..11c483578 --- /dev/null +++ b/testsuite/tests/dda/basic/arrays.ads @@ -0,0 +1,4 @@ +package Arrays is + type Bool_Array is array (Positive range <>) of Boolean; + subtype Bool_Couple is Bool_Array (1 .. 2); +end Arrays; diff --git a/testsuite/tests/dda/basic/arrays.ads.json b/testsuite/tests/dda/basic/arrays.ads.json new file mode 100644 index 000000000..6101275db --- /dev/null +++ b/testsuite/tests/dda/basic/arrays.ads.json @@ -0,0 +1,18 @@ +[ +{ + "name": "Arrays.Bool_Array", + "location": "arrays.ads:2:9", + "Alignment": 1, + "Component_Size": 8, + "Scalar_Storage_Order": "System.Low_Order_First" +} +, +{ + "name": "Arrays.Bool_Couple", + "location": "arrays.ads:3:12", + "Size": 16, + "Alignment": 1, + "Component_Size": 8, + "Scalar_Storage_Order": "System.Low_Order_First" +} +] diff --git a/testsuite/tests/dda/basic/enums.ads b/testsuite/tests/dda/basic/enums.ads new file mode 100644 index 000000000..fd77bf122 --- /dev/null +++ b/testsuite/tests/dda/basic/enums.ads @@ -0,0 +1,3 @@ +package Enums is + type E1 is (A, B, C, D); +end Enums; diff --git a/testsuite/tests/dda/basic/enums.ads.json b/testsuite/tests/dda/basic/enums.ads.json new file mode 100644 index 000000000..21e05d676 --- /dev/null +++ b/testsuite/tests/dda/basic/enums.ads.json @@ -0,0 +1,9 @@ +[ +{ + "name": "Enums.E1", + "location": "enums.ads:2:9", + "Object_Size": 8, + "Value_Size": 2, + "Alignment": 1 +} +] diff --git a/testsuite/tests/dda/basic/fixed.ads b/testsuite/tests/dda/basic/fixed.ads new file mode 100644 index 000000000..6f5e9f6ef --- /dev/null +++ b/testsuite/tests/dda/basic/fixed.ads @@ -0,0 +1,6 @@ +package Fixed is + type F1 is delta 0.1 range -1.0 .. 1.0; + type F2 is delta 0.1 range -1.0 .. 1.0 with Small => 0.03333333; + type F3 is delta 0.1 range -1.0 .. 1.0 with Small => 1.0 / 30.0; + type F4 is delta 0.1 digits 14; +end Fixed; diff --git a/testsuite/tests/dda/basic/fixed.ads.json b/testsuite/tests/dda/basic/fixed.ads.json new file mode 100644 index 000000000..95d776476 --- /dev/null +++ b/testsuite/tests/dda/basic/fixed.ads.json @@ -0,0 +1,41 @@ +[ +{ + "name": "Fixed.F1", + "location": "fixed.ads:2:9", + "Object_Size": 8, + "Value_Size": 6, + "Alignment": 1, + "Small": { "code": "/", "operands": [ 1.0, 4.0 ] }, + "Range": [ { "code": "/", "operands": [ -16.0, 4.0 ] }, { "code": "/", "operands": [ 16.0, 4.0 ] } ] +} +, +{ + "name": "Fixed.F2", + "location": "fixed.ads:3:9", + "Object_Size": 8, + "Value_Size": 6, + "Alignment": 1, + "Small": 3.333333E-2, + "Range": [ -1.03333323E0, 1.03333323E0 ] +} +, +{ + "name": "Fixed.F3", + "location": "fixed.ads:4:9", + "Object_Size": 8, + "Value_Size": 6, + "Alignment": 1, + "Small": { "code": "/", "operands": [ 1.0, 30.0 ] }, + "Range": [ -1.0, 1.0 ] +} +, +{ + "name": "Fixed.F4", + "location": "fixed.ads:5:9", + "Object_Size": 64, + "Value_Size": 48, + "Alignment": 8, + "Small": 0.1, + "Range": [ -9999999999999.9, 9999999999999.9 ] +} +] diff --git a/testsuite/tests/dda/basic/ints.ads b/testsuite/tests/dda/basic/ints.ads new file mode 100644 index 000000000..a7527b0b5 --- /dev/null +++ b/testsuite/tests/dda/basic/ints.ads @@ -0,0 +1,3 @@ +package Ints is + type I1 is range -256 .. 255; +end Ints; diff --git a/testsuite/tests/dda/basic/ints.ads.json b/testsuite/tests/dda/basic/ints.ads.json new file mode 100644 index 000000000..d875c8723 --- /dev/null +++ b/testsuite/tests/dda/basic/ints.ads.json @@ -0,0 +1,9 @@ +[ +{ + "name": "Ints.I1", + "location": "ints.ads:2:9", + "Object_Size": 16, + "Value_Size": 9, + "Alignment": 2 +} +] diff --git a/testsuite/tests/dda/basic/mods.ads b/testsuite/tests/dda/basic/mods.ads new file mode 100644 index 000000000..116f9c38d --- /dev/null +++ b/testsuite/tests/dda/basic/mods.ads @@ -0,0 +1,4 @@ +package Mods is + type M1 is mod 2 ** 15; + type M2 is mod 2 ** 32; +end Mods; diff --git a/testsuite/tests/dda/basic/mods.ads.json b/testsuite/tests/dda/basic/mods.ads.json new file mode 100644 index 000000000..82e4d499b --- /dev/null +++ b/testsuite/tests/dda/basic/mods.ads.json @@ -0,0 +1,16 @@ +[ +{ + "name": "Mods.M1", + "location": "mods.ads:2:9", + "Object_Size": 16, + "Value_Size": 15, + "Alignment": 2 +} +, +{ + "name": "Mods.M2", + "location": "mods.ads:3:9", + "Size": 32, + "Alignment": 4 +} +] diff --git a/testsuite/tests/dda/basic/pkg.ads b/testsuite/tests/dda/basic/pkg.ads deleted file mode 100644 index 39f1ff2b5..000000000 --- a/testsuite/tests/dda/basic/pkg.ads +++ /dev/null @@ -1,31 +0,0 @@ --- Check basic usage of the Libadalang.Data_Decomposition API, working on --- simple types. - -package Pkg is - type E1 is (A, B, C, D); - - type I1 is range -256 .. 255; - - type M1 is mod 2 ** 15; - type M2 is mod 2 ** 32; - - type R1 is digits 7; - type R2 is digits 7 range 0.0 .. 1.0; - type R3 is new Float; - - type F1 is delta 0.1 range -1.0 .. 1.0; - type F2 is delta 0.1 range -1.0 .. 1.0 with Small => 0.03333333; - type F3 is delta 0.1 range -1.0 .. 1.0 with Small => 1.0 / 30.0; - type F4 is delta 0.1 digits 14; - - type Rec1 is record - B : Boolean; - C : Character; - I : Integer; - end record; - - type Rec2 is null record; - - type Bool_Array is array (Positive range <>) of Boolean; - subtype Bool_Couple is Bool_Array (1 .. 2); -end Pkg; diff --git a/testsuite/tests/dda/basic/pkg.ads.json b/testsuite/tests/dda/basic/pkg.ads.json deleted file mode 100644 index 97c69f89b..000000000 --- a/testsuite/tests/dda/basic/pkg.ads.json +++ /dev/null @@ -1,150 +0,0 @@ -[ -{ - "name": "Pkg.E1", - "location": "pkg.ads:5:9", - "Object_Size": 8, - "Value_Size": 2, - "Alignment": 1 -} -, -{ - "name": "Pkg.I1", - "location": "pkg.ads:7:9", - "Object_Size": 16, - "Value_Size": 9, - "Alignment": 2 -} -, -{ - "name": "Pkg.M1", - "location": "pkg.ads:9:9", - "Object_Size": 16, - "Value_Size": 15, - "Alignment": 2 -} -, -{ - "name": "Pkg.M2", - "location": "pkg.ads:10:9", - "Size": 32, - "Alignment": 4 -} -, -{ - "name": "Pkg.R1", - "location": "pkg.ads:12:9", - "Size": 64, - "Alignment": 8 -} -, -{ - "name": "Pkg.R2", - "location": "pkg.ads:13:9", - "Size": 64, - "Alignment": 8 -} -, -{ - "name": "Pkg.R3", - "location": "pkg.ads:14:9", - "Size": 32, - "Alignment": 4 -} -, -{ - "name": "Pkg.F1", - "location": "pkg.ads:16:9", - "Object_Size": 8, - "Value_Size": 6, - "Alignment": 1, - "Small": { "code": "/", "operands": [ 1.0, 4.0 ] }, - "Range": [ { "code": "/", "operands": [ -16.0, 4.0 ] }, { "code": "/", "operands": [ 16.0, 4.0 ] } ] -} -, -{ - "name": "Pkg.F2", - "location": "pkg.ads:17:9", - "Object_Size": 8, - "Value_Size": 6, - "Alignment": 1, - "Small": 3.333333E-2, - "Range": [ -1.03333323E0, 1.03333323E0 ] -} -, -{ - "name": "Pkg.F3", - "location": "pkg.ads:18:9", - "Object_Size": 8, - "Value_Size": 6, - "Alignment": 1, - "Small": { "code": "/", "operands": [ 1.0, 30.0 ] }, - "Range": [ -1.0, 1.0 ] -} -, -{ - "name": "Pkg.F4", - "location": "pkg.ads:19:9", - "Object_Size": 64, - "Value_Size": 48, - "Alignment": 8, - "Small": 0.1, - "Range": [ -9999999999999.9, 9999999999999.9 ] -} -, -{ - "name": "Pkg.Rec1", - "location": "pkg.ads:21:9", - "Size": 64, - "Alignment": 4, - "record": [ - { - "name": "B", - "Position": 0, - "First_Bit": 0, - "Size": 8 - }, - { - "name": "C", - "Position": 1, - "First_Bit": 0, - "Size": 8 - }, - { - "name": "I", - "Position": 4, - "First_Bit": 0, - "Size": 32 - } - ], - "Bit_Order": "System.Low_Order_First", - "Scalar_Storage_Order": "System.Low_Order_First" -} -, -{ - "name": "Pkg.Rec2", - "location": "pkg.ads:27:9", - "Size": 0, - "Alignment": 1, - "record": [ - ], - "Bit_Order": "System.Low_Order_First", - "Scalar_Storage_Order": "System.Low_Order_First" -} -, -{ - "name": "Pkg.Bool_Array", - "location": "pkg.ads:29:9", - "Alignment": 1, - "Component_Size": 8, - "Scalar_Storage_Order": "System.Low_Order_First" -} -, -{ - "name": "Pkg.Bool_Couple", - "location": "pkg.ads:30:12", - "Size": 16, - "Alignment": 1, - "Component_Size": 8, - "Scalar_Storage_Order": "System.Low_Order_First" -} -] diff --git a/testsuite/tests/dda/basic/reals.ads b/testsuite/tests/dda/basic/reals.ads new file mode 100644 index 000000000..2b3e468e1 --- /dev/null +++ b/testsuite/tests/dda/basic/reals.ads @@ -0,0 +1,5 @@ +package Reals is + type R1 is digits 7; + type R2 is digits 7 range 0.0 .. 1.0; + type R3 is new Float; +end Reals; diff --git a/testsuite/tests/dda/basic/reals.ads.json b/testsuite/tests/dda/basic/reals.ads.json new file mode 100644 index 000000000..3ce986fe7 --- /dev/null +++ b/testsuite/tests/dda/basic/reals.ads.json @@ -0,0 +1,22 @@ +[ +{ + "name": "Reals.R1", + "location": "reals.ads:2:9", + "Size": 64, + "Alignment": 8 +} +, +{ + "name": "Reals.R2", + "location": "reals.ads:3:9", + "Size": 64, + "Alignment": 8 +} +, +{ + "name": "Reals.R3", + "location": "reals.ads:4:9", + "Size": 32, + "Alignment": 4 +} +] diff --git a/testsuite/tests/dda/basic/records.ads b/testsuite/tests/dda/basic/records.ads new file mode 100644 index 000000000..74ef6b59e --- /dev/null +++ b/testsuite/tests/dda/basic/records.ads @@ -0,0 +1,9 @@ +package Records is + type Rec1 is record + B : Boolean; + C : Character; + I : Integer; + end record; + + type Rec2 is null record; +end Records; diff --git a/testsuite/tests/dda/basic/records.ads.json b/testsuite/tests/dda/basic/records.ads.json new file mode 100644 index 000000000..079cda47e --- /dev/null +++ b/testsuite/tests/dda/basic/records.ads.json @@ -0,0 +1,41 @@ +[ +{ + "name": "Records.Rec1", + "location": "records.ads:2:9", + "Size": 64, + "Alignment": 4, + "record": [ + { + "name": "B", + "Position": 0, + "First_Bit": 0, + "Size": 8 + }, + { + "name": "C", + "Position": 1, + "First_Bit": 0, + "Size": 8 + }, + { + "name": "I", + "Position": 4, + "First_Bit": 0, + "Size": 32 + } + ], + "Bit_Order": "System.Low_Order_First", + "Scalar_Storage_Order": "System.Low_Order_First" +} +, +{ + "name": "Records.Rec2", + "location": "records.ads:8:9", + "Size": 0, + "Alignment": 1, + "record": [ + ], + "Bit_Order": "System.Low_Order_First", + "Scalar_Storage_Order": "System.Low_Order_First" +} +] diff --git a/testsuite/tests/dda/basic/test.out b/testsuite/tests/dda/basic/test.out index 5230f5631..8a59c88cf 100644 --- a/testsuite/tests/dda/basic/test.out +++ b/testsuite/tests/dda/basic/test.out @@ -1,92 +1,110 @@ -Analyzing pkg.ads -################# +Analyzing enums.ads +################### -Representation information for : +Representation information for : Kind: ENUMERATION_TYPE Alignment: 1 Object_Size | Value_Size: 8 | 2 -Representation information for : +Analyzing ints.ads +################## + +Representation information for : Kind: SIGNED_TYPE Alignment: 2 Object_Size | Value_Size: 16 | 9 -Representation information for : +Analyzing mods.ads +################## + +Representation information for : Kind: MODULAR_TYPE Alignment: 2 Object_Size | Value_Size: 16 | 15 -Representation information for : +Representation information for : Kind: MODULAR_TYPE Alignment: 4 Object_Size | Value_Size: 32 | 32 -Representation information for : +Analyzing reals.ads +################### + +Representation information for : Kind: FLOATING_TYPE Alignment: 8 Object_Size | Value_Size: 64 | 64 -Representation information for : +Representation information for : Kind: FLOATING_TYPE Alignment: 8 Object_Size | Value_Size: 64 | 64 -Representation information for : +Representation information for : Kind: FLOATING_TYPE Alignment: 4 Object_Size | Value_Size: 32 | 32 -Representation information for : +Analyzing fixed.ads +################### + +Representation information for : Kind: ORDINARY_TYPE Alignment: 1 Object_Size | Value_Size: 8 | 6 Small: 1/4 Range: -4 .. 4 -Representation information for : +Representation information for : Kind: ORDINARY_TYPE Alignment: 1 Object_Size | Value_Size: 8 | 6 Small: 4803839122144569/144115188075855872 Range: -4653719149577551/4503599627370496 .. 4653719149577551/4503599627370496 -Representation information for : +Representation information for : Kind: ORDINARY_TYPE Alignment: 1 Object_Size | Value_Size: 8 | 6 Small: 1/30 Range: -1 .. 1 -Representation information for : +Representation information for : Kind: DECIMAL_TYPE Alignment: 8 Object_Size | Value_Size: 64 | 48 Small: 3602879701896397/36028797018963968 Range: -5119999999999949/512 .. 5119999999999949/512 -Representation information for : +Analyzing records.ads +##################### + +Representation information for : Kind: RECORD_TYPE Alignment: 4 Object_Size | Value_Size: 64 | 64 Bit_Order | Scalar_Storage_Order: LOW_ORDER_FIRST | LOW_ORDER_FIRST -* at 0, size: 8 -* at 1, size: 8 -* at 4, size: 32 +* at 0, size: 8 +* at 1, size: 8 +* at 4, size: 32 -Representation information for : +Representation information for : Kind: RECORD_TYPE Alignment: 1 Object_Size | Value_Size: 0 | 0 Bit_Order | Scalar_Storage_Order: LOW_ORDER_FIRST | LOW_ORDER_FIRST -Representation information for : +Analyzing arrays.ads +#################### + +Representation information for : Kind: ARRAY_TYPE Alignment: 1 Object_Size | Value_Size: | Scalar_Storage_Order: LOW_ORDER_FIRST Component_Size: 8 -Representation information for : +Representation information for : Kind: ARRAY_TYPE Alignment: 1 Object_Size | Value_Size: 16 | 16 diff --git a/testsuite/tests/dda/basic/test.yaml b/testsuite/tests/dda/basic/test.yaml index 5be9529a0..e32faf026 100644 --- a/testsuite/tests/dda/basic/test.yaml +++ b/testsuite/tests/dda/basic/test.yaml @@ -1,2 +1,12 @@ driver: dda -input_sources: [pkg.ads] +description: | + Check basic usage of the Libadalang.Data_Decomposition API, working on + simple types. +input_sources: + - enums.ads + - ints.ads + - mods.ads + - reals.ads + - fixed.ads + - records.ads + - arrays.ads