forked from dafny-lang/dafny
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquicktest.sh
executable file
·75 lines (62 loc) · 2.24 KB
/
quicktest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#! /bin/bash
echo "method m() { assert 1+1 == 2; }" > a.dfy
echo "method m() { assert 1+1 == 3; }" > b.dfy
echo 'method Main() { print (42,131), "\n"; }' > c.dfy
tmp=quicktest.tmp
tmpx=quicktest.tmpx
DIR="$(dirname ${BASH_SOURCE[0]})"
if [ -n "$1" ]; then
DAFNY=$1
else
DAFNY=$DIR/dafny
fi
echo "" > $tmp
echo "Dafny program verifier finished with 1 verified, 0 errors" >> $tmp
echo Should succeed
$DAFNY verify a.dfy | diff - $tmp || exit 1
echo "b.dfy(1,24): Error: assertion might not hold" > $tmp
echo "" >> $tmp
echo "Dafny program verifier finished with 0 verified, 1 error" >> $tmp
echo Should fail
$DAFNY verify --use-basename-for-filename b.dfy | diff - $tmp
echo "" > $tmp
echo "Dafny program verifier finished with 0 verified, 0 errors" >> $tmp
echo "(42, 131)" >> $tmp
echo Running with C#
$DAFNY run -t:cs c.dfy | diff - $tmp || exit 1
echo Running with Javascript
$DAFNY run -t:js c.dfy | diff - $tmp || exit 1
echo Running with Java
$DAFNY run -t:java c.dfy | diff - $tmp || exit 1
echo Running with Go
$DAFNY run -t:go c.dfy | diff - $tmp || exit 1
echo Running with Python
$DAFNY run -t:py c.dfy | diff - $tmp || exit 1
echo Running with Rust
$DAFNY run -t:rs c.dfy | diff - $tmp || exit 1
rm -rf c-go c-java c-py c.jar c c.dll c.exe c.js c.runtimeconfig.json
echo "" > $tmp
echo "Dafny program verifier finished with 0 verified, 0 errors" >> $tmp
echo "(42, 131)" > $tmpx
echo Building with C#
$DAFNY build -t:cs c.dfy | diff - $tmp || exit 1
dotnet c.dll | diff - $tmpx || exit 1
echo Building with Javascript
$DAFNY build -t:js c.dfy | diff - $tmp || exit 1
node c.js | diff - $tmpx || exit 1
echo Building with Java
$DAFNY build -t:java c.dfy | diff - $tmp || exit 1
java -jar c.jar | diff - $tmpx || exit 1
echo Building with Go
$DAFNY build -t:go c.dfy | diff - $tmp || exit 1
./c | diff - $tmpx || exit 1
(cd c-go; GO111MODULE=auto GOPATH=`pwd` go run src/c.go) | diff - $tmpx || exit 1
echo Building with Python
$DAFNY build -t:py c.dfy | diff - $tmp || exit 1
python c-py/c.py | diff - $tmpx || exit 1
echo Building with Rust
$DAFNY build -t:rs c.dfy | diff - $tmp || exit 1
./c.exe | diff - $tmpx || exit 1
echo Quicktest script succeeded
rm -rf a.dfy b.dfy c.dfy c-go c-java c-py c.jar c c.dll c.exe c.js c.rs c.runtimeconfig.json
rm $tmp $tmpx