Commit 2eff1f09 authored by garciay's avatar garciay
Browse files

UpperTester/CAM validation

parent ca6c698e
Loading
Loading
Loading
Loading
+236 −16
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ module TestCodec_CAM {
  import from LibItsCommon_ASN1_NamedNumbers all;
    
  // LibItsCam
  import from LibItsCam_TypesAndValues all;
  import from LibItsCam_TestSystem all;
  import from LibItsCam_Templates all;
    
@@ -34,15 +35,15 @@ module TestCodec_CAM {
          basicContainer := {
            stationType := StationType_passengerCar_,
            referencePosition := {
              latitude := f_integer2Latitude(f_getTsLatitude()),
              longitude := f_integer2Longitude(f_getTsLongitude()),
              latitude := 435525985,
              longitude := 103001180,
              positionConfidenceEllipse := {
                semiMajorConfidence   := SemiAxisLength_oneCentimeter_,
                semiMinorConfidence   := SemiAxisLength_oneCentimeter_,
                semiMajorOrientation  := HeadingValue_wgs84North_
                semiMajorConfidence   := 4095,
                semiMinorConfidence   := 4095,
                semiMajorOrientation  := 3601
                },
              altitude := {
                altitudeValue := AltitudeValue_unavailable_,
                altitudeValue := 700,
                altitudeConfidence := unavailable
              }
              }
@@ -51,18 +52,18 @@ module TestCodec_CAM {
            basicVehicleContainerHighFrequency := {
              heading := {
                headingValue := HeadingValue_wgs84North_, //0
                headingConfidence := 10
                headingConfidence := 127
              },
              speed := {
                speedValue := 45,
                speedConfidence := 5
                speedValue := 5,
                speedConfidence := 127
              },
              driveDirection := forward,
              driveDirection := unavailable,
              vehicleLength := {
                vehicleLengthValue := 50,
                vehicleLengthValue := 23,
                vehicleLengthConfidenceIndication := noTrailerPresent
                },
              vehicleWidth := 21,
              vehicleWidth := 12,
              longitudinalAcceleration := {
                longitudinalAccelerationValue := LongitudinalAccelerationValue_unavailable_,
                longitudinalAccelerationConfidence := AccelerationConfidence_unavailable_
@@ -77,7 +78,7 @@ module TestCodec_CAM {
                yawRateConfidence := unavailable
                },
              accelerationControl := omit,
              lanePosition := omit,
              lanePosition := 14,
              steeringWheelAngle := omit,
              lateralAcceleration := omit,
              verticalAcceleration := omit, 
@@ -99,17 +100,236 @@ module TestCodec_CAM {
        TestCamReq(
                   m_camReq(
                            m_camMsg(
                                     f_getTsStationId(),
                                     35000 // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                                     10152,
                                     62216
                                     )
                            ), 
                   true,
                   oct2bit('01020001B20788B80059F48D95CDEFC8C5E0020020002461A83C000004805A100C4528399D4C387FFF80'O)
                   oct2bit('0102000027a8f3080059f3504c2e2dafcb9ffffffc22312b9e20000fc002fe81605a8333a9870fffd1e058ea2167'O)
                   );
      }
            
    } // End of group testCamPrimitiveMessages

    group testCamUpperTester {

      /**
       * @desc Validate template GeoNetworking/UtCamInitialize
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamInitialize() runs on TCType system TCType {
        var bitstring v_encMsg;
        var UtCamInitialize v_decMsg;
        var integer v_res := 0;
        var template (value) UtCamInitialize m_utCamInitialize := { '0809AABBCCDDEEFF'O };
        var bitstring v_expEncMsg := oct2bit('000809AABBCCDDEEFF'O);
    
        // Encode template
        log("Encode template ", valueof(m_utCamInitialize));
      v_encMsg := encvalue(m_utCamInitialize);
        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_UtCamInitialize

      /**
       * @desc Validate template Cam/UtCamChangePosition
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamChangePosition() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var template (value) UtCamChangePosition v_utCamChangePosition := { 1234, 5678, 9876 };
        var bitstring v_expEncMsg := oct2bit('02000004D20000162E00002694'O);
    
        // Encode template
        log("Encode template ", valueof(v_utCamChangePosition));
      v_encMsg := encvalue(v_utCamChangePosition);
        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_UtCamChangePosition
      
      /**
       * @desc Validate template Cam/UtCamChangeCurvature
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamChangeCurvature() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('30000a'O);
    
        // Encode template
        log("Encode template ", valueof(m_changeCurvature(10)));
        v_encMsg := encvalue(m_changeCurvature(10));
        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_UtCamChangeCurvature
      
      /**
       * @desc Validate template Cam/UtCamChangeSpeed
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamChangeSpeed() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('310020'O);
    
        // Encode template
        log("Encode template ", valueof(m_changeSpeed(32)));
        v_encMsg := encvalue(m_changeSpeed(32));
        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_UtCamChangeSpeed
      
      /**
       * @desc Validate template Cam/UtCamChangeHeading
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamChangeHeading() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('340010'O);
    
        // Encode template
        log("Encode template ", valueof(m_changeHeading(16)));
        v_encMsg := encvalue(m_changeHeading(16));
        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_UtCamChangeHeading
      
      /**
       * @desc Validate template Cam/UtCamSetDriveDirection
       * @verdict Pass on success, Fail otherwise
       */
      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);
    
        // Encode template
        log("Encode template ", valueof(m_setDriveDirection(unavailable)));
        v_encMsg := encvalue(m_setDriveDirection(unavailable));
        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_UtCamSetDriveDirection
      
      /**
       * @desc Validate template Cam/UtCamChangeYawRate
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamChangeYawRate() runs on TCType system TCType {
        var bitstring v_encMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('360010'O);
    
        // Encode template
        log("Encode template ", valueof(m_changeYawRate(-128)));
        v_encMsg := encvalue(m_changeYawRate(-128));
        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_UtCamChangeYawRate
      
      /**
       * @desc Validate decoding of Cam/UtCamTriggerResult
       * @verdict Pass on success, Fail otherwise
       */
      testcase tc_Cam_UtCamTriggerResult() runs on TCType system TCType {
        var bitstring v_binary := oct2bit('2101'O);
        var UtCamResults v_decMsg;
        var integer v_res := 0;
        var template (value) UtCamResults v_expDecMsg := { utCamTriggerResult := true };
        
        // Decode template
        v_res := decvalue(v_binary, v_decMsg);
        log("Decoded message: ", v_decMsg);
        select (v_res) {
        case (0) {
          if(match(v_decMsg, v_expDecMsg)) {
            setverdict(pass);
          } else {
            setverdict(fail);
          }
        }
        case (1) {
          setverdict(fail, "Decoding failed.");
        }
        case (2) {
          setverdict(fail, "Not enough bits.");
        }
        }
      } // End of tc_Cam_UtCamTriggerResult

    } // End of group testCamUpperTester
    
    group testCamPort {
            
      /**
+1 −1
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ module TestCodec_DENM {
       */
      testcase tc_Denm_UtDenmUpdate_1() runs on TCType system TCType {
        var bitstring v_encMsg;
        var UtDenmTrigger v_decMsg;
        var UtDenmUpdate v_decMsg;
        var integer v_res := 0;
        var bitstring v_expEncMsg := oct2bit('12400001B207000A005E28CBC883005B0000'O);
        var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);