From 82a42674ba64c6386152a5910fd7345a92b135e8 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 21 May 2020 21:24:25 +1000 Subject: Tests complete, minor bugs fixed --- test/graph_tests-curses.adb | 90 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 test/graph_tests-curses.adb (limited to 'test/graph_tests-curses.adb') diff --git a/test/graph_tests-curses.adb b/test/graph_tests-curses.adb new file mode 100644 index 0000000..3667825 --- /dev/null +++ b/test/graph_tests-curses.adb @@ -0,0 +1,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; + + -- cgit