blob: a00d34c25e2853ff55b829a47cb410009c890d49 (
plain)
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
|
module aggregate_runme;
import aggregate.aggregate;
void main() {
// Confirm that move() returns correct results under normal use.
int result = move(UP);
if (result != UP) throw new Exception("UP failed");
result = move(DOWN);
if (result != DOWN) throw new Exception("DOWN failed");
result = move(LEFT);
if (result != LEFT) throw new Exception("LEFT failed");
result = move(RIGHT);
if (result != RIGHT) throw new Exception("RIGHT failed");
// Confirm that move() raises an exception when the contract is violated.
try {
move(0);
throw new Exception("0 test failed");
}
catch (Exception e) {}
}
|