1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # Base module for tests related to `neo_doxygen`.
20 # Adds debugging output to graphs.
23 # Append the debugging output of all relationships to the specified buffer.
24 fun debug
(buffer
: Buffer) do
25 buffer
.append
"# Graph\n"
26 for edge
in all_edges
do
32 # Adds debugging output to relationships.
35 # Append the debugging output of this relationship to the specified buffer.
37 # Append the relationship type, the properties, and the debugging output of
39 fun debug
(buffer
: Buffer) do
40 var rel_type
= self.rel_type
or else "?"
41 buffer
.append
"Edge\n"
42 buffer
.append
"=type={rel_type.length}:{rel_type}\n"
43 buffer
.append
"=properties=JsonObject({properties.length}):\n"
44 buffer
.append properties
.to_json
45 buffer
.append
"\n----\n=from="
47 buffer
.append
"----\n=to="
53 # Adds debugging output to nodes.
56 # Append the debugging output of this node to the specified buffer.
58 # Append the labels and the properties.
59 fun debug
(buffer
: Buffer) do
60 buffer
.append
"Node\n"
61 buffer
.append
"=labels=Array({labels.length}):\n"
62 for lab
in labels
do buffer
.append
"{lab.length}:{lab}\n"
63 buffer
.append
"=properties=JsonObject({properties.length}):\n"
64 buffer
.append properties
.to_json
69 # Adds debugging output to entities.
72 # Append the debugging output of this entity to the specified buffer.
74 # Append the `model_id`, the labels and the properties.
75 redef fun debug
(buffer
) do
76 buffer
.append
"Entity#{model_id.length}:{model_id}\n"
77 buffer
.append
"=labels=Array({labels.length}):\n"
78 for lab
in labels
do buffer
.append
"{lab.length}:{lab}\n"
79 buffer
.append
"=properties=JsonObject({properties.length}):\n"
80 buffer
.append properties
.to_json