text stringlengths 0 234 |
|---|
Action => OK, |
Success => False), |
(Expr => +"4*bar(2,3,4)", |
Action => OK, |
Success => False), |
(Expr => +"4*pluto(2)", |
Action => OK, |
Success => False), |
(Expr => +"4*pluto(2,3)", |
Action => OK, |
Success => True), |
(Expr => +"4*pluto(2,3,4)", |
Action => OK, |
Success => True), |
(Expr => +"zorro()", |
Action => OK, |
Success => False), |
(Expr => +"zorro(1)", |
Action => OK, |
Success => False), |
(Expr => +" zorro (1, 2)", |
Action => OK, |
Success => True), |
(Expr => +"zorro(1, 2, 3)", |
Action => OK, |
Success => True), |
(Expr => +"zorro(1, 2, 3,4)", |
Action => OK, |
Success => True), |
(Expr => +"zorro(1, 2, 3,4,x)", |
Action => OK, |
Success => False)); |
ID_Table : ID_Table_Type; |
function Check_Syntax (This : Syntax_ID_Case) return Boolean is |
Tmp : Symbolic_Expression; |
pragma Unreferenced (Tmp); |
Raised : Boolean; |
Expected : Boolean; |
begin |
Raised := False; |
Expected := False; |
begin |
Tmp := Parse (Input => +This.Expr, |
ID_Table => ID_Table, |
On_Unknown_ID => This.Action); |
exception |
when Parsing_Error => |
Raised := True; |
Expected := True; |
when others => |
Raised := True; |
Expected := False; |
Function Definition: procedure Do_Syntax_ID_Checks is |
Function Body: new Do_Suite (Test_Case => Syntax_ID_Case, |
Test_Case_Array => Syntax_ID_Case_Array, |
Check => Check_Syntax); |
Reporter : Reporter_Type; |
begin |
-- Be_Verbose (Reporter); |
Define_Function (ID_Table, "bar", Exactly (2)); |
Define_Function (ID_Table, "pluto", At_Least (2)); |
Define_Function (ID_Table, "zorro", Between (2, 4)); |
Define_Variable (ID_Table, "pippo"); |
for I in Variables'Range loop |
Var_Table.Insert (+Variables (I).Name, Variables (I).Value); |
end loop; |
Do_Checks (Reporter, Test_Cases, "Basic"); |
Do_Syntax_ID_Checks (Reporter, Syntax_Cases, "Syntax"); |
declare |
X : constant Symbolic_Expression := Variable ("x"); |
Y : constant Symbolic_Expression := Variable ("y"); |
T : constant Symbolic_Expression := (X + Y) * (X - Y); |
U : constant Symbolic_Expression := Function_Call ("max", (X, Y)); |
R : constant Symbolic_Expression := Function_Call ("min", (X, Y)); |
S : constant Symbolic_Expression := R * U; |
K : constant Symbolic_Expression := To_Expr (42); |
M : constant Symbolic_Expression := X + Y * U / (K - S); |
Q : constant Symbolic_Expression := Replace (S, "x", T); |
Z : constant Symbolic_Expression := T * (- Q); |
W : constant Symbolic_Expression := +T * (+T); |
A : constant Symbolic_Expression := W * 3-(2 + U) / (Q - 1); |
Val_X : constant Integer := 12; |
Val_Y : constant Integer := -3; |
Val_T : constant Integer := (Val_X + Val_Y) * (Val_X - Val_Y); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.