forked from CorentinB/warc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils_test.go
46 lines (34 loc) · 1.02 KB
/
utils_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package warc
import (
"bytes"
"testing"
"go.uber.org/goleak"
)
// Tests for the GetSHA1 function
func TestGetSHA1(t *testing.T) {
defer goleak.VerifyNone(t)
helloWorldSHA1 := "FKXGYNOJJ7H3IFO35FPUBC445EPOQRXN"
if GetSHA1(bytes.NewReader([]byte("hello world"))) != helloWorldSHA1 {
t.Error("Failed to generate SHA1 with GetSHA1")
}
}
// Tests for the NewRotatorSettings function
func TestNewRotatorSettings(t *testing.T) {
defer goleak.VerifyNone(t)
rotatorSettings := NewRotatorSettings()
if rotatorSettings.Prefix != "WARC" {
t.Error("Failed to set WARC rotator's filename prefix")
}
if rotatorSettings.WarcSize != 1000 {
t.Error("Failed to set WARC rotator's WARC size")
}
if rotatorSettings.OutputDirectory != "./" {
t.Error("Failed to set WARC rotator's output directory")
}
if rotatorSettings.Compression != "GZIP" {
t.Error("Failed to set WARC rotator's compression algorithm")
}
if rotatorSettings.CompressionDictionary != "" {
t.Error("Failed to set WARC rotator's compression dictionary")
}
}