File: DSM.t

package info (click to toggle)
libgraph-writer-dsm-perl 0.008-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 108 kB
  • sloc: perl: 164; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,028 bytes parent folder | download | duplicates (3)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
package Test::Graph::Writer::DSM;
use parent qw(t::Graph::Writer::DSM::Test);
use Test::Most 'no_plan';
use Test::File;
use Graph;

BEGIN {
  use_ok 'Graph::Writer::DSM';
};

sub test_constructor : Tests {
  my $writer = Graph::Writer::DSM->new;
  isa_ok($writer, 'Graph::Writer::DSM');
}

sub write_output_file : Tests {
  my $graph = Graph->new;
  $graph->add_vertex('A');
  $graph->add_vertex('B');
  $graph->add_vertex('C');
  $graph->add_edge('A', 'B');
  $graph->add_edge('A', 'C');
  my $writer = Graph::Writer::DSM->new;
  $writer->write_graph($graph, "output.png");
  file_exists_ok "output.png";
}

sub output_file_isnt_empty : Tests {
  my $self = shift;
  return diag('gnuplot not found')
    unless $self->can_run('gnuplot');
  my $graph = Graph->new;
  $graph->add_vertex('A');
  $graph->add_vertex('B');
  $graph->add_vertex('C');
  $graph->add_edge('A', 'B');
  $graph->add_edge('A', 'C');
  my $writer = Graph::Writer::DSM->new;
  $writer->write_graph($graph, "output.png");
  file_not_empty_ok "output.png";
}