Skip to content

FakeEmperor/net-packet-coders-test

Repository files navigation

Network coders tester

Hamming coders, CRC32, Shannon-Fano, LZW compression, JPEG codecs

This repo holds a server written in C++ which can compress data using LZW, JPEG (yes, even text), Shannon-Fano , or encode it using Hamming error-correcting code (ECC) , or compute CRC32 checksum.

Of course, it's the code which is of interest and not the server itself.

How to build

You need C++17-compatible compiler and CMake 3.8.

Tested and working on these compilers:

OS Compiler Version
Windows Visual Studio C++ 2017
Windows Visual Studio C++ 2015
Windows MinGW-64 7.3
Linux cmake cmake3.6 and gcc6.3

You can compile on these IDEs:

OS IDE Version
Windows Visual Studio 2017
Windows Visual Studio 2015
Windows/Linux CLion 2017.1

How to test

You can run python tests from tests folder. Python3 interpreter with zlib and unittest libraries (they usually included by default). Here is the list of tests:

  • test_crc32.py

    • testEncode - test CRC32 checksum returned
  • test_hamming.py

    • testEncode - test Hamming has returned (without algo check)
    • testDecode - test Hamming can decode itself (without errors)
    • testDecodeSingleError - test Hamming can detect errors and decode itself (with 1 error)
  • test_shannon_fano.py

    • testEncode - test Shannon-Fano compression
    • testDecode - test Shannon-Fano decompression
  • test_lzw.py

    • testEncode - test LZW compression
    • testDecode - test LZW decompression