summaryrefslogtreecommitdiff
path: root/test.adb
diff options
context:
space:
mode:
authorrexim <reximkut@gmail.com>2024-03-15 02:08:17 +0700
committerrexim <reximkut@gmail.com>2024-03-15 02:08:17 +0700
commit3bb2d4553854123bba2a67beb6860cda635dbd69 (patch)
treef41ad6adb098803a79f4f704ea561bed7246eb4c /test.adb
parent4a331a1e14de95fde030d7fc0f7834c97dedc002 (diff)
Check the boundaries of the map
Diffstat (limited to 'test.adb')
-rw-r--r--test.adb43
1 files changed, 5 insertions, 38 deletions
diff --git a/test.adb b/test.adb
index cc93b77..490bb22 100644
--- a/test.adb
+++ b/test.adb
@@ -6,43 +6,10 @@ with Ada.Containers.Vectors;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
procedure Test is
- File_Name: constant String := "colors.txt";
- F: File_Type;
-
- function Chop_By(Src: in out Unbounded_String; Pattern: String) return Unbounded_String is
- Space_Index: Integer := Index(Src, Pattern);
- Result: Unbounded_String;
- begin
- if Space_Index = 0 then
- Result := Src;
- Src := Null_Unbounded_String;
- else
- Result := Unbounded_Slice(Src, 1, Space_Index - 1);
- Src := Unbounded_Slice(Src, Space_Index + 1, Length(Src));
- end if;
-
- return Result;
- end;
+ Map: array (1..10, 1..20) of Integer := [others => [others => 0]];
+ Index: array (1..2) of Integer;
begin
- Open(F, In_File, File_Name);
- while not End_Of_File(F) loop
- declare
- Line: Unbounded_String := To_Unbounded_String(Get_Line(F));
- begin
- Line := Trim(Line, Ada.Strings.Left);
- Put_Line('"' & To_String(Chop_By(Line, " ")) & '"');
-
- for Times in 1..4 loop
- Line := Trim(Line, Ada.Strings.Left);
- declare
- Token: Unbounded_String := Chop_By(Line, " ");
- begin
- -- Put_Line(Float'Value(To_String(Token))'Image);
- Put_Line(To_String(Token));
- end;
- end loop;
- end;
- Put_Line("------------------------------");
- end loop;
- Close(F);
+ if Index in Map then
+ Map() := 1;
+ end if;
end;