Commit abca89e6 authored by garciay's avatar garciay
Browse files

UpperTester/CAM validation

parent 2c5a2057
Loading
Loading
Loading
Loading
+217 −1
Original line number Diff line number Diff line
@@ -220,6 +220,60 @@ module TestCodec_CAM {
        setverdict(pass, "Encoding passed.");
      } // End of tc_Cam_UtCamChangeSpeed
      
      /**
       * @desc Validate template Cam/UtCamSetAccelerationControlStatus
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamSetAccelerationControlStatus() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('3210'O);
        var template (value) UtCamTrigger v_accelerationControlStatus := { setAccelerationControlStatus := '0000100'B };
    
        // Encode template
        log("Encode template ", valueof(v_accelerationControlStatus));
        v_encMsg := encvalue(v_accelerationControlStatus);
        log("Encoded message:  ", bit2oct(v_encMsg));
        // Check result
        if (not isbound(v_encMsg)) {
          setverdict(fail, "Encoding failed!");
          stop;
        }
        if (not match(v_encMsg, v_expEncMsg)) {
          log("Expected message: ", bit2oct(valueof(v_expEncMsg)));
          setverdict(fail, "Encoding failed, not the expected result!");
          stop;
        }
        setverdict(pass, "Encoding passed.");
      } // End of tc_Cam_UtCamSetAccelerationControlStatus
      
      /**
       * @desc Validate template Cam/UtCamSetExteriorLightsStatus
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamSetExteriorLightsStatus() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('3310'O);
        var template (value) UtCamTrigger v_exteriorLightsStatus := { setExteriorLightsStatus := '00010000'B };
    
        // Encode template
        log("Encode template ", valueof(v_exteriorLightsStatus));
        v_encMsg := encvalue(v_exteriorLightsStatus);
        log("Encoded message:  ", bit2oct(v_encMsg));
        // Check result
        if (not isbound(v_encMsg)) {
          setverdict(fail, "Encoding failed!");
          stop;
        }
        if (not match(v_encMsg, v_expEncMsg)) {
          log("Expected message: ", bit2oct(valueof(v_expEncMsg)));
          setverdict(fail, "Encoding failed, not the expected result!");
          stop;
        }
        setverdict(pass, "Encoding passed.");
      } // End of tc_Cam_UtCamSetExteriorLightsStatus
      
      /**
       * @desc Validate template Cam/UtCamChangeHeading
       * @verdict Pass on success, Fail otherwise
@@ -253,7 +307,7 @@ module TestCodec_CAM {
      testcase tc_Cam_UtCamSetDriveDirection() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('350002'O);
        var bitstring v_expEncMsg := oct2bit('3502'O);
    
        // Encode template
        log("Encode template ", valueof(m_setDriveDirection(unavailable)));
@@ -298,6 +352,139 @@ module TestCodec_CAM {
        setverdict(pass, "Encoding passed.");
      } // End of tc_Cam_UtCamChangeYawRate
      
      /**
       * @desc Validate template Cam/UtCamSetStationType
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamSetStationType() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('3903'O);
        var template (value) UtCamTrigger v_stationType := { setStationType := 3 };
    
        // Encode template
        log("Encode template ", valueof(v_stationType));
        v_encMsg := encvalue(v_stationType);
        log("Encoded message:  ", bit2oct(v_encMsg));
        // Check result
        if (not isbound(v_encMsg)) {
          setverdict(fail, "Encoding failed!");
          stop;
        }
        if (not match(v_encMsg, v_expEncMsg)) {
          log("Expected message: ", bit2oct(valueof(v_expEncMsg)));
          setverdict(fail, "Encoding failed, not the expected result!");
          stop;
        }
        setverdict(pass, "Encoding passed.");
      } // End of tc_Cam_UtCamSetStationType
      
      /**
       * @desc Validate template Cam/UtCamSetVehicleRole
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamSetVehicleRole() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('3a05'O);
    
        // Encode template
        log("Encode template ", valueof(m_setVehicleRole(rescue)));
        v_encMsg := encvalue(m_setVehicleRole(rescue));
        log("Encoded message:  ", bit2oct(v_encMsg));
        // Check result
        if (not isbound(v_encMsg)) {
          setverdict(fail, "Encoding failed!");
          stop;
        }
        if (not match(v_encMsg, v_expEncMsg)) {
          log("Expected message: ", bit2oct(valueof(v_expEncMsg)));
          setverdict(fail, "Encoding failed, not the expected result!");
          stop;
        }
        setverdict(pass, "Encoding passed.");
      } // End of tc_Cam_UtCamSetVehicleRole
      
      /**
       * @desc Validate template Cam/UtCamSetEmbarkationStatus
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamSetEmbarkationStatus() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('3bff'O);
        var template (value) UtCamTrigger v_setEmbarkationStatus := { setEmbarkationStatus := true };
    
        // Encode template
        log("Encode template ", valueof(v_setEmbarkationStatus));
        v_encMsg := encvalue(v_setEmbarkationStatus);
        log("Encoded message:  ", bit2oct(v_encMsg));
        // Check result
        if (not isbound(v_encMsg)) {
          setverdict(fail, "Encoding failed!");
          stop;
        }
        if (not match(v_encMsg, v_expEncMsg)) {
          log("Expected message: ", bit2oct(valueof(v_expEncMsg)));
          setverdict(fail, "Encoding failed, not the expected result!");
          stop;
        }
        setverdict(pass, "Encoding passed.");
      } // End of tc_Cam_UtCamSetEmbarkationStatus
      
      /**
       * @desc Validate template Cam/UtCamSetDangerousGoods
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamSetDangerousGoods() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('3D13'O);
    
        // Encode template
        log("Encode template ", valueof(m_setDangerousGoods(miscellaneousDangerousSubstances)));
        v_encMsg := encvalue(m_setDangerousGoods(miscellaneousDangerousSubstances));
        log("Encoded message:  ", bit2oct(v_encMsg));
        // Check result
        if (not isbound(v_encMsg)) {
          setverdict(fail, "Encoding failed!");
          stop;
        }
        if (not match(v_encMsg, v_expEncMsg)) {
          log("Expected message: ", bit2oct(valueof(v_expEncMsg)));
          setverdict(fail, "Encoding failed, not the expected result!");
          stop;
        }
        setverdict(pass, "Encoding passed.");
      } // End of tc_Cam_UtCamSetDangerousGoods
      
      /**
       * @desc Validate template Cam/UtCamSetLightBarSirene
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamSetLightBarSirene() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('3fC0'O);
        var template (value) UtCamTrigger v_setLightBarSirene := { setLightBarSirene := '11'B };
    
        // Encode template
        log("Encode template ", valueof(v_setLightBarSirene));
        v_encMsg := encvalue(v_setLightBarSirene);
        log("Encoded message:  ", bit2oct(v_encMsg));
        // Check result
        if (not isbound(v_encMsg)) {
          setverdict(fail, "Encoding failed!");
          stop;
        }
        if (not match(v_encMsg, v_expEncMsg)) {
          log("Expected message: ", bit2oct(valueof(v_expEncMsg)));
          setverdict(fail, "Encoding failed, not the expected result!");
          stop;
        }
        setverdict(pass, "Encoding passed.");
      } // End of tc_Cam_UtCamSetLightBarSirene
      
      /**
       * @desc Validate decoding of Cam/UtCamTriggerResult
       * @verdict Pass on success, Fail otherwise
@@ -328,6 +515,35 @@ module TestCodec_CAM {
        }
      } // End of tc_Cam_UtCamTriggerResult

      /**
       * @desc Validate decoding of Cam/UtCamEventInd
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamEventInd_1() runs on TCType system TCType {
        var bitstring v_binary := oct2bit('23002e0102000027a8f3080059f3504c2e2dafcb9ffffffc22312b9e20000fc002fe81605a8333a9870fffd1e058ea2167'O);
        var UtCamEventInd v_decMsg;
        var integer v_res := 0;
        
        // Decode template
        v_res := decvalue(v_binary, v_decMsg);
        log("Decoded message: ", v_decMsg);
        select (v_res) {
        case (0) {
          if(match(v_decMsg.camMsg, mw_camMsg_any)) {
            setverdict(pass);
          } else {
            setverdict(fail);
          }
        }
        case (1) {
          setverdict(fail, "Decoding failed.");
        }
        case (2) {
          setverdict(fail, "Not enough bits.");
        }
        }
      } // End of tc_Cam_UtCamEventInd_1

    } // End of group testCamUpperTester
    
    group testCamPort {