Adds some unit test

Former-commit-id: b1a59df1c87187a1538f30c447d42bbe96402419
This commit is contained in:
2023-11-08 11:13:56 +02:00
parent dedf125f6e
commit a96ecb4837
5 changed files with 81 additions and 3 deletions

View File

@@ -5,8 +5,16 @@ import (
"fmt"
)
// Returns a sub sequence start from position 'from' included,
// to position 'to' excluded. Coordinates start at position 0.
// Subsequence returns a subsequence of the BioSequence.
//
// Parameters:
// - from: starting position of the subsequence.
// - to: ending position of the subsequence.
// - circular: indicates whether the subsequence should be circular.
//
// Return:
// - *BioSequence: the subsequence of the BioSequence.
// - error: an error if the subsequence parameters are invalid.
func (sequence *BioSequence) Subsequence(from, to int, circular bool) (*BioSequence, error) {
if from >= to && !circular {
return nil, errors.New("from greater than to")