summaryrefslogtreecommitdiff
path: root/test/rembero.adb
blob: 669d42acf669cf539eb121ffe99293fce1554e5d (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


--  Programmed by Jedidiah Barber
--  Licensed under the Sunset License v1.0

--  See license.txt for further details


with

    Ada.Characters.Latin_1,
    Ada.Text_IO,
    Kompsos.Pretty_Print;


procedure Rembero is

    package Latin renames Ada.Characters.Latin_1;
    package TIO   renames Ada.Text_IO;


    package InKomp is new Kompsos (Integer);
    use InKomp;

    package Printer is new InKomp.Pretty_Print (Integer'Image);

    Verse : World := Empty_World;

begin

    TIO.Put_Line ("Test program to check if calculating an infinite number of results works.");
    TIO.New_Line;
    TIO.Put_Line ("It will call rembero with variables as all arguments.");
    TIO.Put_Line ("The first 5 results will be displayed.");

    TIO.New_Line;

    Verse.Remove (Verse.Fresh ("item") & Verse.Fresh ("list") & Verse.Fresh ("out"));

    declare
        First_Five : constant State_Array := Verse.Take (5);
    begin
        TIO.Put_Line ("Raw results:");
        TIO.Put_Line (Printer.Image (First_Five));

        TIO.New_Line;

        TIO.Put_Line ("Reified results:");
        for Index in First_Five'Range loop
            TIO.Put_Line ("#" & Printer.Image (Index) & ":");
            TIO.Put_Line (Latin.HT & "item: " &
                Printer.Image (Resolve_First (First_Five (Index), "item")));
            TIO.Put_Line (Latin.HT & "list: " &
                Printer.Image (Resolve_First (First_Five (Index), "list")));
            TIO.Put_Line (Latin.HT & "out: " &
                Printer.Image (Resolve_First (First_Five (Index), "out")));
        end loop;
    end;

end Rembero;