pz12

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

commit a739e7e88848c58737ba2ff485dbb4ee8ff0d936
Author: Plat <plat@stellar-nexus.ru>
Date:   Sun, 23 Nov 2025 22:58:53 +0000

Initial commit

Diffstat:
AMakefile | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atest.sh | 17+++++++++++++++++
Atest1.sh | 2++
Atest2.sh | 2++
4 files changed, 88 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,67 @@ +CC = true cc +CXX = true cxx + +STUDENTS =\ + anazarova \ + babushkin \ + balyaev \ + bersekov \ + buskin \ + gavrilov \ + gorobzov \ + gukkaev \ + zhumiga \ + zhuchenko \ + zubarev \ + krukov \ + kuzenkova \ + kulev \ + larin \ + melehov \ + minin \ + moshkov \ + ovchar \ + polanskiy \ + rahimov \ + rijov \ + smirnov \ + soshnikova \ + suhareva \ + tairova \ + taramova \ + chryachkova \ + czibenko \ + chegodaeva \ + usupov \ + yarin + +BIN1 =\ + bell \ + greed \ + full + +BIN2 =\ + bubble \ + choice \ + insert \ + shell + +all: ${STUDENTS} + +${STUDENTS}: + @echo "=== Processing student: $@ ===" + @test -d "$@" || \ + echo "No such directory" + test -f "$@"/Makefile && \ + echo Found Makefile && \ + ${MAKE} -C "$@" || true + ls *.c >/dev/null 2>&1 && COMP="${CC}" || COMP="${CXX}"; \ + echo "No Makefile, compiling with $$COMP"; \ + for BIN in ${BIN1} ${BIN2}; do \ + echo "Compiling $$BIN"; \ + $$COMP "$@"/$${BIN}* -o "$@/$$BIN"; \ + file -f "$@/$$BIN" && strip "$@/$$BIN"; \ + done; + ) + +.PHONY: all ${STUDENTS} diff --git a/test.sh b/test.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +dir="$(echo "$0" | cut -c 3- | cut -d. -f1)" +prog="$1" +total=0 +tests=$(("$(ls -l "$dir" | wc -l)" - 1)) #GNU ls outputs an extra line + +for i in $(seq 1 $(($tests - 1))); do + output = "$("$prog" < "${dir}/input${i}")" + first_line="$(echo "$output" | head -n 1)" + rest="$(echo "$output" | tail -n +2)" + + total="$(echo "$total" + "$first_line" | bc -l)" + diff -q <(echo "$rest") "${dir}/expected${i}" || (echo -1 && exit 1) +done + +echo "$total" diff --git a/test1.sh b/test1.sh @@ -0,0 +1 @@ +test.sh +\ No newline at end of file diff --git a/test2.sh b/test2.sh @@ -0,0 +1 @@ +test.sh +\ No newline at end of file