Project

General

Profile

Revision 0291fcfd

View differences:

data-test/simple-var-bool-false.json
8 8
        }
9 9
    ],
10 10
    "junctions": [],
11
    "name": "simple-var-1",
12
    "origin_path": "simple-var-1",
11
    "name": "simple_var_bool_false",
12
    "origin_path": "simple_var_bool_false",
13 13
    "sffunctions": [],
14 14
    "states": []
15 15
}
data-test/simple-var-bool-true.json
1
{
2
    "data": [
3
        {
4
            "datatype": "bool",
5
            "initial_value": "true",
6
            "name": "my_var",
7
            "scope": "Input"
8
        }
9
    ],
10
    "junctions": [],
11
    "name": "simple_var_bool_true",
12
    "origin_path": "simple_var_bool_true",
13
    "sffunctions": [],
14
    "states": []
15
}
src/tools/stateflow/json-parser/test_json_parser_variables.ml
50 50
  let prog = Parse.parse_prog
51 51
      (Yojson.Basic.from_file "../data-test/simple-var-bool-false.json") in
52 52
  match prog with
53
  | Program ("simple-var-1", [ ], [ x ]) ->
53
  | Program ("simple_var_bool_false", [ ], [ x ]) ->
54 54
    test_var_skeleton x "x" Tydec_bool (Expr_const (Const_tag tag_false))
55 55
  | _ -> raise (OUnitTest.OUnit_failure
56 56
                  "Program obtained from simple-var-bool-false.json is not correct")
57 57

  
58
let test_simple_var_bool_true tests_ctxt =
59
  let prog = Parse.parse_prog
60
      (Yojson.Basic.from_file "../data-test/simple-var-bool-true.json") in
61
  match prog with
62
  | Program ("simple_var_bool_true", [ ], [ x ]) ->
63
    test_var_skeleton x "my_var" Tydec_bool (Expr_const (Const_tag tag_true))
64
  | _ -> raise (OUnitTest.OUnit_failure
65
                  "Program obtained from simple-var-bool-true.json is not correct")
66

  
58 67
let var_suite =
59 68
  "suite for variables" >:::
60
  [ "simple test for variable (boolean, false)" >:: test_simple_var_bool_false ]
69
  [ "simple test for variable (boolean, false)" >::
70
    test_simple_var_bool_false;
71
    "simple test for variable (boolean, true)"  >::
72
    test_simple_var_bool_true
73
  ]
61 74

  
62 75
let _ =
63 76
  run_test_tt_main var_suite

Also available in: Unified diff