#!/usr/bin/perl -w # test anonymous nodes use Test::More; use strict; BEGIN { plan tests => 31; chdir 't' if -d 't'; use lib '../lib'; use_ok ("Graph::Easy::Node::Anon") or die($@); use_ok ("Graph::Easy") or die($@); use_ok ("Graph::Easy::As_txt") or die($@); require_ok ("Graph::Easy::As_ascii") or die($@); }; can_ok ("Graph::Easy::Node::Anon", qw/ new as_txt as_html error class name successors predecessors width height pos x y class del_attribute set_attribute set_attributes attribute attributes_as_txt as_pure_txt group add_to_group /); ############################################################################# my $node = Graph::Easy::Node::Anon->new(); is (ref($node), 'Graph::Easy::Node::Anon'); is ($node->error(), '', 'no error yet'); is ($node->x(), undef, 'x == undef'); is ($node->y(), undef, 'y == undef'); is ($node->width(), undef, 'w == undef'); is ($node->height(), undef, 'h == undef'); is ($node->label(), ' ', 'label'); is ($node->name(), '#0', 'name'); is ($node->title(), '', 'no title per default'); is (join(",", $node->pos()), "0,0", 'pos = 0,0'); is ($node->{graph}, undef, 'no graph'); is (scalar $node->successors(), undef, 'no outgoing links'); is (scalar $node->predecessors(), undef, 'no incoming links'); is ($node->{graph}, undef, 'successors/predecssors leave graph alone'); $node->_correct_size(); is ($node->width(), 3, 'w == 3'); is ($node->height(), 3, 'h == 3'); ############################################################################# # as_txt/as_html my $graph = Graph::Easy->new(); $graph->add_node($node); is ($node->as_txt(), '[ ]', 'anon as_txt'); is ($node->as_html(), "