Debian Codegraph @

pkg/filter/time_test.go

raw symbols SCIP
1 package filterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/
2
3 import (
4 "testingscip-go gomod github.com/golang/go/src go1.18 testing/"
5 "timescip-go gomod github.com/golang/go/src go1.18 time/"
6
7 "github.com/ffuf/ffuf/v2/pkg/ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/"
8 )
9
10 func TestNewTimeFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TestNewTimeFilter().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
11 fp, _ := NewTimeFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewTimeFilter().(">100")
12
13 f := fp.(*TimeFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TimeFilter#)
14
15 if !f.gtscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TimeFilter#gt. || f.ltscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TimeFilter#lt. {
16 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Time filter was expected to have greater-than")
17 }
18
19 if f.msscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TimeFilter#ms. != 100 {
20 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Time filter was expected to have ms == 100")
21 }
22 }
23
24 func TestNewTimeFilterErrorscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TestNewTimeFilterError().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
25 _, err := NewTimeFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewTimeFilter().("100>")
26 if err == nil {
27 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Was expecting an error from errenous input data")
28 }
29 }
30
31 func TestTimeFilteringscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TestTimeFiltering().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
32 f, _ := NewTimeFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewTimeFilter().(">100")
33
34 for i, test := range []struct {
35 input int64
36 output bool
37 }{
38 {1342, true},
39 {2000, true},
40 {35000, true},
41 {1458700, true},
42 {99, false},
43 {2, false},
44 } {
45 resp := ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Responsescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#{
46 Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Data.: []byte("dahhhhhtaaaaa"),
47 Durationscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Duration.: timescip-go gomod github.com/golang/go/src go1.18 time/.Durationscip-go gomod github.com/golang/go/src go1.18 time/Duration#(test.input * int64(timescip-go gomod github.com/golang/go/src go1.18 time/.Millisecondscip-go gomod github.com/golang/go/src go1.18 time/Millisecond.)),
48 }
49 filterReturn, _ := f.Filterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/FilterProvider#Filter.(&resp)
50 if filterReturn != test.output {
51 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Filter test %d: Was expecing filter return value of %t but got %t", i, test.output, filterReturn)
52 }
53 }
54 }