(t *testing.T)
| 90 | } |
| 91 | |
| 92 | func TestPartialKey(t *testing.T) { |
| 93 | var tests = []struct { |
| 94 | evt *Event |
| 95 | key uint64 |
| 96 | }{ |
| 97 | { |
| 98 | &Event{Type: OpenProcess, PID: 1234, Params: Params{params.ProcessID: {Name: params.ProcessID, Type: params.PID, Value: uint32(1221)}, params.DesiredAccess: {Name: params.DesiredAccess, Type: params.Uint32, Value: uint32(5)}}}, |
| 99 | 0x99c, |
| 100 | }, |
| 101 | { |
| 102 | &Event{Type: OpenThread, PID: 11234, Params: Params{params.ThreadID: {Name: params.ThreadID, Type: params.TID, Value: uint32(8452)}, params.DesiredAccess: {Name: params.DesiredAccess, Type: params.Uint32, Value: uint32(15)}}}, |
| 103 | 0x4cf5, |
| 104 | }, |
| 105 | { |
| 106 | &Event{Type: CreateFile, PID: 4321, Params: Params{params.FilePath: {Name: params.FilePath, Type: params.DOSPath, Value: "C:\\Windows\\System32\\kernelbase.dll"}}}, |
| 107 | 0x7ec254f31df879ec, |
| 108 | }, |
| 109 | { |
| 110 | &Event{Type: CreateFile, PID: 4321, Params: Params{params.FilePath: {Name: params.FilePath, Type: params.DOSPath, Value: "C:\\Windows\\System32\\kernel32.dll"}}}, |
| 111 | 0xb6380d9159ccd174, |
| 112 | }, |
| 113 | } |
| 114 | |
| 115 | for _, tt := range tests { |
| 116 | t.Run(tt.evt.Type.String(), func(t *testing.T) { |
| 117 | assert.Equal(t, tt.key, tt.evt.PartialKey()) |
| 118 | }) |
| 119 | } |
| 120 | } |
nothing calls this directly
no test coverage detected