Skip to content

Commit c73c0cd

Browse files
committed
Set a tolerance for a unit test because the number of proteins changes slightly from version to version.
1 parent d718882 commit c73c0cd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/dat/dat_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package dat_test
22

33
import (
44
"github.com/Nesvilab/philosopher/lib/fas"
5+
"math"
56
"testing"
67

78
. "github.com/Nesvilab/philosopher/lib/dat"
@@ -68,8 +69,8 @@ func TestBase_ProcessDB(t *testing.T) {
6869
for _, tt := range tests {
6970
t.Run(tt.name, func(t *testing.T) {
7071
len_records := ParseFile(tt.args.file, make(chan<- []fas.FastaEntry, 1024))
71-
if len_records != 20413 {
72-
t.Errorf("Number of FASTA entries is incorrect, got %d, want %d", len_records, 20413)
72+
if math.Abs(float64(len_records-20413)) > 100 {
73+
t.Errorf("Number of FASTA entries is incorrect, got %d, want around %d", len_records, 20413)
7374
}
7475
})
7576
}

0 commit comments

Comments
 (0)