aboutsummaryrefslogtreecommitdiff
path: root/script/create_test.sh
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-02 11:05:33 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-02 11:05:33 +0200
commit5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde (patch)
tree80911dc3c32e9f230750e7e1042d413dfb6efab2 /script/create_test.sh
parentee32953ea79616e72f5428cdf40c834714a891c9 (diff)
parentb96b82194ccad2cddbb46b77aa1962a57c47ff44 (diff)
downloadlibft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.gz
libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.bz2
libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.zip
Merge branch 'master' into ft_ssl
Diffstat (limited to 'script/create_test.sh')
-rwxr-xr-xscript/create_test.sh22
1 files changed, 22 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
+