summaryrefslogtreecommitdiffstats
path: root/files/testlab2.sh
diff options
context:
space:
mode:
Diffstat (limited to 'files/testlab2.sh')
-rwxr-xr-xfiles/testlab2.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/files/testlab2.sh b/files/testlab2.sh
new file mode 100755
index 0000000..7f79876
--- /dev/null
+++ b/files/testlab2.sh
@@ -0,0 +1,49 @@
1#/bin/sh
2
3string1="Sunner"
4string2="Richard Stallman"
5string3="This is a very very long string!"
6
7score1=10
8score2=10
9score3=10
10
11expected1="Sunner"
12expected2="Richard Stallman"
13expected3="Richard Stallman"
14
15echo Testing string:$string1
16./iam "$string1"
17result=`./whoami`
18if [ "$result" = "$expected1" ]; then
19 echo PASS.
20else
21 score1=0
22 echo FAILED.
23fi
24score=$score1
25
26echo Testing string:$string2
27./iam "$string2"
28result=`./whoami`
29if [ "$result" = "$expected2" ]; then
30 echo PASS.
31else
32 score2=0
33 echo FAILED.
34fi
35score=$score+$score2
36
37echo Testing string:$string3
38./iam "$string3"
39result=`./whoami`
40if [ "$result" = "$expected3" ]; then
41 echo PASS.
42else
43 score3=0
44 echo FAILED.
45fi
46score=$score+$score3
47
48let "totalscore=$score"
49echo Score: $score = $totalscore%