1
// This file will not be overwritten if codegen is rerun
2

            
3
//----------------------------------------------------------------
4
//  REDUCED TEST SUITE used to demonstrate missing coverage in the
5
//  HAMR Rust Testing Manual ("Generating Coverage Reports" section).
6
//
7
//  Compared to the original tests.rs, this version retains only:
8
//    - test_initialization_REQ_THERM_1 (covers the initialize entry point)
9
//    - test_compute                    (covers timeTriggered with default
10
//                                       inputs that exercise only the
11
//                                       REQ_THERM_4 fall-through path)
12
//    - test_compute_GUMBOX_manual_1_a  (a single manual GUMBOX test that
13
//                                       again exercises only REQ_THERM_4)
14
//
15
//  All tests for REQ_THERM_2 and REQ_THERM_3, all GUMBOX tests for those
16
//  cases, and all property-based tests have been removed.  The resulting
17
//  coverage report shows the REQ_THERM_2/REQ_THERM_3 branches in
18
//  timeTriggered as uncovered, and the corresponding GUMBOX case
19
//  oracle bodies as only partially exercised.
20
//----------------------------------------------------------------
21

            
22

            
23
mod tests {
24
  // NOTE: need to run tests sequentially to prevent race conditions
25
  //       on the app and the testing apis which are static
26
  use serial_test::serial;
27

            
28
  use crate::test::util::*;
29
  use data::*;
30
  use data::Isolette_Data_Model::*;
31

            
32
  #[test]
33
  #[serial]
34
2
  fn test_initialization_REQ_THERM_1() {
35
2
    crate::thermostat_thermostat_initialize();
36
2

            
37
2
    let heat_control: On_Off = test_apis::get_heat_control();
38
2
    let post_lastCmd : On_Off = test_apis::get_lastCmd();
39
2

            
40
2
    // REQ_THERM_1: The Heat Control command shall be initially Off
41
2
    assert!(heat_control == On_Off::Off);
42
2
    assert!(post_lastCmd == On_Off::Off);
43
  }
44

            
45
  // auto-generated example test for `compute` entry point.
46
  // Default-valued inputs (Temp::default() = degrees 0; Set_Points::default()
47
  // = lower 0 / upper 0) leave currentTemp.degrees neither greater than the
48
  // upper bound nor less than the lower bound, so timeTriggered only
49
  // executes the REQ_THERM_4 fall-through path.
50
  #[test]
51
  #[serial]
52
2
  fn test_compute() {
53
2
    crate::thermostat_thermostat_initialize();
54
2

            
55
2
    test_apis::put_current_temp(Isolette_Data_Model::Temp::default());
56
2
    test_apis::put_desired_temp(Isolette_Data_Model::Set_Points::default());
57
2
    test_apis::put_lastCmd(Isolette_Data_Model::On_Off::default());
58
2

            
59
2
    crate::thermostat_thermostat_timeTriggered();
60
  }
61
}
62

            
63
mod GUMBOX_manual_tests {
64
  use serial_test::serial;
65

            
66
  use crate::test::util::*;
67
  use data::Isolette_Data_Model::*;
68

            
69
  // Single manual GUMBOX test that exercises only the REQ_THERM_4 case
70
  // (current_temp 98 lies inside the desired range [98, 100]).
71
  #[test]
72
  #[serial]
73
2
  fn test_compute_GUMBOX_manual_1_a() {
74
2
    crate::thermostat_thermostat_initialize();
75
2

            
76
2
    let current_temp = Temp { degrees: 98 };
77
2
    let lower_desired_temp = Temp { degrees: 98 };
78
2
    let upper_desired_temp = Temp { degrees: 100 };
79
2
    let desired_temp = Set_Points {lower: lower_desired_temp, upper: upper_desired_temp};
80
2
    let last_cmd = On_Off::Onn;
81
2

            
82
2
    let harness_result =
83
2
       cb_apis::testComputeCBwGSV(last_cmd, current_temp, desired_temp);
84
2

            
85
2
    assert!(matches!(harness_result, cb_apis::HarnessResult::Passed));
86
  }
87
}