CollateX format for GraphML output changed; parser update
[scpubgit/stemmatology.git] / t / text_tradition_collation_relationshipstore.t
CommitLineData
b0b4421a 1#!/usr/bin/perl -w
2
3use strict;
4use Test::More 'no_plan';
5$| = 1;
6
7
8
9# =begin testing
10{
11use Text::Tradition;
ee801e17 12use TryCatch;
b0b4421a 13
14use_ok( 'Text::Tradition::Collation::RelationshipStore' );
ee801e17 15
16# Add some relationships, and delete them
17
18my $cxfile = 't/data/Collatex-16.xml';
19my $t = Text::Tradition->new(
20 'name' => 'inline',
21 'input' => 'CollateX',
22 'file' => $cxfile,
23 );
24my $c = $t->collation;
25
26my @v1 = $c->add_relationship( 'n21', 'n22', { 'type' => 'meaning' } );
27is( scalar @v1, 1, "Added a single relationship" );
28is( $v1[0]->[0], 'n21', "Got correct node 1" );
29is( $v1[0]->[1], 'n22', "Got correct node 2" );
f2fec47d 30my @v2 = $c->add_relationship( 'n24', 'n23',
ee801e17 31 { 'type' => 'spelling', 'scope' => 'global' } );
32is( scalar @v2, 2, "Added a global relationship with two instances" );
33@v1 = $c->del_relationship( 'n22', 'n21' );
34is( scalar @v1, 1, "Deleted first relationship" );
f2fec47d 35@v2 = $c->del_relationship( 'n12', 'n13' );
ee801e17 36is( scalar @v2, 2, "Deleted second global relationship" );
681893aa 37my @v3 = $c->del_relationship( 'n1', 'n2' );
38is( scalar @v3, 0, "Nothing deleted on non-existent relationship" );
b0b4421a 39}
40
41
42
43
441;