MCPcopy
hub / github.com/crowdsecurity/crowdsec / TestAdd2Int

Function TestAdd2Int

pkg/types/ip_test.go:28–226  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func TestAdd2Int(t *testing.T) {
29 tests := []struct {
30 in_addr string
31 exp_sz int
32 exp_start_ip int64
33 exp_start_sfx int64
34 exp_end_ip int64
35 exp_end_sfx int64
36 exp_error string
37 }{
38 {
39 in_addr: "7FFF:FFFF:FFFF:FFFF:aaaa:aaaa:aaaa:fff7",
40
41 exp_sz: 16,
42 exp_start_ip: -math.MaxInt64 + 0x7FFFFFFFFFFFFFFF,
43 exp_start_sfx: -math.MaxInt64 + 0xaaaaaaaaaaaafff7,
44 exp_end_ip: -math.MaxInt64 + 0x7FFFFFFFFFFFFFFF,
45 exp_end_sfx: -math.MaxInt64 + 0xaaaaaaaaaaaafff7,
46 },
47 {
48 in_addr: "aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:fff7",
49
50 exp_sz: 16,
51 exp_start_ip: -math.MaxInt64 + 0xaaaaaaaaaaaaaaaa,
52 exp_start_sfx: -math.MaxInt64 + 0xaaaaaaaaaaaafff7,
53 exp_end_ip: -math.MaxInt64 + 0xaaaaaaaaaaaaaaaa,
54 exp_end_sfx: -math.MaxInt64 + 0xaaaaaaaaaaaafff7,
55 },
56 {
57 in_addr: "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff7",
58 /*ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff*/
59
60 exp_sz: 16,
61 exp_start_ip: math.MaxInt64,
62 exp_start_sfx: -math.MaxInt64 + 0xfffffffffffffff7,
63 exp_end_ip: math.MaxInt64,
64 exp_end_sfx: -math.MaxInt64 + 0xfffffffffffffff7,
65 },
66 {
67 in_addr: "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
68 /*ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff*/
69
70 exp_sz: 16,
71 exp_start_ip: math.MaxInt64,
72 exp_start_sfx: math.MaxInt64,
73 exp_end_ip: math.MaxInt64,
74 exp_end_sfx: math.MaxInt64,
75 },
76 {
77 in_addr: "::",
78 /*::*/
79
80 exp_sz: 16,
81 exp_start_ip: -math.MaxInt64,
82 exp_start_sfx: -math.MaxInt64,
83 exp_end_ip: -math.MaxInt64,
84 exp_end_sfx: -math.MaxInt64,
85 },

Callers

nothing calls this directly

Calls 2

Addr2IntsFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…