Skip to content

Commit d23baa3

Browse files
committed
Added test case enum_range_checks to test using enumeration position..
Using enumeration literal position instead of enumeration literal representation for enumeration types maintains an order relation between literals of an enumeration. This test fails for a number of reasons prior to the mods on this branch.
1 parent 16ff2f0 commit d23baa3

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
procedure Enums is
2+
type My_Enum is (one, two, three, four, five);
3+
4+
subtype Enum_Sub is My_Enum range two .. four;
5+
6+
VE : My_Enum;
7+
VS : Enum_Sub;
8+
T : My_Enum;
9+
begin
10+
VE := one;
11+
VS := two;
12+
T := VE;
13+
VE := VS;
14+
VS := VE;
15+
VE := T;
16+
pragma Assert (VE in My_Enum);
17+
pragma Assert (VE >= My_Enum'First and VE <= My_Enum'Last);
18+
pragma Assert (VE >= Enum_Sub'First and VE <= Enum_Sub'Last);
19+
pragma Assert (VS in My_Enum);
20+
pragma Assert (VS >= My_Enum'First and VS <= My_Enum'Last);
21+
pragma Assert (VS >= Enum_Sub'First and VS <= Enum_Sub'Last);
22+
pragma Assert (VE <= VS);
23+
pragma Assert (VE <= My_Enum'Last);
24+
pragma Assert (VE >= My_Enum'First);
25+
pragma Assert (VE in Enum_Sub);
26+
pragma Assert (VE >= Enum_Sub'First);
27+
pragma Assert (VE = one);
28+
pragma Assert (VE = T);
29+
pragma Assert (VS = two);
30+
pragma Assert (T = one);
31+
end Enums;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[enum.assertion.1] line 8 assertion A = Get_A: SUCCESS
2+
[enum.assertion.2] line 10 assertion B = Get_B: SUCCESS
3+
[enum.assertion.3] line 12 assertion Get_A /= Get_B: SUCCESS
4+
[enum.assertion.4] line 14 assertion Get_A = Get_B: FAILURE
5+
VERIFICATION FAILED
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from test_support import *
2+
3+
prove()

0 commit comments

Comments
 (0)