Created
February 7, 2022 21:40
-
-
Save diffs/a9a0c3677353854682ef80ef795b61bb to your computer and use it in GitHub Desktop.
encodeInput test script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# YOU NEED TO HAVE YOUR 4 SEAN-PROVIDED TEST FILES IN THE SAME DIRECTORY AS THIS SCRIPT | |
# ALSO, RUN THIS SCRIPT FROM THE SAME LOCATION WHERE YOUR MAKEFILE IS | |
echo Making... | |
make clean | |
make | |
# FILE 1 RUNS | |
cat binary-sample-01.bin | ./bin/encodeInput > binary-sample-01.bin.test1 | |
cat binary-sample-01.bin | ./bin/encodeInput -srec > binary-sample-01.bin.test2 | |
cat binary-sample-01.bin | ./bin/encodeInput -obinary-sample-01.bin.test3 | |
cat binary-sample-01.bin | ./bin/encodeInput -srec -obinary-sample-01.bin.test4 | |
./bin/encodeInput -srec -obinary-sample-01.bin.test5 -ibinary-sample-01.bin | |
./bin/encodeInput -obinary-sample-01.bin.test6 -ibinary-sample-01.bin | |
# FILE 1 TESTS | |
echo **Now Testing: File 1** | |
F1R1=$(diff -s binary-sample-01.bin.test2 binary-sample-01.srec) | |
F1R2=$(diff -s binary-sample-01.bin.test4 binary-sample-01.srec) | |
F1R3=$(diff -s binary-sample-01.bin.test5 binary-sample-01.srec) | |
F1R4=$(sha1sum binary-sample-01.bin.test1) | |
F1R5=$(sha1sum binary-sample-01.bin.test3) | |
F1R6=$(sha1sum binary-sample-01.bin.test6) | |
if [[ "$F1R1" == "1c1"* ]]; then | |
echo "Test Passed: F1R1"; | |
else | |
echo "Test FAILED: F1R1"; | |
fi | |
if [[ "$F1R2" == "1c1"* ]]; then | |
echo "Test Passed: F1R2"; | |
else | |
echo "Test FAILED: F1R2"; | |
fi | |
if [[ "$F1R3" == "1c1"* ]]; then | |
echo "Test Passed: F1R3"; | |
else | |
echo "Test FAILED: F1R3"; | |
fi | |
if [[ "$F1R4" == "6b993ade7eb4096ea00179c6a8b8b46306942bfa"* ]]; then | |
echo "Test Passed: F1R4"; | |
else | |
echo "Test FAILED: F1R4"; | |
fi | |
if [[ "$F1R5" == "6b993ade7eb4096ea00179c6a8b8b46306942bfa"* ]]; then | |
echo "Test Passed: F1R5"; | |
else | |
echo "Test FAILED: F1R5"; | |
fi | |
if [[ "$F1R6" == "6b993ade7eb4096ea00179c6a8b8b46306942bfa"* ]]; then | |
echo "Test Passed: F1R6"; | |
else | |
echo "Test FAILED: F1R6"; | |
fi | |
# FILE 2 RUNS | |
cat binary-sample-02.bin | ./bin/encodeInput > binary-sample-02.bin.test1 | |
cat binary-sample-02.bin | ./bin/encodeInput -srec > binary-sample-02.bin.test2 | |
cat binary-sample-02.bin | ./bin/encodeInput -obinary-sample-02.bin.test3 | |
cat binary-sample-02.bin | ./bin/encodeInput -srec -obinary-sample-02.bin.test4 | |
./bin/encodeInput -srec -obinary-sample-02.bin.test5 -ibinary-sample-02.bin | |
./bin/encodeInput -obinary-sample-02.bin.test6 -ibinary-sample-02.bin | |
# FILE 1 TESTS | |
echo **Now Testing: File 2** | |
F2R1=$(diff -s binary-sample-02.bin.test2 binary-sample-02.srec) | |
F2R2=$(diff -s binary-sample-02.bin.test4 binary-sample-02.srec) | |
F2R3=$(diff -s binary-sample-02.bin.test5 binary-sample-02.srec) | |
F2R4=$(sha1sum binary-sample-02.bin.test1) | |
F2R5=$(sha1sum binary-sample-02.bin.test3) | |
F2R6=$(sha1sum binary-sample-02.bin.test6) | |
if [[ "$F2R1" == "1c1"* ]]; then | |
echo "Test Passed: F2R1"; | |
else | |
echo "Test FAILED: F2R1"; | |
fi | |
if [[ "$F2R2" == "1c1"* ]]; then | |
echo "Test Passed: F2R2"; | |
else | |
echo "Test FAILED: F2R2"; | |
fi | |
if [[ "$F2R3" == "1c1"* ]]; then | |
echo "Test Passed: F2R3"; | |
else | |
echo "Test FAILED: F2R3"; | |
fi | |
if [[ "$F2R4" == "620e044e58c3e4f6b382f70a45324080b48c4f5b"* ]]; then | |
echo "Test Passed: F2R4"; | |
else | |
echo "Test FAILED: F2R4"; | |
fi | |
if [[ "$F2R5" == "620e044e58c3e4f6b382f70a45324080b48c4f5b"* ]]; then | |
echo "Test Passed: F2R5"; | |
else | |
echo "Test FAILED: F2R5"; | |
fi | |
if [[ "$F2R6" == "620e044e58c3e4f6b382f70a45324080b48c4f5b"* ]]; then | |
echo "Test Passed: F2R6"; | |
else | |
echo "Test FAILED: F2R6"; | |
fi | |
# OTHER | |
echo **Now Testing: Wonderland** | |
WONDERLAND=$(curl -s https://cdn.discordapp.com/attachments/843626423843422208/933794057300361277/wonderland.txt | ./bin/encodeInput | sha1sum) | |
if [[ "$WONDERLAND" == "26c4eb8398ce1633cd9a56cb7184811eb856e0b2"* ]]; then | |
echo "Test Passed: Wonderland"; | |
else | |
echo "Test FAILED: Wonderland [$WONDERLAND]"; | |
fi | |
rm -rf binary-sample-0?.bin.test? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmod +x a2test.sh
to give the script permissions to executesudo apt install curl
(you only need to do that once)
./a2test.sh
You should get an output that should look something like this:
*Your top-level directory should have (at least) all these files before running the script:
