File: 03_DB_FlatFileDir.t

package info (click to toggle)
libtfbs-perl 0.7.1%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,992 kB
  • sloc: perl: 10,728; ansic: 1,228; makefile: 560; sh: 9
file content (47 lines) | stat: -rw-r--r-- 786 bytes parent folder | download | duplicates (8)
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
42
43
44
45
46
47
#!/usr/bin/env perl -w 

use TFBS::Matrix::PFM;
use TFBS::DB::FlatFileDir;
use Test;
plan(tests => 2);

my @dbparams;


# set up a matrix

my $matrixstring =
        "12 3 0 0 4 0\n0 0 0 11 7 0\n0 9 12 0 0 0\n0 0 0 1 1 12";
my $pfm = TFBS::Matrix::PFM->new(-matrix=>$matrixstring, -ID=>"TEST001");
my $rawstring1 = $pfm->rawprint();

my $db;

# write/read test

$db = TFBS::DB::FlatFileDir->create ("t/FlatFileDir");
$db->store_Matrix($pfm);
my $pfm2= $db->get_Matrix_by_ID("TEST001", "PFM");
my $rawstring2 = $pfm2->rawprint;

ok ($rawstring1, $rawstring2);


# delete test

$db->delete_Matrix_having_ID('TEST001');
my $nopfm = $db->get_Matrix_by_ID("TEST001", "PFM");

ok(undef, $nopfm);



END {

    -d "t/FlatFileDir" && 
	unlink <t/FlatFileDir/*>;
    rmdir "t/FlatFileDir";
}