#include <stddef.h>
#define TEST_SETNAME(name) test_setname(name)
+#define TEST_STEP(name) do{}while(0) //test_setstep(name)
#define TEST_ASSERT(cnd) do{if(!(cnd)) {test_assertion_fail(__FILE__,__LINE__,"%s",#cnd);return false;}}while(0)
#define TEST_ASSERT_REL(a,r,b) do{long long a_val=(a),b_val=(b);if(!(a_val r b_val)) {test_assertion_fail(__FILE__,__LINE__,"%s(0x%llx)%s%s(0x%llx)",#a,a_val,#r,#b,b_val);return false;}}while(0)
#define TEST_WARN(msg...) test_message(__FILE__,__LINE__,msg)
#include "tcp.h"
#include <string.h>
+#define TEST_TIMERS 0
+
#define RX_HEADER \
size_t rxlen, ofs, len; \
char rxbuf[MTU]
// > RFC793 Pg.65
// 1.1. Send SYN packet
+ TEST_STEP("1.1. Send SYN packet to CLOSED");
TCP_SendC(&testconn, TCP_SYN, testblob_len, testblob);
testconn.RSeq = 0;
testconn.LSeq += testblob_len;
TEST_ASSERT_REL(ofs, ==, rxlen);
// 1.2. Send a SYN,ACK packet
+ TEST_STEP("1.2. Send SYN,ACK packet to CLOSED");
testconn.RSeq = 12345;
TCP_SendC(&testconn, TCP_SYN|TCP_ACK, 0, NULL);
// Expect a TCP_RST with SEQ=ACK
testconn.LSeq ++;
// 1.3. Send a RST packet
+ TEST_STEP("1.2. Send RST packet to CLOSED");
TCP_SendC(&testconn, TCP_RST, 0, NULL);
// Expect nothing
TEST_ASSERT_no_rx();
// 2.6. Close connection (TCP FIN)
TCP_SendC(&testconn, TCP_ACK|TCP_FIN, 0, NULL);
testconn.LSeq ++; // Empty = 1 byte
- // Expect ACK? (Does acess do delayed ACKs here?)
+ // Expect ACK? (Does Acess do delayed ACKs here?)
TEST_ASSERT_rx();
TEST_ASSERT( TCP_Pkt_CheckC(rxlen, rxbuf, &ofs, &len, &testconn, TCP_ACK) );
TEST_ASSERT_REL( len, ==, 0 );