0
|
1 #! perl
|
|
2 use diagnostics;
|
|
3 use warnings;
|
|
4 no warnings qw/void/;
|
|
5 use strict;
|
|
6 no strict "refs" ;
|
|
7 #use Test::More qw( no_plan );
|
|
8 use Test::More tests => 29 ;
|
|
9 use FindBin ;
|
|
10
|
|
11 ## Specific Modules
|
|
12 use lib $FindBin::Bin ;
|
|
13 my $binPath = $FindBin::Bin ;
|
|
14 use lib::hrTest qw( :ALL ) ;
|
|
15
|
|
16 ## testing manage_atoms
|
|
17 print "\n-- Test manage_atoms lib\n\n" ;
|
|
18 is( manage_atomsTest('', 'C,H,O,N'),'C,H,O,N', 'Works with void argvt' ) ;
|
|
19 is( manage_atomsTest(undef, 'C,H,O,N'), 'C,H,O,N', 'Works with undef argvt in input');
|
|
20 isnt( manage_atomsTest('C,H,O,N', undef), 'C,H,O,N', 'Doesn\'t work with undef argvt in conf');
|
|
21 is( manage_atomsTest(' ', 'C,H,O,N'), 'C,H,O,N', 'Works with \'space\' argvt in input' ) ;
|
|
22 is( manage_atomsTest('None', 'C,H,O,N'), 'C,H,O,N', 'Works with \'None\' argvt in input' ) ;
|
|
23 isnt( manage_atomsTest('C,H,O,N', 'C,H,O,N'), 'C,H,O,N', 'Doesn\'t work with same argvt in conf and input' );
|
|
24 is( manage_atomsTest('P', 'C,H,O,N'), 'C,H,O,N,P', 'Works with P argvt in input');
|
|
25 is( manage_atomsTest('1', 'C,H,O,N'), 'C,H,O,N,1', 'Works with 13C argvt in input');
|
|
26 is( manage_atomsTest('P,S', 'C,H,O,N'), 'C,H,O,N,P,S', 'Works with P and S argvt in input');
|
|
27 is( manage_atomsTest('X', 'C,H,O,N'), 'C,H,O,N', 'Doesn\'t work with other character diff than [P|S|F|L|K|B|A|1|] in input');
|
|
28 print "\n--\n" ;
|
|
29
|
|
30 print "\n-- Test check_hr_exe lib\n\n" ;
|
|
31 is ( check_hr_exeTest('J:\\BioInfoTools\\_BINARIES\\HR2-all-res.exe', 'hr version 20050617'), 1, 'Works with WIN path and good version') ;
|
|
32 is ( check_hr_exeTest('J:\\BioInfoTools\\_BINARIES\\HR2-all-res.exe', undef), undef, 'Doesn\'t work with WIN path and bad version') ;
|
|
33 is ( check_hr_exeTest('Z:\\BioInfoTools\\TOTO\\HR2-all-res.exe', 'hr version 20050617'), undef, 'Doesn\'t work with bullshit path and good version') ;
|
|
34 is ( check_hr_exeTest(undef, 'hr version 20050617'), undef, 'Doesn\'t work with undef path and good version') ;
|
|
35 # need to test unix path
|
|
36 print "\n--\n" ;
|
|
37
|
|
38 print "\n-- Test manage_tolerance lib --\n\n" ;
|
|
39 is ( manage_toleranceTest( '5.0', '1.0' ), '5.0', 'Works with tolerance of 5.0' ) ;
|
|
40 is ( manage_toleranceTest( '5,0', '1.0' ), '5.0', 'Works with tolerance of 5,0 (french number)' ) ;
|
|
41 is ( manage_toleranceTest( undef, '1.0' ), undef, 'Doesn\'t work with undef tolerance' ) ;
|
|
42 is ( manage_toleranceTest( '5.0', undef ), undef, 'Doesn\'t work with undef default tolerance' ) ;
|
|
43 is ( manage_toleranceTest( '20.0', '1.0' ), '1.0', 'Works with hight tolerance (20.0), use default tolerance' ) ;
|
|
44 is ( manage_toleranceTest( '-10.0', '1.0' ), '1.0', 'Works with negative tolerance (-10.0), use default tolerance' ) ;
|
|
45 print "\n--\n" ;
|
|
46
|
|
47 print "\n-- Test manage_mode lib\n\n" ;
|
|
48 is ( manage_modeTest('positive', '1', '0.0005486', '1.007825', '100.00'), '98.9927236', 'Works and computes right mass (98.9927236) with positive mode and complete conf') ;
|
|
49 is ( manage_modeTest('negative', '1', '0.0005486', '1.007825', '100.00') , '101.0072764', 'Works and computes right mass (101.0072764) with negative mode and complete conf') ;
|
|
50 is ( manage_modeTest('neutral', '1', '0.0005486', '1.007825', '100.00' ), '100.00', 'Works and computes right mass (100.00) with neutral mode and complete conf') ;
|
|
51 is ( manage_modeTest('banane', '1', '0.0005486', '1.007825', '100.00' ), undef, 'Works and warns with unbelievable argt mode') ;
|
|
52 is ( manage_modeTest('positive', '1', '0.0005486', '1.007825', '100,00' ), '98.9927236', 'Works with french mass format in positive mode') ;
|
|
53 is ( manage_modeTest('neutral', '1', undef, undef, '100.00' ), undef, 'Works and warns when missing some conf paramaters (electron, proton, mass)') ;
|
|
54 is ( manage_modeTest('negative', '0', '0.0005486', '1.007825', '100.00') , '101.0072764', 'Works and computes right mass (101.0072764) with negative mode and charge = 0 become 1 ') ;
|
|
55 is ( manage_modeTest('positive', '3', '0.0005486', '1.007825', '100.00'), '298.9938208', 'Works and computes right mass (298.9938208) with positive mode, charge = 3 and complete conf') ;
|
|
56 is ( manage_modeTest('neutral', undef, '0.0005486', '1.007825', '100.00' ), '100.00', 'Works and warns when missing charge') ;
|
|
57 print "\n--\n" ;
|
|
58
|
|
59
|
|
60
|
|
61
|
|
62
|
|
63
|
|
64
|