Commit | Line | Data |
951ddfe8 |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use Test::More 'no_plan'; |
5 | $| = 1; |
6 | |
7 | |
8 | |
9 | # =begin testing |
10 | { |
11 | use Text::Tradition; |
12 | |
13 | my $t = Text::Tradition->new( |
14 | 'name' => 'simple test', |
15 | 'input' => 'Tabular', |
16 | 'file' => 't/data/simple.txt', |
17 | ); |
951ddfe8 |
18 | is( $t->stemma_count, 0, "No stemmas added yet" ); |
19 | my $s; |
20 | ok( $s = $t->add_stemma( dotfile => 't/data/simple.dot' ), "Added a simple stemma" ); |
21 | is( ref( $s ), 'Text::Tradition::Stemma', "Got a stemma object returned" ); |
22 | is( $t->stemma_count, 1, "Tradition claims to have a stemma" ); |
23 | is( $t->stemma(0), $s, "Tradition hands back the right stemma" ); |
24 | } |
25 | |
26 | |
27 | |
a47b32d9 |
28 | # =begin testing |
29 | { |
30 | use Text::Tradition; |
31 | use JSON qw/ from_json /; |
32 | |
33 | my $t = Text::Tradition->new( |
34 | 'name' => 'Stemweb test', |
35 | 'input' => 'Self', |
36 | 'file' => 't/data/besoin.xml', |
37 | 'stemweb_jobid' => '4', |
38 | ); |
39 | |
40 | is( $t->stemma_count, 0, "No stemmas added yet" ); |
41 | |
42 | my $answer = from_json( '{"status": 0, "job_id": "4", "algorithm": "RHM", "format": "newick", "start_time": "2013-10-26 10:44:14.050263", "result": "((((((((((((F,U),V),S),T1),T2),A),J),B),L),D),M),C);\n", "end_time": "2013-10-26 10:45:55.398944"}' ); |
43 | $t->record_stemweb_result( $answer ); |
44 | ok( !$t->has_stemweb_jobid, "Job ID was removed from tradition" ); |
45 | is( $t->stemma_count, 1, "Tradition has new stemma" ); |
46 | ok( $t->stemma(0)->is_undirected, "New stemma is undirected as it should be" ); |
47 | is( $t->stemma(0)->identifier, "RHM 1382777054_0", "Stemma has correct identifier" ); |
48 | } |
49 | |
50 | |
51 | |
951ddfe8 |
52 | |
53 | 1; |