MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / TestBitmask

Function TestBitmask

pkg/event/bitset_test.go:30–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestBitmask(t *testing.T) {
31 var tests = []struct {
32 typ Type
33 expected bool
34 }{
35 {TerminateThread, true},
36 {TerminateProcess, true},
37 {CreateThread, true},
38 {CreateFile, false},
39 {WriteFile, false},
40 {LoadModule, false},
41 {MapFileRundown, true},
42 {ProcessRundown, true},
43 }
44
45 b := bitmask.New()
46 for _, typ := range AllWithState() {
47 if typ == WriteFile || typ == LoadModule || typ == CreateFile {
48 continue
49 }
50 b.Set(typ.ID())
51 }
52
53 for _, tt := range tests {
54 t.Run(tt.typ.String(), func(t *testing.T) {
55 assert.Equal(t, tt.expected, b.IsSet(tt.typ.ID()))
56 })
57 }
58}
59
60func TestBitSets(t *testing.T) {
61 var tests = []struct {

Callers

nothing calls this directly

Calls 8

NewFunction · 0.92
AllWithStateFunction · 0.85
EqualMethod · 0.80
IsSetMethod · 0.80
SetMethod · 0.65
RunMethod · 0.65
StringMethod · 0.65
IDMethod · 0.45

Tested by

no test coverage detected