diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/app/calculator.sh b/app/calculator.sh new file mode 100755 index 0000000..53685c5 --- /dev/null +++ b/app/calculator.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +add() { +echo $(($1+$2)) +} + diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 0000000..60f2c60 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +echo "Pornesc rularea testelor..." + +FAILED=0 + +for test in tests/*.sh; do +echo "Rulez $test" +bash "$test" + +if [ $? -ne 0 ]; then +FAILED=1 + +fi + +done + + +if [ $FAILED -eq 0 ]; then +echo "Toate testele au trecut" +exit 0 + +else +echo "Unele teste au esuat" +exit 1 + +fi + + diff --git a/tests/test_calculator.sh b/tests/test_calculator.sh new file mode 100755 index 0000000..3746089 --- /dev/null +++ b/tests/test_calculator.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +#incarca functia din aplicatie + +source ./app/calculator.sh + +echo "Test: add 2 + 3" + +result=$( add 2 3 ) + +if [ "$result" -eq 5 ]; then +echo "Test PASSED" +exit 0 + +else +echo "Test FAILED" +exit 1 +fi +