forked from vikshanker/sponge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fsm_retx.hh
28 lines (24 loc) · 920 Bytes
/
fsm_retx.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef SPONGE_TESTS_FSM_RETX_HH
#define SPONGE_TESTS_FSM_RETX_HH
#include "tcp_expectation.hh"
#include "tcp_fsm_test_harness.hh"
#include "tcp_header.hh"
#include "tcp_segment.hh"
#include <exception>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
static void check_segment(TCPTestHarness &test, const std::string &data, const bool multiple, const int lineno) {
try {
std::cerr << " check_segment" << std::endl;
test.execute(ExpectSegment{}.with_ack(true).with_payload_size(data.size()).with_data(data));
if (!multiple) {
test.execute(ExpectNoSegment{}, "test failed: multiple re-tx?");
}
} catch (const std::exception &e) {
throw std::runtime_error(std::string(e.what()) + " (in check_segment called from line " +
std::to_string(lineno) + ")");
}
}
#endif // SPONGE_TESTS_FSM_RETX_HH