| 448 | func (t *fakeTUNDeviceSized) BatchSize() int { return t.size } |
| 449 | |
| 450 | func TestBatchSize(t *testing.T) { |
| 451 | d := Device{} |
| 452 | |
| 453 | d.net.bind = &fakeBindSized{1} |
| 454 | d.tun.device = &fakeTUNDeviceSized{1} |
| 455 | if want, got := 1, d.BatchSize(); got != want { |
| 456 | t.Errorf("expected batch size %d, got %d", want, got) |
| 457 | } |
| 458 | |
| 459 | d.net.bind = &fakeBindSized{1} |
| 460 | d.tun.device = &fakeTUNDeviceSized{128} |
| 461 | if want, got := 128, d.BatchSize(); got != want { |
| 462 | t.Errorf("expected batch size %d, got %d", want, got) |
| 463 | } |
| 464 | |
| 465 | d.net.bind = &fakeBindSized{128} |
| 466 | d.tun.device = &fakeTUNDeviceSized{1} |
| 467 | if want, got := 128, d.BatchSize(); got != want { |
| 468 | t.Errorf("expected batch size %d, got %d", want, got) |
| 469 | } |
| 470 | |
| 471 | d.net.bind = &fakeBindSized{128} |
| 472 | d.tun.device = &fakeTUNDeviceSized{128} |
| 473 | if want, got := 128, d.BatchSize(); got != want { |
| 474 | t.Errorf("expected batch size %d, got %d", want, got) |
| 475 | } |
| 476 | } |