Skip to content

Commit 32c1d50

Browse files
committed
add basic tests for buffer module
1 parent e9a9b8b commit 32c1d50

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## CRASH TESTS ##
2+
buf0 = Buffer() #Buffer takes no parameters
3+
CRASH_TEST_INPUTS.append([buf0, 1, 1])
4+
5+
## INPUT TESTS ##
6+
batch_size = 32
7+
8+
buf1 = Buffer()
9+
test_packet = gen_packet(scapy.TCP, '22.22.22.22', '22.22.22.22')
10+
test_packet2 = gen_packet(scapy.TCP, '33.22.22.22', '22.22.22.22')
11+
test_data = []
12+
13+
#Should withhold data until it has a full batch to push through.
14+
for i in range(batch_size - 1):
15+
test_data.append({'input_port' : 0, 'input_packet': test_packet,
16+
'output_port' : 0, 'output_packet': None})
17+
18+
test_data.append({'input_port' : 0, 'input_packet': test_packet2,
19+
'output_port' : 0, 'output_packet': test_packet})
20+
21+
OUTPUT_TEST_INPUTS.append([buf1, 1, 1, test_data])
22+

0 commit comments

Comments
 (0)