File: test.adb

package info (click to toggle)
libgnatcoll 18-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,068 kB
  • sloc: ada: 40,393; python: 354; ansic: 310; makefile: 245; sh: 31
file content (28 lines) | stat: -rw-r--r-- 745 bytes parent folder | download | duplicates (3)
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
with Ada.Text_IO;
with GNATCOLL.JSON;
with Test_Assert;

function Test return Integer is

   package A renames Test_Assert;
   package JSON renames GNATCOLL.JSON;

   use type JSON.JSON_Value_Type;

   Content : constant String := "14"; 
begin
   declare
      Value   : JSON.JSON_Value := JSON.Read
         (Strm     => Content,
          Filename => "<data>");
      Result  : Integer;
      Result2 : JSON.JSON_Value;
   begin
      A.Assert (True, "passed");
      A.Assert (JSON.Kind (Value) = JSON.JSON_Int_Type,
                "check if type is JSON_Int_Type (got " & JSON.Kind (Value)'Img & ")");
      Result := JSON.Get (Value);
      A.Assert (Result = 14, "check that result is equal to 14");
   end;
   return A.Report;
end Test;