summaryrefslogtreecommitdiff
path: root/lib/entry_test.go
diff options
context:
space:
mode:
authorcopilot-swe-agent[bot] <[email protected]>2026-01-27 00:38:41 +0000
committercopilot-swe-agent[bot] <[email protected]>2026-01-27 00:38:41 +0000
commita5b32a547c7428f7a6263c8f59b7e6631a7e1b39 (patch)
tree341bf5c5136ae1a689b1019d5535e8bfb2b2fe0b /lib/entry_test.go
parentc9b8f49c0bc675f794d264a0c65c81d16c5150b5 (diff)
Fix code review feedback - improve string formatting in testscopilot/add-unit-tests-lib-package-again
Co-authored-by: Loyalsoldier <[email protected]>
Diffstat (limited to 'lib/entry_test.go')
-rw-r--r--lib/entry_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/entry_test.go b/lib/entry_test.go
index 299b7ddf..fdc55ee7 100644
--- a/lib/entry_test.go
+++ b/lib/entry_test.go
@@ -751,6 +751,34 @@ func TestEntry_processPrefix_InvalidPrefix(t *testing.T) {
if err != ErrInvalidIPLength {
t.Errorf("expected ErrInvalidIPLength for zero prefix pointer, got %v", err)
}
+
+ // Test with invalid bit count for IPv4 prefix (33 bits)
+ addr := netip.MustParseAddr("192.168.1.1")
+ invalidPrefix := netip.PrefixFrom(addr, 33)
+ _, _, err = e.processPrefix(invalidPrefix)
+ if err != ErrInvalidPrefix {
+ t.Errorf("expected ErrInvalidPrefix for out-of-range bits, got %v", err)
+ }
+
+ // Test with pointer to invalid bit count prefix
+ _, _, err = e.processPrefix(&invalidPrefix)
+ if err != ErrInvalidPrefix {
+ t.Errorf("expected ErrInvalidPrefix for out-of-range bits pointer, got %v", err)
+ }
+
+ // Test with invalid bit count for IPv6 prefix (129 bits)
+ addr6 := netip.MustParseAddr("2001:db8::1")
+ invalidPrefix6 := netip.PrefixFrom(addr6, 129)
+ _, _, err = e.processPrefix(invalidPrefix6)
+ if err != ErrInvalidPrefix {
+ t.Errorf("expected ErrInvalidPrefix for IPv6 out-of-range bits, got %v", err)
+ }
+
+ // Test with pointer to invalid IPv6 prefix
+ _, _, err = e.processPrefix(&invalidPrefix6)
+ if err != ErrInvalidPrefix {
+ t.Errorf("expected ErrInvalidPrefix for IPv6 out-of-range bits pointer, got %v", err)
+ }
}
func TestEntry_processPrefix_IPv4MappedCIDRString(t *testing.T) {