forked from austral/austral
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-examples.sh
executable file
·46 lines (40 loc) · 1.42 KB
/
run-examples.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
#!/usr/bin/env bash
# Part of the Austral project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE file for details.
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
set -euxo pipefail
dune build
function compile() {
./austral compile \
./standard/src/Buffer.aui,./standard/src/Buffer.aum \
./standard/src/String.aui,./standard/src/String.aum \
./standard/src/StringBuilder.aui,./standard/src/StringBuilder.aum \
./standard/src/IO/IO.aui,./standard/src/IO/IO.aum \
./standard/src/IO/Terminal.aui,./standard/src/IO/Terminal.aum \
$1/$2.aui,$1/$2.aum \
--entrypoint=Example.$2:main --output=testbin
if [ $# -eq 4 ]
then
echo -n -e $4 | ./testbin > actual.txt
else
./testbin > actual.txt
fi
echo -n -e "$3" > expected.txt
diff actual.txt expected.txt
rm testbin
rm actual.txt
rm expected.txt
}
compile examples/ffi FFI "aHello, world!\n"
compile examples/fib Fibonacci ""
compile examples/generic-record GenericRecord ""
compile examples/generic-union GenericUnion ""
compile examples/haversine Haversine ""
compile examples/hello-world HelloWorld "Hello, world!\n"
compile examples/identity Identity ""
compile examples/memory Memory ""
compile examples/named-argument NamedArgument ""
compile examples/record Record ""
compile examples/union Union ""
compile examples/greet Greet "Hello, Santa!\n" "Santa"