Revision befd32b5
Added by Christophe Garion about 6 years ago
src/tools/stateflow/json-parser/test_json_parser_variables.ml | ||
---|---|---|
146 | 146 |
| _ -> raise (OUnitTest.OUnit_failure |
147 | 147 |
"Program obtained from simple-var-real-neg.json is not correct") |
148 | 148 |
|
149 |
let test_simple_var_real_e tests_ctxt = |
|
150 |
let prog = Parse.parse_prog |
|
151 |
(Yojson.Basic.from_file "../data-test/simple-var-real-e.json") in |
|
152 |
match prog with |
|
153 |
| Program ("simple_var_real_e", [ ], [ x ]) -> |
|
154 |
test_var_skeleton x "my_real_var_e" |
|
155 |
Tydec_real (Expr_const (Const_real (Num.num_of_int (-2115), 4, "-21.15e-02"))) |
|
156 |
| _ -> raise (OUnitTest.OUnit_failure |
|
157 |
"Program obtained from simple-var-real-e.json is not correct") |
|
158 |
|
|
149 | 159 |
let test_simple_var_real_wo_dec tests_ctxt = |
150 | 160 |
assert_raises (Parse.JSON_parse_error("Invalid real constant 2500")) |
151 | 161 |
(fun _ -> Parse.parse_prog (Yojson.Basic.from_file |
... | ... | |
169 | 179 |
test_simple_var_real_pos; |
170 | 180 |
"simple test for variable (real, -2.24)" >:: |
171 | 181 |
test_simple_var_real_neg; |
182 |
"simple test for variable (real, -21.15e-02)" >:: |
|
183 |
test_simple_var_real_e; |
|
172 | 184 |
"simple test for variable (real, 2500)" >:: |
173 | 185 |
test_simple_var_real_wo_dec; |
174 | 186 |
] |
Also available in: Unified diff
json-parser: add test for real variable with e|E