Compare commits

..

No commits in common. "8482194b01ab886e111eba3d0aa1dbdddd625f9c" and "a48c4dcd331c5fab05c4ee5285295899e8f8d54c" have entirely different histories.

2 changed files with 17 additions and 36 deletions

View File

@ -36,7 +36,8 @@ fi
echo ">>> Building libs..." echo ">>> Building libs..."
create_directory bin/lib create_directory bin/lib
COMPILE_COMMANDS=( COMPILE_COMMANDS=(
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/net/connection.so ./src/lib/net/connection.cpp" "$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/net/client.so ./src/lib/net/client.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/net/server.so ./src/lib/net/server.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/cli.so ./src/lib/cli.cpp" "$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/cli.so ./src/lib/cli.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/file.so ./src/lib/file.cpp" "$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/file.so ./src/lib/file.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/game/block.so ./src/lib/game/block.cpp" "$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/game/block.so ./src/lib/game/block.cpp"

View File

@ -1,46 +1,26 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "================================================================================" echo "================================================================================"
echo "Testing \`zlibutil\`:" echo -n "Testing \`zlibutil\`... "
echo "--------------------------------------------------------------------------------"
TMPDIR="$(mktemp -d -t fossvg-zlibutil-XXXXX)"
TMPDATA="$(dd if=/dev/urandom bs=33 count=1 2>/dev/null | base64)"
echo -n "Compression test... " echo "abc" >> testfile
echo -n "$TMPDATA" >> "$TMPDIR/compress" bin/tools/zlibutil -c testfile
zlibutil "$TMPDIR/compress"
python3 <<< " if [ "$(bin/tools/arraydump --binary testfile.compressed)" = "{0b01111000, 0b10011100, 0b01001011, 0b01001100, 0b01001010, 0b11100110, 0b00000010, 0b00000000, 0b00000011, 0b01111110, 0b00000001, 0b00110001}" ]; then
import zlib, sys echo -n "Compression Test: PASS... "
tmpfile = open('$TMPDIR/compress.zz', 'rb')
data = tmpfile.read()
tmpfile.close()
try:
if zlib.decompress(data)==b'$TMPDATA':
print('PASS')
else:
print('FAIL: Wrong data.')
except:
print('FAIL: Exception.')
"
echo -n "Decompression test... "
#TODO: create a compressed file using another implementation (Python)
python3 <<< "
import zlib
tmpfile = open('$TMPDIR/decompress.zz', 'wb')
tmpfile.write(zlib.compress(b'$TMPDATA'))
tmpfile.close()
"
zlibutil -d "$TMPDIR/decompress.zz"
if [ "$(cat "$TMPDIR/decompress")" = "$TMPDATA" ]; then
echo "PASS"
else else
echo "FAIL" echo -n "Compression Test: FAILED... "
fi fi
rm -r "$TMPDIR" bin/tools/zlibutil -d testfile.compressed
if [ "$(bin/tools/arraydump --binary testfile.compressed.uncompressed)" = "{0b01100001, 0b01100010, 0b01100011, 0b00001010}" ]; then
echo "Decompression Test: PASS"
else
echo "Decompression Test: FAILED"
fi
rm testfile testfile.compressed testfile.compressed.uncompressed
echo "================================================================================" echo "================================================================================"