Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/json/tst/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 21.5.2025 mit Größe 691 B image not shown  

Quelle  test_stream.tst   Sprache: unbekannt

 
gap> LoadPackage("json", false);;
gap> test_stream := function(str, res)
> local g, s, i;
> s := InputTextString(str);
> for i in res do
>   g := JsonStreamToGap(s);
>   if g <> i then
>     Print("Failed: ",[str,res]," index ", i , " produced ", g, "\n");
>   fi;
> od;
> end;;
gap> test_stream("1",[1]);
gap> test_stream("1 2",[1,2]);
gap> test_stream("[1][2]",[[1],[2]]);
gap> test_stream("{}{}",[rec(), rec()]);
gap> test_stream("\"abc\"\"def\"", ["abc", "def"]);
gap> test_stream("\"abc\" \"def\"", ["abc", "def"]);
gap> test_stream("1", [1,1]);
Error, syntax error at line 1 near: 
gap> test_stream("\"\"", [""]);
gap> test_stream("\"\"", ["",1]);
Error, syntax error at line 1 near: 

[ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet)  ]