AfanasevGad7

This is a task for our favourite professor
git clone git://git.stellar-nexus.ru/AfanasevGad7
Log | Files | Refs | README

commit b32121ab084c234401aa597cd6705424f3b9d9a1
parent c1948a61a0651433c8bf8d11cb04b018eb8e4ee3
Author: Plat <plat@stellar-nexus.ru>
Date:   Fri,  7 Nov 2025 21:00:00 +0000

Fine testing proceudure

Diffstat:
MMakefile | 32++++++++++++++++----------------
MREADME | 2+-
Mtest.sh | 13++++++++-----
3 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/Makefile b/Makefile @@ -21,22 +21,22 @@ ${CXX}: ${OBJS} ${CC} ${CFLAGS} -c $< -o $@ test: all sample_data.txt - @./test.sh "avl -c" - @./test.sh "avl -s" - @./test.sh "avl -cs" - @./test.sh "fib -c" - @./test.sh "fib -s" - @./test.sh "fib -cs" - @./test.sh "rb -c" - @./test.sh "rb -s" - @./test.sh "rb -cs" - @./test.sh "ntree -c" - @./test.sh "ntree -s" - @./test.sh "ntree -d" - @./test.sh "ntree -cs" - @./test.sh "ntree -cd" - @./test.sh "ntree -sd" - @./test.sh "ntree -csd" + @./test.sh "./avl -c" + @./test.sh "./avl -s" + @./test.sh "./avl -cs" + @./test.sh "./fib -c 29" + @./test.sh "./fib -s 29" + @./test.sh "./fib -cs 29" + @./test.sh "./rb -c" + @./test.sh "./rb -s" + @./test.sh "./rb -cs" + @./test.sh "./ntree -c" + @./test.sh "./ntree -s" + @./test.sh "./ntree -d" + @./test.sh "./ntree -cs" + @./test.sh "./ntree -cd" + @./test.sh "./ntree -sd" + @./test.sh "./ntree -csd" sample_data.txt: shuf -i 0-999999 > sample_data.txt diff --git a/README b/README @@ -6,7 +6,7 @@ Plat - Red-Black [FINISHED] Fibbonachi [FINISHED] = - N-trees [FINISHED] 2-3 trees -V - Testing software and various help +V - Testing software and various help [FINISHED] K&T - Terms and history on: -B-trees [FINISHED] -AVL [FINISHED] diff --git a/test.sh b/test.sh @@ -1,12 +1,15 @@ #!/bin/sh test -n "$1" || exit 1 -test -n "$2" && iter = "$2" || iter = 2 +test -n "$2" && iter="$2" || iter=2 -sum = 0 -for ((i=0; i<iter; i++)); do - val=$($cmd) +sum=0 +i=0 + +while $(test "$i" -lt "$iter"); do + val=$($1) sum=$(echo "$sum + $val" | bc -l) + i=$((i + 1)) done avg=$(echo "$sum / $iter" | bc -l) -echo "$0: $avg" +echo "$1: $avg"