diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-10-28 14:50:26 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-10-28 14:50:26 +0100 |
commit | 4c05d65aadfe27959b15a88e99dbccd199b534c7 (patch) | |
tree | 39a85aaf4811f8bd62d881b7d3420aff61056524 /ws2015/einfuehrung_in_die_programmierung/blaetter/02/test.sh | |
parent | e3d0f58ff28e87b6bf7ca742ef5daecff2012204 (diff) | |
download | uni-4c05d65aadfe27959b15a88e99dbccd199b534c7.tar uni-4c05d65aadfe27959b15a88e99dbccd199b534c7.tar.gz uni-4c05d65aadfe27959b15a88e99dbccd199b534c7.tar.bz2 uni-4c05d65aadfe27959b15a88e99dbccd199b534c7.tar.xz uni-4c05d65aadfe27959b15a88e99dbccd199b534c7.zip |
EiP Blatt 2
Diffstat (limited to 'ws2015/einfuehrung_in_die_programmierung/blaetter/02/test.sh')
-rw-r--r-- | ws2015/einfuehrung_in_die_programmierung/blaetter/02/test.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ws2015/einfuehrung_in_die_programmierung/blaetter/02/test.sh b/ws2015/einfuehrung_in_die_programmierung/blaetter/02/test.sh new file mode 100644 index 0000000..5647e13 --- /dev/null +++ b/ws2015/einfuehrung_in_die_programmierung/blaetter/02/test.sh | |||
@@ -0,0 +1,20 @@ | |||
1 | #!/usr/bin/env zsh | ||
2 | |||
3 | runTest() { | ||
4 | ret=$(echo $1 | java Arithmetik | tail -c +32) | ||
5 | if [[ $ret != $2 ]]; then | ||
6 | echo "Input:" | ||
7 | echo $1 | ||
8 | echo "Should return:" | ||
9 | echo $2 | ||
10 | echo "But returns:" | ||
11 | echo $ret | ||
12 | exit 1 | ||
13 | fi | ||
14 | } | ||
15 | |||
16 | gup --update Arithmetik.class || exit 1 | ||
17 | |||
18 | runTest "Christian\nElegans\n2\n7" "Hallo C. Elegans! Der Mittelwert von 2 und 7 ist übrigens 4.5!" | ||
19 | runTest "Gustav\nEnauer\n70\n15" "Hallo G. Enauer! Der Kehrwert von 70 ist ungefähr 0.014285714285714!" | ||
20 | runTest "Karla\nEhr-Wert\n7\n3" "Hallo K. Ehr-Wert! Der Kehrwert von 7 ist ungefähr 0.143!" | ||