Optimise unit test "Webpages"

This commit optimises the unit test for checking for the existence of
webpages in the correct locations by merging the "OK" and "FAIL"
statuses with their respective formatting.
This commit is contained in:
inference 2024-05-12 00:37:09 +00:00
parent 2ee2279a48
commit c98fd4c4c3
Signed by: inference
SSH Key Fingerprint: SHA256:K/a677+eHm7chi3X4s77BIpLTE9Vge1tsv+jUL5gI+Y

View File

@ -4,7 +4,7 @@
# Inferencium - Website - Test - Webpages # Inferencium - Website - Test - Webpages
# Copyright 2024 Jake Winters # Copyright 2024 Jake Winters
# Version: 0.1.0 # Version: 0.2.0
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
@ -16,8 +16,8 @@ doc="../documentation" # Website documentation directory
# Formatting # Formatting
bold="\033[1m" # Bold bold="\033[1m" # Bold
green="\033[0;32;1m" # Green + Bold ok="\033[0;32;1mOK\033[0m" # Green + Bold
red="\033[0;31;1m" # Red + Bold fail="\033[0;31;1mFAIL\033[0m" # Red + Bold
nof="\033[0m" # None nof="\033[0m" # None
@ -28,166 +28,166 @@ echo ""
echo "${bold}Root${nof}" echo "${bold}Root${nof}"
if [ -f $root/about.xhtml ]; then if [ -f $root/about.xhtml ]; then
echo "about.xhtml ${green}${bold}OK${nof}" echo "about.xhtml ${ok}"
else else
echo "about.xhtml ${red}FAIL${nof}" echo "about.xhtml ${fail}"
fi fi
if [ -f $root/ads.txt ]; then if [ -f $root/ads.txt ]; then
echo "ads.txt ${green}OK${nof}" echo "ads.txt ${ok}"
else else
echo "ads.txt ${red}FAIL${nof}" echo "ads.txt ${fail}"
fi fi
if [ -f $root/app-ads.txt ]; then if [ -f $root/app-ads.txt ]; then
echo "app-ads.txt ${green}OK${nof}" echo "app-ads.txt ${ok}"
else else
echo "app-ads.txt ${red}FAIL${nof}" echo "app-ads.txt ${fail}"
fi fi
if [ -f $root/blog.xhtml ]; then if [ -f $root/blog.xhtml ]; then
echo "blog.xhtml ${green}OK${nof}" echo "blog.xhtml ${ok}"
else else
echo "blog.xhtml ${red}FAIL${nof}" echo "blog.xhtml ${fail}"
fi fi
if [ -f $root/changelog.xhtml ]; then if [ -f $root/changelog.xhtml ]; then
echo "changelog.xhtml ${green}OK${nof}" echo "changelog.xhtml ${ok}"
else else
echo "changelog.xhtml ${red}FAIL${nof}" echo "changelog.xhtml ${fail}"
fi fi
if [ -f $root/contact.xhtml ]; then if [ -f $root/contact.xhtml ]; then
echo "contact.xhtml ${green}OK${nof}" echo "contact.xhtml ${ok}"
else else
echo "contact.xhtml ${red}FAIL${nof}" echo "contact.xhtml ${fail}"
fi fi
if [ -f $root/directory.xhtml ]; then if [ -f $root/directory.xhtml ]; then
echo "directory.xhtml ${green}OK${nof}" echo "directory.xhtml ${ok}"
else else
echo "directory.xhtml ${red}FAIL${nof}" echo "directory.xhtml ${fail}"
fi fi
if [ -f $root/documentation.xhtml ]; then if [ -f $root/documentation.xhtml ]; then
echo "documentation.xhtml ${green}OK${nof}" echo "documentation.xhtml ${ok}"
else else
echo "documentation.xhtml ${red}FAIL${nof}" echo "documentation.xhtml ${fail}"
fi fi
if [ -f $root/humans.txt ]; then if [ -f $root/humans.txt ]; then
echo "humans.txt ${green}OK${nof}" echo "humans.txt ${ok}"
else else
echo "humans.txt ${red}FAIL${nof}" echo "humans.txt ${fail}"
fi fi
if [ -f $root/index.xhtml ]; then if [ -f $root/index.xhtml ]; then
echo "index.xhtml ${green}OK${nof}" echo "index.xhtml ${ok}"
else else
echo "index.xhtml ${red}FAIL${nof}" echo "index.xhtml ${fail}"
fi fi
if [ -f $root/key.xhtml ]; then if [ -f $root/key.xhtml ]; then
echo "key.xhtml ${green}OK${nof}" echo "key.xhtml ${ok}"
else else
echo "key.xhtml ${red}FAIL${nof}" echo "key.xhtml ${fail}"
fi fi
if [ -f $root/music.xhtml ]; then if [ -f $root/music.xhtml ]; then
echo "music.xhtml ${green}OK${nof}" echo "music.xhtml ${ok}"
else else
echo "music.xhtml ${red}FAIL${nof}" echo "music.xhtml ${fail}"
fi fi
if [ -f $root/news.xhtml ]; then if [ -f $root/news.xhtml ]; then
echo "news.xhtml ${green}OK${nof}" echo "news.xhtml ${ok}"
else else
echo "news.xhtml ${red}FAIL${nof}" echo "news.xhtml ${fail}"
fi fi
if [ -f $root/robots.txt ]; then if [ -f $root/robots.txt ]; then
echo "robots.txt ${green}OK${nof}" echo "robots.txt ${ok}"
else else
echo "robots.txt ${red}FAIL${nof}" echo "robots.txt ${fail}"
fi fi
if [ -f $root/sitemap.xhtml ]; then if [ -f $root/sitemap.xhtml ]; then
echo "sitemap.xhtml ${green}OK${nof}" echo "sitemap.xhtml ${ok}"
else else
echo "sitemap.xhtml ${red}FAIL${nof}" echo "sitemap.xhtml ${fail}"
fi fi
if [ -f $root/sitemap.xml ]; then if [ -f $root/sitemap.xml ]; then
echo "sitemap.xml ${green}OK${nof}" echo "sitemap.xml ${ok}"
else else
echo "sitemap.xml ${red}FAIL${nof}" echo "sitemap.xml ${fail}"
fi fi
if [ -f $root/source.xhtml ]; then if [ -f $root/source.xhtml ]; then
echo "source.xhtml ${green}OK${nof}" echo "source.xhtml ${ok}"
else else
echo "source.xhtml ${red}FAIL${nof}" echo "source.xhtml ${fail}"
fi fi
echo "" echo ""
echo "${bold}Blog${nof}" echo "${bold}Blog${nof}"
if [ -f $blog/foss_is_working_against_itself.xhtml ]; then if [ -f $blog/foss_is_working_against_itself.xhtml ]; then
echo "foss_is_working_against_itself.xhtml ${green}OK${nof}" echo "foss_is_working_against_itself.xhtml ${ok}"
else else
echo "foss_is_working_against_itself.xhtml ${red}FAIL${nof}" echo "foss_is_working_against_itself.xhtml ${fail}"
fi fi
if [ -f $blog/systemd_insecurity.xhtml ]; then if [ -f $blog/systemd_insecurity.xhtml ]; then
echo "systemd_insecurity.xhtml ${green}OK${nof}" echo "systemd_insecurity.xhtml ${ok}"
else else
echo "systemd_insecurity.xhtml ${red}FAIL${nof}" echo "systemd_insecurity.xhtml ${fail}"
fi fi
if [ -f $blog/the_chromium_monopoly.xhtml ]; then if [ -f $blog/the_chromium_monopoly.xhtml ]; then
echo "the_chromium_monopoly.xhtml ${green}OK${nof}" echo "the_chromium_monopoly.xhtml ${ok}"
else else
echo "the_chromium_monopoly.xhtml ${red}FAIL${nof}" echo "the_chromium_monopoly.xhtml ${fail}"
fi fi
if [ -f $blog/untrusted_the_issue_with_decentralisation.xhtml ]; then if [ -f $blog/untrusted_the_issue_with_decentralisation.xhtml ]; then
echo "untrusted_the_issue_with_decentralisation.xhtml ${green}OK${nof}" echo "untrusted_the_issue_with_decentralisation.xhtml ${ok}"
else else
echo "untrusted_the_issue_with_decentralisation.xhtml ${red}FAIL${nof}" echo "untrusted_the_issue_with_decentralisation.xhtml ${fail}"
fi fi
echo "" echo ""
echo "${bold}Changelog${nof}" echo "${bold}Changelog${nof}"
if [ -f $clog/firmware-aa000-0.xhtml ]; then if [ -f $clog/firmware-aa000-0.xhtml ]; then
echo "firmware-aa000-0.xhtml ${green}OK${nof}" echo "firmware-aa000-0.xhtml ${ok}"
else else
echo "firmware-aa000-0.xhtml ${red}FAIL${nof}" echo "firmware-aa000-0.xhtml ${fail}"
fi fi
if [ -f $clog/firmware-xa000-0.xhtml ]; then if [ -f $clog/firmware-xa000-0.xhtml ]; then
echo "firmware-xa000-0.xhtml ${green}OK${nof}" echo "firmware-xa000-0.xhtml ${ok}"
else else
echo "firmware-xa000-0.xhtml ${red}FAIL${nof}" echo "firmware-xa000-0.xhtml ${fail}"
fi fi
if [ -f $clog/firmware-xb000-0.xhtml ]; then if [ -f $clog/firmware-xb000-0.xhtml ]; then
echo "firmware-xb000-0.xhtml ${green}OK${nof}" echo "firmware-xb000-0.xhtml ${ok}"
else else
echo "firmware-xb000-0.xhtml ${red}FAIL${nof}" echo "firmware-xb000-0.xhtml ${fail}"
fi fi
echo "" echo ""
echo "${bold}Documentation${nof}" echo "${bold}Documentation${nof}"
if [ -f $doc/hardened_malloc.xhtml ]; then if [ -f $doc/hardened_malloc.xhtml ]; then
echo "hardened_malloc.xhtml ${green}OK${nof}" echo "hardened_malloc.xhtml ${ok}"
else else
echo "hardened_malloc.xhtml ${red}FAIL${nof}" echo "hardened_malloc.xhtml ${fail}"
fi fi
if [ -f $doc/openssl_selfsigned_certificate_chain.xhtml ]; then if [ -f $doc/openssl_selfsigned_certificate_chain.xhtml ]; then
echo "openssl_selfsigned_certificate_chain.xhtml ${green}OK${nof}" echo "openssl_selfsigned_certificate_chain.xhtml ${ok}"
else else
echo "openssl_selfsigned_certificate_chain.xhtml ${red}FAIL${nof}" echo "openssl_selfsigned_certificate_chain.xhtml ${fail}"
fi fi