-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added some more test coverage to fold subpackage. (#436)
- Loading branch information
1 parent
43c015b
commit 27c7d28
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package fold | ||
|
||
import ( | ||
"fmt" | ||
"math" | ||
"testing" | ||
) | ||
|
||
func TestResult_MinimumFreeEnergy_LengthZero(t *testing.T) { | ||
result := Result{} // Create a Result instance with empty structs | ||
|
||
expectedEnergy := math.Inf(1) | ||
actualEnergy := result.MinimumFreeEnergy() | ||
|
||
if actualEnergy != expectedEnergy { | ||
t.Errorf("expected energy to be %f, but got %f", expectedEnergy, actualEnergy) | ||
} | ||
} | ||
|
||
func TestResult_DotBracket_LengthZero(t *testing.T) { | ||
result := Result{} // Create a Result instance with empty structs | ||
|
||
expectedDotBracket := "" | ||
actualDotBracket := result.DotBracket() | ||
|
||
if actualDotBracket != expectedDotBracket { | ||
t.Errorf("expected dot bracket to be %s, but got %s", expectedDotBracket, actualDotBracket) | ||
} | ||
} | ||
|
||
func TestNewFoldingContext_InvalidSequence(t *testing.T) { | ||
seq := "XYZ" | ||
temp := 37.0 | ||
|
||
_, err := newFoldingContext(seq, temp) | ||
if err == nil { | ||
t.Errorf("expected error, but got nil") | ||
} | ||
expectedError := fmt.Errorf("the sequence %s is not RNA or DNA", seq) | ||
if err.Error() != expectedError.Error() { | ||
t.Errorf("expected error message to be %q, but got %q", expectedError.Error(), err.Error()) | ||
} | ||
} |