Commit 7d3ef87c authored by MARTINEZ Thierry 's avatar MARTINEZ Thierry

Graph editor tests

parent 89c992a8
:- use_module(library(plunit)).
:- begin_tests(graph_editor).
test('new_graph', [true(Graphs == [new_graph])]) :-
clear_model,
new_graph,
all_items([kind: graph], Graphs).
test('delete_graph', [true(Graphs == [])]) :-
clear_model,
new_graph,
delete_graph(new_graph),
all_items([kind: graph], Graphs).
test('set_graph_name', [true(Graphs == [my_graph])]) :-
clear_model,
new_graph,
set_graph_name(my_graph),
all_items([kind: graph], Graphs).
test('list_graphs', [true(Atom == '[0] new_graph\n')]) :-
clear_model,
new_graph,
with_output_to(atom(Atom), list_graphs).
test('select_graph', [true(Item == graphA)]) :-
clear_model,
new_graph,
set_graph_name(graphA),
new_graph,
set_graph_name(graphB),
select_graph(graphA),
get_current_graph(Id),
find_item([id: Id, item: Item]).
% draw_graph/0,
% export_graph/1,
test('add_vertex', [true(Vertices == ['A'])]) :-
clear_model,
new_graph,
add_vertex('A'),
get_current_graph(Id),
all_items([kind: vertex], Vertices).
test('delete_vertex', [true(Vertices == [])]) :-
clear_model,
new_graph,
add_vertex('A'),
delete_vertex('A'),
get_current_graph(Id),
all_items([kind: vertex], Vertices).
test('add_attribute', [true(Attributes == ['object'])]) :-
clear_model,
new_graph,
add_vertex('A'),
add_attribute('A', object),
get_current_graph(GraphId),
find_item([parent: GraphId, kind: vertex, key: 'A', id: VertexId]),
all_items([parent: VertexId, kind: attribute], Attributes).
test('delete_vertex', [true(Vertices == [])]) :-
clear_model,
new_graph,
add_vertex('A'),
delete_vertex('A'),
get_current_graph(Id),
all_items([kind: vertex], Vertices).
% add_attribute/2,
% delete_attribute/2,
% edge/1,
% add_edge/1,
% delete_edge/1,
% list_edges/0
:- end_tests(graph_editor).
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment