summaryrefslogtreecommitdiff
path: root/test/graph_tests-curses.adb
blob: 36678255346509cd2a6a7f8ea97092d4bf6ade8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90


package body Graph_Tests.Curses is


    function First_Check
        return Test_Result
    is
        use type Graphs.Cursor;
    begin
        if My_Complex_Graph.First /= My_Complex_Graph.To_Cursor (1) or
            My_Nonempty_Graph.First /= My_Nonempty_Graph.To_Cursor (2)
        then
            return Fail;
        end if;
        return Pass;
    end First_Check;


    function Last_Check
        return Test_Result
    is
        use type Graphs.Cursor;
    begin
        if My_Complex_Graph.Last /= My_Complex_Graph.To_Cursor (10) or
            My_Nonempty_Graph.Last /= My_Nonempty_Graph.To_Cursor (11)
        then
            return Fail;
        end if;
        return Pass;
    end Last_Check;


    function Next_Check
        return Test_Result
    is
        use type Graphs.Cursor;
    begin
        if Graphs.Next (My_Complex_Graph.To_Cursor (3)) /= My_Complex_Graph.To_Cursor (4) or
            Graphs.Next (My_Complex_Graph.To_Cursor (10)) /= Graphs.No_Element
        then
            return Fail;
        end if;
        return Pass;
    end Next_Check;


    function Previous_Check
        return Test_Result
    is
        use type Graphs.Cursor;
    begin
        if Graphs.Previous (My_Complex_Graph.To_Cursor (6)) /= My_Complex_Graph.To_Cursor (5) or
            Graphs.Previous (My_Complex_Graph.To_Cursor (1)) /= Graphs.No_Element
        then
            return Fail;
        end if;
        return Pass;
    end Previous_Check;


    function Follow_Check
        return Test_Result
    is
        use type Graphs.Cursor;
        Start : Graphs.Cursor := My_Complex_Graph.To_Cursor (1);
    begin
        if Graphs.Follow (Start, (1, 1, 2)) /= My_Complex_Graph.To_Cursor (2) then
            return Fail;
        end if;
        return Pass;
    end Follow_Check;


    function Cursor_To_Check
        return Test_Result
    is
        use type Graphs.Cursor;
        Start : Graphs.Cursor := My_Complex_Graph.To_Cursor (2);
    begin
        if Graphs.Cursor_To (Start, 9) /= My_Complex_Graph.To_Cursor (9) then
            return Fail;
        end if;
        return Pass;
    end Cursor_To_Check;


end Graph_Tests.Curses;