test_LibItsCam_TypesAndValues.ttcn 7.99 KB
Newer Older
filatov's avatar
filatov committed
1
module test_LibItsCam_TypesAndValues /*language "TTCN-3:2009 Advanced Parameterization"*/ {
2
3
4
5
6
7
8
9
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
    import from CAM_PDU_Descriptions language "ASN.1:1997"all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
garciay's avatar
garciay committed
10
    import from LibItsCommon_Templates all;
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    
    // AtsCam
    import from LibItsCam_TestSystem all;
    import from LibItsCam_Templates all;
    import from LibItsCam_TypesAndValues all;
    import from LibItsCam_Functions all;
    import from LibItsCommon_Functions all;
    
    import from test_CommonCodec all;
    
    group LibItsCam_testCases {
        
        group camTemplates {
            
            template (value) CAM m_camMsg(
                StationID p_stationId,
                GenerationDeltaTime p_generationTime
            ) := {
                header := {
                    protocolVersion := 1,
                    messageID := 2,
                    stationID := p_stationId
                },
                cam := {
                    generationDeltaTime := p_generationTime,
                    camParameters := {
                        basicContainer := {
38
                            stationType := StationType_passengerCar_,
39
40
41
42
                            referencePosition := {
                                latitude := f_integer2Latitude(f_getTsLatitude()),
                                longitude := f_integer2Longitude(f_getTsLongitude()),
                                positionConfidenceEllipse := {
43
44
45
                                    semiMajorConfidence   := SemiAxisLength_oneCentimeter_,
                                    semiMinorConfidence   := SemiAxisLength_oneCentimeter_,
                                    semiMajorOrientation  := HeadingValue_wgs84North_
46
47
                                },
                                altitude := {
48
                                    altitudeValue := AltitudeValue_referenceEllipsoidSurface_,
49
50
51
52
53
54
55
                                    altitudeConfidence := unavailable
                                }
                            }
                        },
                        highFrequencyContainer := {
                            basicVehicleContainerHighFrequency := {
                                heading := {
56
                                    headingValue := HeadingValue_wgs84North_, //0
57
58
59
60
61
62
63
64
65
66
67
68
69
                                    headingConfidence := 10
                                },
                                speed := {
                                    speedValue := 45,
                                    speedConfidence := 5
                                },
                                driveDirection := forward,
                                vehicleLength := {
                                    vehicleLengthValue := 50,
                                    vehicleLengthConfidenceIndication := noTrailerPresent
                                },
                                vehicleWidth := 21,
                                longitudinalAcceleration := {
70
71
                                    longitudinalAccelerationValue := LongitudinalAccelerationValue_unavailable_,
                                    longitudinalAccelerationConfidence := AccelerationConfidence_unavailable_
72
73
                                },
                                curvature := {
74
                                    curvatureValue := CurvatureValue_straight_,
75
76
77
78
                                    curvatureConfidence := unavailable
                                },
                                curvatureCalculationMode := yawRateUsed,
                                yawRate := {
79
                                    yawRateValue := YawRateValue_straight_,
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
                                    yawRateConfidence := unavailable
                                },
                                accelerationControl := omit,
                                lanePosition := omit,
                                steeringWheelAngle := omit,
                                lateralAcceleration := omit,
                                verticalAcceleration := omit, 
                                performanceClass := omit,
                                cenDsrcTollingZone := omit
                            }
                        },
                        lowFrequencyContainer := omit,
                        specialVehicleContainer := omit
                    }
                }
            };
            
        } // End of group camTemplates
        
garciay's avatar
garciay committed
99
100
101
102
103
104
105
106
107
108
109
110
        group testAcEvent {
            
            testcase tc_acSetAtCertificate() runs on TCType system TCType {
                test_PDU<AcSecPrimitive>(m_acEnableSecurity("AT_IUT_1"), false);
            }
            
            testcase tc_acSecResponse() runs on TCType system TCType {
                test_decodePDU<AcSecResponse>(AcSecResponse:?, '040101'O);
            }
            
        } // End of group testAcEvent
            
111
        group testUtEvent {
garciay's avatar
garciay committed
112
            
113
114
115
116
117
118
119
120
121
            testcase tc_UtCamInitialize() runs on TCType system TCType {
                test_PDU<UtInitialize>(m_camInitialize, false);
            }
            
            testcase tc_changeHeading() runs on TCType system TCType {
                test_PDU<UtCamTrigger>(m_changeHeading(5), false);
            }
            
            testcase tc_changePosition() runs on TCType system TCType {
122
123
124
125
126
127
128
129
                test_PDU<UtChangePosition>(
                    UtChangePosition: {
                        latitude := 49845,
                        longitude := 631,
                        elevation := 512
                    }, 
                    false
                );
130
131
132
133
134
135
            }
            
            testcase tc_changeSpeed() runs on TCType system TCType {
                test_PDU<UtCamTrigger>(m_changeSpeed(2), false);
            }
            
136
137
138
139
140
            testcase tc_UtCamEventInd_01() runs on TCType system TCType {
                var octetstring v_data := '23002901020001b207b2f40056b49d200d693a40000200200030d41e0000012016840310a50733a9870fffd0'O;
                test_decodePDU<UtCamEventInd>(UtCamEventInd:?, v_data);
            }
            
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
        } // End of group testUtEvent
        
        group testCamPrimitiveMessages {
            
            testcase tc_CamReq() runs on TCType system TCType {
                log("v_camReq=", m_camReq(
                    m_camMsg(
                        f_getTsStationId(),
                        35000 // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                    )
                ));
                log("v_camReq=", bit2oct(encvalue(m_camReq(
                    m_camMsg(
                        f_getTsStationId(),
                        35000 // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                    )
                ))));
                test_PDU<CamReq>(
                    m_camReq(
                        m_camMsg(
                            f_getTsStationId(),
                            35000 // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                        )
                    ), 
                    true,
166
                    oct2bit('01020001B20788B80059F48D95CDEFC8C6000200200030D41E0000012016840310A50733A9870FFFD0'O)
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
                );
            }
            
            testcase tc_encodeCamTemplate() runs on TCType system TCType {
                var template (value) CamReq v_camReq := m_camReq(
                    m_camMsg_vehicle_HF_BV(
                        f_getTsStationId(),
                        f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                        m_tsPosition
                    )
                );
                log("v_camReq=", v_camReq);
                log("v_camReq=", bit2oct(encvalue(v_camReq)));
                
            }
            
        } // End of group testCamPrimitiveMessages
        
    } // End of group LibItsCam_testCases
filatov's avatar
filatov committed
186
}