aboutsummaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/create_test.sh22
-rw-r--r--script/test.template.c26
-rwxr-xr-xscript/test_prettier.sh6
3 files changed, 54 insertions, 0 deletions
diff --git a/script/create_test.sh b/script/create_test.sh
new file mode 100755
index 0000000..a0c9773
--- /dev/null
+++ b/script/create_test.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+[ $# -eq 0 ] && echo "Usage $0 src_file_path+" && exit 1
+
+for src_file_path in $@
+do
+ src_file_dir=`dirname $src_file_path`
+ src_file_name=`basename $src_file_path`
+ src_file_name_no_ext=`echo $src_file_name | sed 's/\.c//'`
+ template='script/test.template.c'
+
+ test_file_path="test/$src_file_dir/test_$src_file_name"
+
+ [ -f $test_file_path ] &&
+ echo "Cannot create test $test_file_path already exists" &&
+ continue
+
+ mkdir -p "test/$src_file_dir"
+ sed "s/<funcname>/$src_file_name_no_ext/" $template > $test_file_path
+ echo "Created new test file at $test_file_path"
+done
+
diff --git a/script/test.template.c b/script/test.template.c
new file mode 100644
index 0000000..f6d71e8
--- /dev/null
+++ b/script/test.template.c
@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* test.template.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/04/01 19:41:59 by charles #+# #+# */
+/* Updated: 2020/04/04 20:23:33 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft_test.h"
+
+TEST_GROUP(<funcname>);
+
+TEST_SETUP(<funcname>)
+{}
+
+TEST_TEAR_DOWN(<funcname>)
+{}
+
+TEST(<funcname>, basic)
+{
+ TEST_FAIL_MESSAGE("<funcname> test not implemented");
+}
diff --git a/script/test_prettier.sh b/script/test_prettier.sh
new file mode 100755
index 0000000..bd6b9a3
--- /dev/null
+++ b/script/test_prettier.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+while read line
+do
+ # echo `echo $line | sed
+done