Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Bash-arith/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Bash Arithmetic Lab
Make a shell script that performs * operations with the flags -a -b,
i.e.
```
./math -a 1 -b 2
>>> 2
./math -a 4 -b 8
>>> 32
```

## Assesment Language
Bash

## Autograder Language
Python

## Autograding Environment Packages
Python3

## Hand-in Format
`math.sh`


9 changes: 9 additions & 0 deletions Bash-arith/autograde-Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
all:
tar xvf autograde.tar
tar xvf handin.tar
cp math.sh test_autograder

(cd test_autograder; python3 driver.py)

clean:
rm -rf *~ test_autograder
Binary file added Bash-arith/autograde.tar
Binary file not shown.
12 changes: 12 additions & 0 deletions Bash-arith/math.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/bash

while getopts a:b: flag
do
case "${flag}" in
a) X=${OPTARG};;
b) Y=${OPTARG};;
esac
done

echo $((X * Y))

Binary file added Bash-arith/refsol.tar
Binary file not shown.
12 changes: 12 additions & 0 deletions Bash-arith/refsol/math.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/bash

while getopts a:b: flag
do
case "${flag}" in
a) X=${OPTARG};;
b) Y=${OPTARG};;
esac
done

echo $((X * Y))

Binary file added Bash-arith/test_autograder/driver.py
Binary file not shown.
6 changes: 6 additions & 0 deletions Bash-arith/test_autograder/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tests = [
["Basic", [1, 2, 2]],
["Zero", [0, 4, 0]],
["Identity", [1, 8, 8]],
["Large", [123456789, 2, 246913578]]
]