| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use strictscip-perl cpan Chemistry-OpenSMILES 0.12.4 strict/; |
| 4 | use warningsscip-perl cpan Chemistry-OpenSMILES 0.12.4 warnings/; |
| 5 | |
| 6 | use Algorithm::Combinatoricsscip-perl cpan Chemistry-OpenSMILES 0.12.4 Algorithm/Combinatorics/ qw( permutations ); |
| 7 | use Chemistry::OpenSMILES::Writerscip-perl cpan Chemistry-OpenSMILES 0.12.4 Chemistry/OpenSMILES/Writer/; |
| 8 | use Test::Morescip-perl cpan Chemistry-OpenSMILES 0.12.4 Test/More/; |
| 9 | |
| 10 | my @order_permutations = permutationsscip-perl cpan Chemistry-OpenSMILES 0.12.4 main/permutations().( [ 0..5 ] ); |
| 11 | |
| 12 | planscip-perl cpan Chemistry-OpenSMILES 0.12.4 main/plan(). tests => @order_permutations * 30; |
| 13 | |
| 14 | for my $permutation (@order_permutations) { |
| 15 | for (1..30) { |
| 16 | my $chirality = Chemistry::OpenSMILES::Writer::_octahedral_chiralityscip-perl cpan Chemistry-OpenSMILES 0.12.4 Chemistry/OpenSMILES/Writer/_octahedral_chirality().( @$permutation, '@OH' . $_scip-perl cpan Chemistry-OpenSMILES 0.12.4 main/$_. ); |
| 17 | my @reverse_permutation = reverse_permutationscip-perl cpan Chemistry-OpenSMILES 0.12.4 main/reverse_permutation().( @$permutation ); |
| 18 | isscip-perl cpan Chemistry-OpenSMILES 0.12.4 main/is(). Chemistry::OpenSMILES::Writer::_octahedral_chiralityscip-perl cpan Chemistry-OpenSMILES 0.12.4 Chemistry/OpenSMILES/Writer/_octahedral_chirality().( @reverse_permutation, $chirality ), |
| 19 | '@OH' . $_scip-perl cpan Chemistry-OpenSMILES 0.12.4 main/$_.; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | sub reverse_permutationscip-perl cpan Chemistry-OpenSMILES 0.12.4 main/reverse_permutation(). |
| 24 | { |
| 25 | my @order = @_scip-perl cpan Chemistry-OpenSMILES 0.12.4 main/`@_`.; |
| 26 | return sortscip-perl cpan Chemistry-OpenSMILES 0.12.4 main/sort(). { $order[$ascip-perl cpan Chemistry-OpenSMILES 0.12.4 main/$a.] <=> $order[$bscip-perl cpan Chemistry-OpenSMILES 0.12.4 main/$b.] } 0..$#orderscip-perl cpan Chemistry-OpenSMILES 0.12.4 main/`$#order`.; |
| 27 | } |