diff --git a/tests/0_lib/functions.sh b/tests/0_lib/functions.sh index b112151..1d1cd5d 100755 --- a/tests/0_lib/functions.sh +++ b/tests/0_lib/functions.sh @@ -126,6 +126,11 @@ function t_Assert t_CheckExitStatus $? } +function t_Assert_Equals +{ + [ $1 -eq $2 ] + t_CheckExitStatus $? +} export -f t_Log export -f t_CheckExitStatus export -f t_InstallPackage @@ -138,4 +143,5 @@ export -f t_DistCheck export -f t_GetPkgVer export -f t_GetArch export -f t_Assert +export -f t_Assert_Equals export centos_ver diff --git a/tests/p_grep/00-install_grep.sh b/tests/p_grep/00-install_grep.sh new file mode 100755 index 0000000..febf918 --- /dev/null +++ b/tests/p_grep/00-install_grep.sh @@ -0,0 +1,4 @@ +#!/bin/env bash +# Author: Ravi Kumar P , Anoop Hallur +t_Log "running $0 - installing grep" +t_InstallPackage grep diff --git a/tests/p_grep/10-test_grep.sh b/tests/p_grep/10-test_grep.sh new file mode 100755 index 0000000..e24d66f --- /dev/null +++ b/tests/p_grep/10-test_grep.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Ravi Kumar P , Anoop Hallur + +# Check grep installation + +t_Log "Running $0 - checking grep installation" + +grep --version &>/dev/null +t_CheckExitStatus $? diff --git a/tests/p_grep/11-test_grep.sh b/tests/p_grep/11-test_grep.sh new file mode 100755 index 0000000..9645502 --- /dev/null +++ b/tests/p_grep/11-test_grep.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Ravi Kumar P , Anoop Hallur + +# Check grep functionality + +t_Log "Running $0 - checking grep functionality" + +echo "wow grep is working" | grep "wow" +t_CheckExitStatus $? diff --git a/tests/p_grep/13-test_grep.sh b/tests/p_grep/13-test_grep.sh new file mode 100755 index 0000000..c620817 --- /dev/null +++ b/tests/p_grep/13-test_grep.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Ravi Kumar P , Anoop Hallur + +# Check grep functionality with count of repititive words + +t_Log "Running $0 - checking grep with count" + +count=`echo -e "wow grep is working" | grep -c "wow"` +t_Log $count + +t_Assert_Equals $count 1 diff --git a/tests/p_grep/test b/tests/p_grep/test new file mode 100644 index 0000000..3758846 --- /dev/null +++ b/tests/p_grep/test @@ -0,0 +1,6 @@ +wow this session +is awesome. +wow once again +i want this session. +wow for the sake of +mamu.