AfanasevGad7

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

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

Added testing

Diffstat:
MMakefile | 17++++++++++++++++-
Atest.sh | 12++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -21,7 +21,22 @@ ${CXX}: ${OBJS} ${CC} ${CFLAGS} -c $< -o $@ test: all sample_data.txt - @echo "Waiting for a teamate" + @./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" sample_data.txt: shuf -i 0-999999 > sample_data.txt diff --git a/test.sh b/test.sh @@ -0,0 +1,12 @@ +#!/bin/sh +test -n "$1" || exit 1 +test -n "$2" && iter = "$2" || iter = 2 + +sum = 0 +for ((i=0; i<iter; i++)); do + val=$($cmd) + sum=$(echo "$sum + $val" | bc -l) +done + +avg=$(echo "$sum / $iter" | bc -l) +echo "$0: $avg"