X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Tools%2FNetTest_Runner%2Ftest_tcp.c;fp=Tools%2FNetTest_Runner%2Ftest_tcp.c;h=a19c85b28f95fa8cb8b4caffaf147d13adf3d1ee;hb=50a98c40481c6d1df267f4631228e9a4d107fe74;hp=0000000000000000000000000000000000000000;hpb=7b64f5e7f00e445a5637e9e3289a1332a14d28e5;p=tpg%2Facess2.git diff --git a/Tools/NetTest_Runner/test_tcp.c b/Tools/NetTest_Runner/test_tcp.c new file mode 100644 index 00000000..a19c85b2 --- /dev/null +++ b/Tools/NetTest_Runner/test_tcp.c @@ -0,0 +1,26 @@ +/* + */ +#include "test.h" +#include "tests.h" +#include "net.h" +#include "stack.h" +#include "arp.h" +#include "tcp.h" + +bool Test_TCP_Basic(void) +{ + TEST_SETNAME(__func__); + size_t rxlen, ofs; + char rxbuf[MTU]; + + // 1. Test connection to closed port + uint32_t seq_tx = 0x1000; + uint32_t seq_exp = 0; + TCP_Send(0, 4, BLOB(TEST_IP), 1234, 80, seq_tx, seq_exp, TCP_SYN, 0x1000, 0, NULL); + + TEST_ASSERT( rxlen = Net_Receive(0, sizeof(rxbuf), rxbuf, 1000) ); + TEST_ASSERT( TCP_Pkt_Check(rxlen, rxbuf, &ofs, 4, BLOB(TEST_IP), 80, 1234, TCP_RST) ); + TEST_ASSERT_REL(ofs, ==, rxlen); + + return true; +}