From 8d11c6c8213f46f0fa19826917c255edd5d43cb1 Mon Sep 17 00:00:00 2001 From: mzuenni Date: Sun, 28 Jul 2024 22:54:40 +0200 Subject: Test (#4) * update * moved content in subdir * rename file * add test setup * add test setup * add github action * automaticly test all cpp files * timeout after 10s * setulimit and dont zero memory * test build pdf * install latexmk * update * update * ngerman * fonts * removed old code * add first test * added tests * test in sorted order * more tests * simplified test * more tests * fix suffix tree * fixes and improvements * done ust lst directly * fix swap * add links to pdf * fix constants * add primorial * add comment * various improvements * more tests * added missing stuf * more tests * fix tests * more tests * more tests * more tests * fix recursion? * test trie * more tests * only use python temporarily for listings * only use python temporarily for listings * more tests * fix longestCommonSubstring * more tests * more tests * made code more similiar * fix? * more tests * more tests * more tests * add ahoCorasick test + limit 4GB stack size * more tests * fix test * add additional test * more tests * more tests * fix? * better fix * fix virtual tree * more tests * more tests * recursive closest pair * more tests * decrease limit * new tests * more tests * fix name * more tests * add test * new test * more tests * more tests * more tests * more tests * new test and content * new code * new code * larger tests * fix and test * new test * new test * update pdf * remove comments * new test * more tests * more testcases * more tests * increased limit * more tests * more tests * more tests * new tests * more tests * shortened code * new test * add basic tests for bigint * more tests * removed old files * new test * ignore some files * more auto more ccw * fix test * more tests * fix * new tests * more tests * more tests * stronger test * actually verify delaunay... * more tests * fix header * more tests * run tests parallel? * test parralel? * add --missing * separate workflows * test * is the pdf checked? * separate workflows * fix workflow * more workflows --------- Co-authored-by: Yidi --- test/test.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 test/test.sh (limited to 'test/test.sh') diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 0000000..0ca230b --- /dev/null +++ b/test/test.sh @@ -0,0 +1,70 @@ +#!/bin/bash +set -e +cd "$(dirname "$0")" +ulimit -s 4000000 +export MALLOC_PERTURB_="$((2#01011001))" + +declare -A cppstandard +cppstandard["string/suffixArray.cpp"]="gnu++20" + +test_file() { + file=$(realpath --relative-to="${PWD}" "${1}") + echo "$file:" + echo "compiling..." + std="gnu++17" + if [[ -v cppstandard[$file] ]]; then + std=${cppstandard[$file]} + fi + g++ -std=$std "$file" -I ../content/ -O2 -Wall -Wextra -Wshadow -Werror + echo "running..." + timeout --foreground 60s ./a.out + echo "" + rm ./a.out +} + +list_missing() { + declare -A ignore + ignore["datastructures/stlPriorityQueue.cpp"]=1 + ignore["datastructures/stlRope.cpp"]=1 + ignore["other/bitOps.cpp"]=1 + ignore["other/pbs.cpp"]=1 + ignore["other/pragmas.cpp"]=1 + ignore["other/stuff.cpp"]=1 + ignore["other/timed.cpp"]=1 + ignore["tests/gcc5bug.cpp"]=1 + ignore["tests/precision.cpp"]=1 + ignore["tests/whitespace.cpp"]=1 + + echo "missing tests:" + find ../content/ -type f -name '*.cpp' -print0 | sort -z | while read -d $'\0' file + do + file=${file#../content/} + if [ ! -f "$file" ] && [[ ! -v ignore["$file"] ]]; then + echo " $file" + fi + done +} + +if [ "$#" -ne 0 ]; then + for arg in "$@" + do + if [[ "$arg" == "--missing" ]]; then + list_missing + elif [ -d "$arg" ]; then + dir=$(realpath --relative-to="${PWD}" "$arg") + find . -type f -path "./${dir}/*.cpp" -print0 | sort -z | while read -d $'\0' file + do + test_file "$file" + done + elif [ -f "$arg" ]; then + test_file "$arg" + fi + done +else + find . -type f -path '*.cpp' -print0 | sort -z | while read -d $'\0' file + do + test_file "$file" + done + list_missing +fi + -- cgit v1.2.3