| 1 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 1 | ▶ | use Chemistry::Mol; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Chemistry::File::Formula; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | #use Test::More "no_plan"; | ||
| 7 | 1 | ▶ | use Test::More tests => 17; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 1 | my $mol = Chemistry::Mol->parse('CC', format => 'formula'); | |
| 10 | 1 | my $bond = $mol->new_bond(atoms => [ $mol->atoms ] ); | |
| 11 | 1 | my ($a1, $a2) = $mol->atoms; | |
| 12 | |||
| 13 | 1 | is ( scalar $mol->atoms, 2, "mol atom count" ); | |
| 14 | 1 | is ( scalar $mol->bonds, 1, "mol bond count" ); | |
| 15 | 1 | is ( scalar $bond->atoms, 2, "bond atom count" ); | |
| 16 | 1 | is ( scalar $a1->bonds, 1, "atom bond count" ); | |
| 17 | 1 | is ( scalar $a2->bonds, 1, "atom bond count" ); | |
| 18 | |||
| 19 | 1 | $bond->delete; | |
| 20 | 1 | ok ( 1, "deleted the bond" ); | |
| 21 | |||
| 22 | 1 | is ( scalar $mol->atoms, 2, "mol atom count" ); | |
| 23 | 1 | is ( scalar $mol->bonds, 0, "mol bond count" ); | |
| 24 | 1 | is ( scalar $bond->atoms, 2, "bond atom count" ); | |
| 25 | 1 | is ( scalar $a1->bonds, 0, "atom bond count" ); | |
| 26 | 1 | is ( scalar $a2->bonds, 0, "atom bond count" ); | |
| 27 | |||
| 28 | 1 | $mol->add_bond($bond); | |
| 29 | 1 | ok ( 1, "readded the bond" ); | |
| 30 | |||
| 31 | 1 | is ( scalar $mol->atoms, 2, "mol atom count" ); | |
| 32 | 1 | is ( scalar $mol->bonds, 1, "mol bond count" ); | |
| 33 | 1 | is ( scalar $bond->atoms, 2, "bond atom count" ); | |
| 34 | 1 | is ( scalar $a1->bonds, 1, "atom bond count" ); | |
| 35 | 1 | is ( scalar $a2->bonds, 1, "atom bond count" ); | |
| 36 | |||
| 37 | |||