carl
This commit is contained in:
29
tests/carl/NoErrors/sample.good.alpha
Normal file
29
tests/carl/NoErrors/sample.good.alpha
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
(* Type definitions *)
|
||||
type int2int: integer -> integer
|
||||
type string2int: string -> integer
|
||||
|
||||
(* Function declarations
|
||||
They use the above type definitions
|
||||
*)
|
||||
function square : int2int
|
||||
function entry : string2int
|
||||
|
||||
(* Function definition
|
||||
Functions must be declared before they are defined
|
||||
*)
|
||||
square(x) := {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
(* Function definition
|
||||
entry is the first function called
|
||||
*)
|
||||
entry(arg) := {
|
||||
[ integer: input ; integer: expected ; integer: actual ; Boolean: result ]
|
||||
input := 7;
|
||||
expected := 49;
|
||||
actual := square(input);
|
||||
result := expected = actual;
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user