#ifdef CCXX_NAMESPACES
using namespace std;
#endif
int main(int argc, char *argv[])
{
unsigned char test[44];
union {
unsigned char buf[4];
} data;
int i;
cout << "CRC32 Algorithm Test\n\n";
cout << "AAL-5 Test #1 - 40 Octets filled with \"0\" - ";
cout << "CRC32 = 0x864d7f99\n";
for (i = 0; i < 40; i++)
test[i] = 0x0;
test[40] = test[41] = test[42] = 0x0;
test[43] = 0x28;
crc = data.value;
cout << "Test #1 CRC32 = " << hex << crc << "\n\n";
if (crc == 0x864d7f99)
cout << "Test #1 PASSED\n\n\n";
else
cout << "Test #1 FAILED\n\n\n";
cout << "AAL-5 Test #2 - 40 Octets filled with \"1\" - ";
cout << "CRC32 = 0xc55e457a\n";
for (i = 0; i < 40; i++)
test[i] = 0xFF;
test[40] = test[41] = test[42] = 0x0;
test[43] = 0x28;
crc = data.value;
cout << "Test #2 CRC32 = " << hex << crc << "\n\n";
if (crc == 0xc55e457a)
cout << "Test #2 PASSED\n\n\n";
else
cout << "Test #2 FAILED\n\n\n";
cout << "AAL-5 Test #3 - 40 Octets counting 1 to 40 - ";
cout << "CRC32 = 0xbf671ed0\n";
for (i = 0; i < 40; i++)
test[i] = i+1;
test[40] = test[41] = test[42] = 0x0;
test[43] = 0x28;
crc = data.value;
cout << "Test #3 CRC32 = " << hex << crc << "\n\n";
if (crc == 0xbf671ed0)
cout << "Test #3 PASSED\n\n\n";
else
cout << "Test #3 FAILED\n\n\n";
}