summaryrefslogtreecommitdiff
path: root/test/test_main.adb
blob: fc77c1546cf777000d8d4a116273e6ff7b7f8237 (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
91
92


with

    Ada.Text_IO,
    Ada.Command_Line,
    Ada.Characters.Latin_1,
    Unit_Tests,
    Graph_Tests.Basic,
    Graph_Tests.Inspection,
    Graph_Tests.Context,
    Graph_Tests.Curses,
    Graph_Tests.Labels,
    Graph_Tests.Modify,
    Graph_Tests.Search;


use

    Ada.Text_IO,
    Unit_Tests;


procedure Test_Main is


    package Latin renames Ada.Characters.Latin_1;


    Help_String : String :=
        "Runs unit tests on the Ada Directed Graph library." & Latin.LF &
        "Usage: graphtest [switches]" & Latin.LF &
        Latin.LF &
        "Valid switches:" & Latin.LF &
        "--help" & Latin.HT & Latin.HT & "Shows this information" & Latin.LF &
        "--verbose" & Latin.HT & "Enables extra verbosity" & Latin.LF &
        Latin.LF &
        "All other command line input will be ignored.";


    How_Verbose : Verbosity := Weak;


begin


    for N in 1 .. Ada.Command_Line.Argument_Count loop
        if Ada.Command_Line.Argument (N) = "--help" then
            Put_Line (Help_String);
            return;
        end if;
    end loop;

    for N in 1 .. Ada.Command_Line.Argument_Count loop
        if Ada.Command_Line.Argument (N) = "--verbose" then
            How_Verbose := Strong;
            exit;
        end if;
    end loop;


    Put_Line ("Running basic tests...");
    Run_Tests (Graph_Tests.Basic.Tests, How_Verbose);
    New_Line;

    Put_Line ("Running inspection tests...");
    Run_Tests (Graph_Tests.Inspection.Tests, How_Verbose);
    New_Line;

    Put_Line ("Running context tests...");
    Run_Tests (Graph_Tests.Context.Tests, How_Verbose);
    New_Line;

    Put_Line ("Running cursor tests...");
    Run_Tests (Graph_Tests.Curses.Tests, How_Verbose);
    New_Line;

    Put_Line ("Running label tests...");
    Run_Tests (Graph_Tests.Labels.Tests, How_Verbose);
    New_Line;

    Put_Line ("Running modify tests...");
    Run_Tests (Graph_Tests.Modify.Tests, How_Verbose);
    New_Line;

    Put_Line ("Running search tests...");
    Run_Tests (Graph_Tests.Search.Tests, How_Verbose);


end Test_Main;