Newer
Older
1
2
3
4
5
6
7
8
9
10
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
38
39
40
module TestCodec_External {
// LibMec
import from LocationAPI_TypesAndValues all;
import from LocationAPI_Templates all;
// TestCodec
import from TestCodec_TestAndSystem all;
testcase tc_encode_LocationInfo() runs on TCType system TCType {
var LocationInfo v_location_info := valueof(m_location_info(10.0, 12.0, 9));
var LocationInfo v_location_info_result;
var universal charstring v_result;
var universal charstring v_expected_result := "{\"latitude\":10.000000,\"longitude\":12.000000,\"accuracy\":9}";
var bitstring v_enc_msg;
var integer v_res;
v_enc_msg := encvalue(v_location_info);
v_result := oct2unichar(bit2oct(v_enc_msg), "UTF-8");
log("v_result= ", v_result);
if (match(v_expected_result, v_result)) {
setverdict(pass, "Encoding succeed");
} else {
setverdict(fail, "Encoding failed");
}
v_res := decvalue(v_enc_msg, v_location_info_result);
if (v_res == 0) {
log("v_location_info_result= ", v_location_info_result);
if (match(v_location_info, v_location_info_result)) {
setverdict(pass, "Decoding succeed");
} else {
setverdict(fail, "Decoding failed");
}
} else {
setverdict(fail, "Decoding operation failed");
}
} // End of testcase tc_encode_LocationInfo
} // End of module TestCodec_External