kirill-refactor

This commit is contained in:
2025-12-10 16:50:28 +07:00
parent cb9d0ac607
commit f3a5c1f658
114 changed files with 2066 additions and 0 deletions

62
mine/lab_3/Makefile Normal file
View File

@@ -0,0 +1,62 @@
# Makefile для лабораторной работы №3
# Многозадачное программирование
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -g
# Цель по умолчанию
all: parent lab1_var12
# Родительская программа
parent: parent.c
$(CC) $(CFLAGS) -o $@ $<
# Программа из лабораторной работы №1
lab1_var12: lab1_var12.c
$(CC) $(CFLAGS) -o $@ $<
# Создание тестовых файлов
test_files:
echo "abbaabbaabbaabbaabbaabbaabbaabba" > input1.txt
echo "xyzxyzxyzxyzxyzxyzxyzxyz" >> input1.txt
echo "hello world hello" >> input1.txt
echo "testtest" > input2.txt
echo "aaaaaaa" >> input2.txt
echo "programming" > input3.txt
echo "ppppython" >> input3.txt
# Тест с несколькими файлами
test: all test_files
@echo "=== Запуск теста с тремя файлами ==="
./parent ./lab1_var12 10 input1.txt output1.txt input2.txt output2.txt input3.txt output3.txt
@echo ""
@echo "=== Результаты обработки ==="
@echo "--- output1.txt ---"
@cat output1.txt
@echo "--- output2.txt ---"
@cat output2.txt
@echo "--- output3.txt ---"
@cat output3.txt
# Тест обработки ошибок - несуществующий файл
test_error: all
@echo "=== Тест обработки ошибки (несуществующий входной файл) ==="
./parent ./lab1_var12 5 nonexistent.txt output_error.txt
# Тест обработки ошибок - неверная программа
test_bad_program: all test_files
@echo "=== Тест обработки ошибки (неверная программа) ==="
./parent ./nonexistent_program 5 input1.txt output1.txt
# Тест обработки ошибок - недостаточно аргументов
test_bad_args: all
@echo "=== Тест обработки ошибки (недостаточно аргументов) ==="
./parent ./lab1_var12 5
# Очистка
clean:
rm -f parent lab1_var12
rm -f input1.txt input2.txt input3.txt
rm -f output1.txt output2.txt output3.txt output_error.txt
.PHONY: all test test_files test_error test_bad_program test_bad_args clean