annotate t/hr2_managerTest.t @ 3:78afd7f439f3 draft default tip

master branch Updating with tag :CI_COMMIT_TAG - - Fxx
author fgiacomoni
date Wed, 15 Feb 2023 15:57:49 +0000
parents 86296c048e46
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
1 #! perl
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
2 use diagnostics;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
3 use warnings;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
4 no warnings qw/void/;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
5 use strict;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
6 no strict "refs" ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
7 #use Test::More qw( no_plan );
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
8 use Test::More tests => 29 ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
9 use FindBin ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
10
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
11 ## Specific Modules
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
12 use lib $FindBin::Bin ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
13 my $binPath = $FindBin::Bin ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
14 use lib::hrTest qw( :ALL ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
15
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
16 ## testing manage_atoms
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
17 print "\n-- Test manage_atoms lib\n\n" ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
18 is( manage_atomsTest('', 'C,H,O,N'),'C,H,O,N', 'Works with void argvt' ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
19 is( manage_atomsTest(undef, 'C,H,O,N'), 'C,H,O,N', 'Works with undef argvt in input');
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
20 isnt( manage_atomsTest('C,H,O,N', undef), 'C,H,O,N', 'Doesn\'t work with undef argvt in conf');
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
21 is( manage_atomsTest(' ', 'C,H,O,N'), 'C,H,O,N', 'Works with \'space\' argvt in input' ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
22 is( manage_atomsTest('None', 'C,H,O,N'), 'C,H,O,N', 'Works with \'None\' argvt in input' ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
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' );
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
24 is( manage_atomsTest('P', 'C,H,O,N'), 'C,H,O,N,P', 'Works with P argvt in input');
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
25 is( manage_atomsTest('1', 'C,H,O,N'), 'C,H,O,N,1', 'Works with 13C argvt in input');
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
26 is( manage_atomsTest('P,S', 'C,H,O,N'), 'C,H,O,N,P,S', 'Works with P and S argvt in input');
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
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');
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
28 print "\n--\n" ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
29
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
30 print "\n-- Test check_hr_exe lib\n\n" ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
31 is ( check_hr_exeTest('J:\\BioInfoTools\\_BINARIES\\HR2-all-res.exe', 'hr version 20050617'), 1, 'Works with WIN path and good version') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
32 is ( check_hr_exeTest('J:\\BioInfoTools\\_BINARIES\\HR2-all-res.exe', undef), undef, 'Doesn\'t work with WIN path and bad version') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
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') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
34 is ( check_hr_exeTest(undef, 'hr version 20050617'), undef, 'Doesn\'t work with undef path and good version') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
35 # need to test unix path
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
36 print "\n--\n" ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
37
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
38 print "\n-- Test manage_tolerance lib --\n\n" ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
39 is ( manage_toleranceTest( '5.0', '1.0' ), '5.0', 'Works with tolerance of 5.0' ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
40 is ( manage_toleranceTest( '5,0', '1.0' ), '5.0', 'Works with tolerance of 5,0 (french number)' ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
41 is ( manage_toleranceTest( undef, '1.0' ), undef, 'Doesn\'t work with undef tolerance' ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
42 is ( manage_toleranceTest( '5.0', undef ), undef, 'Doesn\'t work with undef default tolerance' ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
43 is ( manage_toleranceTest( '20.0', '1.0' ), '1.0', 'Works with hight tolerance (20.0), use default tolerance' ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
44 is ( manage_toleranceTest( '-10.0', '1.0' ), '1.0', 'Works with negative tolerance (-10.0), use default tolerance' ) ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
45 print "\n--\n" ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
46
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
47 print "\n-- Test manage_mode lib\n\n" ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
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') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
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') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
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') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
51 is ( manage_modeTest('banane', '1', '0.0005486', '1.007825', '100.00' ), undef, 'Works and warns with unbelievable argt mode') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
52 is ( manage_modeTest('positive', '1', '0.0005486', '1.007825', '100,00' ), '98.9927236', 'Works with french mass format in positive mode') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
53 is ( manage_modeTest('neutral', '1', undef, undef, '100.00' ), undef, 'Works and warns when missing some conf paramaters (electron, proton, mass)') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
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 ') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
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') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
56 is ( manage_modeTest('neutral', undef, '0.0005486', '1.007825', '100.00' ), '100.00', 'Works and warns when missing charge') ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
57 print "\n--\n" ;
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
58
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
59
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
60
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
61
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
62
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
63
86296c048e46 Init repository for [hr2]
fgiacomoni
parents:
diff changeset
64