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;
|