pi1541/tests/test.cpp

41 lines
994 B
C++
Raw Normal View History

#include "acutest.h"
2021-01-12 21:29:09 +00:00
#include <cassert>
#include <cstring>
2021-01-12 21:29:09 +00:00
#include <src/types.h>
#include <uspi.h>
#include <src/net-arp.h>
2021-01-12 21:29:09 +00:00
#include <src/net-ipv4.h>
uint8_t uspiBuffer[USPI_FRAME_BUFFER_SIZE];
2021-01-12 21:29:09 +00:00
extern "C" int USPiSendFrame(const void* pBuffer, unsigned nLength)
{
assert(nLength <= USPI_FRAME_BUFFER_SIZE);
memcpy(uspiBuffer, pBuffer, nLength);
return nLength;
}
extern "C" void USPiGetMACAddress(unsigned char Buffer[6])
{
for (size_t i = 0; i < 6; i++)
{
Buffer[i] = i << 4;
}
}
#include "net-arp.h"
#include "net-utils.h"
TEST_LIST = {
{"Net::Utils::InternetChecksum", TestNetUtilsInternetChecksum},
{"Net::Utils::Crc32", TestNetUtilsCrc32},
{"Net::Utils::GetMacAddress", TestNetUtilsGetMacAddress},
{"Net::Arp::Packet", TestNetArpPacket},
2021-01-12 21:29:09 +00:00
{"Net::Arp::SendPacket", TestNetArpSendPacket},
{"Net::Arp::SendRequest", TestNetArpSendRequest},
{"Net::Arp::SendReply", TestNetArpSendReply},
{"Net::Arp::SendAnnouncement", TestNetArpSendAnnouncement},
{nullptr, nullptr},
};