(t *testing.T)
| 201 | } |
| 202 | |
| 203 | func TestRedirectionStructCopy(t *testing.T) { |
| 204 | // Test that Redirection can be safely copied |
| 205 | original := NewRedirection("eth0", "tcp", 80, "192.168.1.1", 8080) |
| 206 | original.SrcAddress = "10.0.0.1" |
| 207 | |
| 208 | // Create a copy |
| 209 | copy := *original |
| 210 | |
| 211 | // Modify the copy |
| 212 | copy.Interface = "wlan0" |
| 213 | copy.SrcPort = 443 |
| 214 | |
| 215 | // Verify original is unchanged |
| 216 | if original.Interface != "eth0" { |
| 217 | t.Error("original Interface was modified") |
| 218 | } |
| 219 | if original.SrcPort != 80 { |
| 220 | t.Error("original SrcPort was modified") |
| 221 | } |
| 222 | |
| 223 | // Verify copy has new values |
| 224 | if copy.Interface != "wlan0" { |
| 225 | t.Error("copy Interface was not set correctly") |
| 226 | } |
| 227 | if copy.SrcPort != 443 { |
| 228 | t.Error("copy SrcPort was not set correctly") |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | func BenchmarkNewRedirection(b *testing.B) { |
| 233 | for i := 0; i < b.N; i++ { |
nothing calls this directly
no test coverage detected