Skip to content

Commit

Permalink
add new test case
Browse files Browse the repository at this point in the history
  • Loading branch information
csziklai committed Aug 9, 2024
1 parent 2680a3d commit 2e70611
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dsl/lib/policy.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ let rec eval cl st (used : string list ref) p =
TokenBucket (eval_plst cl st used plst, n1, n2)
| Ast.StopAndGo (plst, n) -> StopAndGo (eval_plst cl st used plst, n)

(* Evaluates a program, looking up any variables and substituting them in. *)
let from_program (cl, alst, ret) = eval cl alst (ref []) ret
(* Evaluates a program, looking up any variables and substituting them in. It returns
the final policy with any variables substituted in. *)
let from_program (cl, alst, ret) : t = eval cl alst (ref []) ret

let rec to_string p =
let bracket_wrap s = "[" ^ s ^ "]" in
Expand Down
2 changes: 2 additions & 0 deletions dsl/test/well_formed.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ let error_tests =
"incorrect/unbound_var_hier.sched" (Policy.UnboundVariable "r_polic");
make_error_test "class used twice in policy"
"incorrect/duplicate_classes.sched" (Policy.DuplicateClass "B");
make_error_test "class used twice in one fifo"
"incorrect/duplicate_samepol.sched" (Policy.DuplicateClass "A");
]

let suite = "suite" >::: tests @ error_tests
Expand Down
5 changes: 5 additions & 0 deletions progs/incorrect/duplicate_samepol.sched
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
classes A, B;

x = fifo[A, A];

return x

0 comments on commit 2e70611

Please sign in to comment.