aboutsummaryrefslogtreecommitdiff
path: root/test_mini/libft/script
diff options
context:
space:
mode:
Diffstat (limited to 'test_mini/libft/script')
-rwxr-xr-xtest_mini/libft/script/find_src.sh20
-rwxr-xr-xtest_mini/libft/script/generate_boilerplate_test.sh9
-rwxr-xr-xtest_mini/libft/script/generate_rendu.sh26
-rw-r--r--test_mini/libft/script/generate_rendu_makefile.sh5
-rw-r--r--test_mini/libft/script/template.makefile38
-rw-r--r--test_mini/libft/script/test.sh14
6 files changed, 112 insertions, 0 deletions
diff --git a/test_mini/libft/script/find_src.sh b/test_mini/libft/script/find_src.sh
new file mode 100755
index 0000000..511642b
--- /dev/null
+++ b/test_mini/libft/script/find_src.sh
@@ -0,0 +1,20 @@
+#!bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "Usage $0 ignore_file"
+ exit 1
+fi
+
+IGNORE_FILE=$1
+
+if [ ! -e $IGNORE_FILE ]; then
+ echo "Ignore file doesnt exist"
+ exit 1
+fi
+
+SRC_DIR=src
+
+IGNORE_FIND_ARGS=`sed 's/.*/-not -path "&"/' $IGNORE_FILE | paste -sd " " -`
+
+sh -c "find $SRC_DIR $IGNORE_FIND_ARGS -name \"*.c\""
+# find $SRC_DIR $IGNORE_FIND_ARGS -name "*.c"
diff --git a/test_mini/libft/script/generate_boilerplate_test.sh b/test_mini/libft/script/generate_boilerplate_test.sh
new file mode 100755
index 0000000..ef6a2cf
--- /dev/null
+++ b/test_mini/libft/script/generate_boilerplate_test.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+for f in $@
+do
+ test_name="test_`basename $f | sed 's/\..*//'`"
+
+
+ echo $test_name
+done
diff --git a/test_mini/libft/script/generate_rendu.sh b/test_mini/libft/script/generate_rendu.sh
new file mode 100755
index 0000000..1b68a97
--- /dev/null
+++ b/test_mini/libft/script/generate_rendu.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+if [ "$(git status --porcelain)" ]
+then
+ echo "Error: Your working directory isn't clean"
+ exit
+fi
+
+BASE_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
+RENDU_BRANCH_NAME="rendu-$BASE_BRANCH_NAME"
+
+if [ -z $(git show-ref --verify --quiet refs/heads/$RENDU_BRANCH_NAME) ]
+then
+ echo "Error: $RENDU_BRANCH_NAME was already generated"
+ exit
+fi
+
+git checkout -b $RENDU_BRANCH_NAME
+RENDU_IGNORE=$(sed -n 's/RENDU_IGNORE=//p')
+make fclean
+rm -f $RENDU_IGNORE
+
+# generate makefile strict src
+
+git add .
+git commit --message "Generated commit: creation of rendu for $BASE_BRANCH_NAME"
diff --git a/test_mini/libft/script/generate_rendu_makefile.sh b/test_mini/libft/script/generate_rendu_makefile.sh
new file mode 100644
index 0000000..00a9e81
--- /dev/null
+++ b/test_mini/libft/script/generate_rendu_makefile.sh
@@ -0,0 +1,5 @@
+#!bin/sh
+
+SRC=`sh script/find_src.sh .libftignore`
+
+sed 's:\#INSERTSRC:'$SRC':g' template.makefile > rendu.makefile
diff --git a/test_mini/libft/script/template.makefile b/test_mini/libft/script/template.makefile
new file mode 100644
index 0000000..b0902ec
--- /dev/null
+++ b/test_mini/libft/script/template.makefile
@@ -0,0 +1,38 @@
+# **************************************************************************** #
+# #
+# ::: :::::::: #
+# Makefile :+: :+: :+: #
+# +:+ +:+ +:+ #
+# By: cacharle <marvin@42.fr> +#+ +:+ +#+ #
+# +#+#+#+#+#+ +#+ #
+# Created: 2019/10/08 15:45:53 by cacharle #+# #+# #
+# Updated: 2020/01/31 06:51:18 by cacharle ### ########.fr #
+# #
+# **************************************************************************** #
+
+RM = rm -f
+LIB = ar rcs
+
+CC = gcc
+CCFLAGS = -Iinclude -Wall -Wextra -Werror
+
+#INSERTSRC
+
+OBJ = $(SRC:.c=.o)
+NAME = libft.a
+
+all: $(NAME)
+
+$(NAME): $(OBJ)
+ $(LIB) $@ $(OBJ)
+
+%.o: %.c
+ $(CC) $(CCFLAGS) -c -o $@ $<
+
+clean:
+ $(RM) -r $(OBJ_DIR)
+
+fclean: clean
+ $(RM) $(NAME)
+
+re: fclean all
diff --git a/test_mini/libft/script/test.sh b/test_mini/libft/script/test.sh
new file mode 100644
index 0000000..50a17c9
--- /dev/null
+++ b/test_mini/libft/script/test.sh
@@ -0,0 +1,14 @@
+#include "libft_test.h"
+
+TEST_GROUP(test.sh);
+
+TEST_SETUP(test.sh);
+{}
+
+TEST_TEAR_DOWN(test.sh);
+{}
+
+TEST(test.sh, basic)
+{
+
+}