Commit 39e824e0 authored by Maximilien Colange's avatar Maximilien Colange

Turn a test into an assertion.

parent 709e0e4e
...@@ -380,19 +380,17 @@ struct ...@@ -380,19 +380,17 @@ struct
*) *)
let rec eval_exp ta vars = function let rec eval_exp ta vars = function
| Constant c -> Constant c | Constant c -> Constant c
| ConstVariable(id) -> | ConstVariable id ->
if ( id < 0 || id >= Array.length ta.constvalues ) then assert(id >= 0 && id < Array.length ta.constvalues);
failwith (sprintf "Const var index %d out of bounds (%d)" id (Array.length ta.constvalues));
Constant ta.constvalues.(id) Constant ta.constvalues.(id)
| Variable(id) -> | Variable id ->
if ( id < 0 || id >= Array.length vars ) then assert(id >= 0 && id < Array.length vars);
failwith (sprintf "Var index %d out of bounds (%d)" id (Array.length vars));
Constant vars.(id) Constant vars.(id)
| Clock(c) -> Clock(c) | Clock c -> Clock c
| ClockArray(arrayId, l) -> | ClockArray(arrayId, l) ->
let indices = List.map (fun x -> eval_disc_exp ta vars x) l in let indices = List.map (fun x -> eval_disc_exp ta vars x) l in
let cellindex = VarContext.index_of_cell ta.clocks arrayId indices in let cellindex = VarContext.index_of_cell ta.clocks arrayId indices in
Clock(cellindex) Clock cellindex
| Array(arrayId, l) -> | Array(arrayId, l) ->
let indices = List.map (fun x -> eval_disc_exp ta vars x) l in let indices = List.map (fun x -> eval_disc_exp ta vars x) l in
let cellindex = VarContext.index_of_cell ta.vars arrayId indices in let cellindex = VarContext.index_of_cell ta.vars arrayId indices in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment