Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Projects
Eclipse Titan
titan.EclipsePlug-ins
Commits
209b97a4
Commit
209b97a4
authored
Dec 10, 2019
by
balaskoa
Browse files
json and all_from tests have been added to Regression_Test_java
Signed-off-by:
balaskoa
<
Jeno.Balasko@ericsson.com
>
parent
9ee33d12
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Regression_Test_java/.TITAN_properties
View file @
209b97a4
...
...
@@ -21,4 +21,13 @@
</FileProperties>
</FileResource>
</FileProperties>
<FolderProperties>
<FolderResource>
<FolderPath>
src/json
</FolderPath>
<FolderProperties>
<CentralStorage>
false
</CentralStorage>
<ExcludeFromBuild>
true
</ExcludeFromBuild>
</FolderProperties>
</FolderResource>
</FolderProperties>
</TITAN_Designer_Properties>
\ No newline at end of file
Regression_Test_java/single_config.cfg
View file @
209b97a4
...
...
@@ -17,7 +17,19 @@ LogEntityName := Yes
[EXECUTE]
all_from_subrefs.control
#==all from:==
all_from_complement
all_from_permutation
all_from_subrefs
all_from_subset
all_from_subtype
all_from_superset
all_from_var
all_from_with_functions #TODO: JSON enc-dec function handling
all_from
sapc.control
#everything - no control part, TODO: repair the test, rework the whole! It was just a sketch.
#
hex_to_OK.control
#functions.control
TtemplateAnytype.control
...
...
@@ -107,3 +119,9 @@ TsetofOper.control
all_from.control
str_to_OK.control
replacer_SW.control
#json (There are testcases commented out in it!! In preinit of JsonTypes it stops with exception)
#AttributeTestcases.control
#JsonTestcases.control
Regression_Test_java/src/all_from/all_from.ttcn
View file @
209b97a4
...
...
@@ -14,20 +14,7 @@
module
all_from
{
// ETSI CR 6088
import
from
types
all
;
import
from
functions
all
;
template
RoI
t_imported_RoI1
:=
{
1
,
2
,
(
6
..
9
)};
template
RoI
t_imported_RoI2
:=
{
1
,
*
,
3
};
template
RoI
t_imported_RoI3
:=
{
20
,
21
,
22
};
template
RoI
t_imported_RoI4
:=
{
1
,
?
,
3
};
//for permutation:
template
RoI
t_imported_RoI1_P
:=
{
1
,
2
,
*
};
template
RoI
t_imported_RoI3_P
:=
{
1
,
2
,
3
};
template
RoI
t_imported_RoI7_P
:=
{
1
,
2
,
?
};
//===========Set of Integer================================
template
SoI
t_imported_SoI1
:=
{
1
,
2
,(
6
..
9
)};
template
SoI
t_imported_SoI2
:=
{
1
,
*
,
3
};
template
SoI
t_imported_SoI3
:=
{
20
,
21
,
22
};
import
from
imported_templates
all
;
//just to test these types as well:
modulepar
RoI
tsp_RoI3
:=
{
20
,
21
,
22
};
...
...
Regression_Test_java/src/all_from/all_from_complement.ttcn
View file @
209b97a4
...
...
@@ -13,20 +13,7 @@
module
all_from_complement
{
// ETSI CR 6088
import
from
types
all
;
import
from
functions
all
;
template
RoI
t_imported_RoI1
:=
{
1
,
2
,
(
6
..
9
)};
template
RoI
t_imported_RoI2
:=
{
1
,
*
,
3
};
template
RoI
t_imported_RoI3
:=
{
20
,
21
,
22
};
template
RoI
t_imported_RoI4
:=
{
1
,
?
,
3
};
//for permutation:
template
RoI
t_imported_RoI1_P
:=
{
1
,
2
,
*
};
template
RoI
t_imported_RoI3_P
:=
{
1
,
2
,
3
};
template
RoI
t_imported_RoI7_P
:=
{
1
,
2
,
?
};
//===========Set of Integer================================
template
SoI
t_imported_SoI1
:=
{
1
,
2
,(
6
..
9
)};
template
SoI
t_imported_SoI2
:=
{
1
,
*
,
3
};
template
SoI
t_imported_SoI3
:=
{
20
,
21
,
22
};
import
from
imported_templates
all
;
// B 1.2.1 Template List
// "It can be used on values of all types"
...
...
@@ -44,7 +31,7 @@ template RoI t_RoI2 := {1, *, 3};
template
RoI
t_RoI3
:=
{
20
,
21
,
22
};
template
RoI
t_RoI4
:=
{
1
,
?
,
3
};
//template RoI t_RoI1c := {complement (1),complement (2), complement(6)};
//template RoI t_RoI1c := {complement (1),complement (2), complement(6)};
template
integer
t_i0
:=
complement
(
all
from
t_RoI1
);
template
integer
t_i0_eq
:=
complement
(
1
,
2
,
(
6
..
9
));
...
...
Regression_Test_java/src/all_from/all_from_permutation.ttcn
View file @
209b97a4
...
...
@@ -16,20 +16,7 @@ module all_from_permutation
{
import
from
types
all
;
import
from
functions
all
;
template
RoI
t_imported_RoI1
:=
{
1
,
2
,
(
6
..
9
)};
template
RoI
t_imported_RoI2
:=
{
1
,
*
,
3
};
template
RoI
t_imported_RoI3
:=
{
20
,
21
,
22
};
template
RoI
t_imported_RoI4
:=
{
1
,
?
,
3
};
//for permutation:
template
RoI
t_imported_RoI1_P
:=
{
1
,
2
,
*
};
template
RoI
t_imported_RoI3_P
:=
{
1
,
2
,
3
};
template
RoI
t_imported_RoI7_P
:=
{
1
,
2
,
?
};
//===========Set of Integer================================
template
SoI
t_imported_SoI1
:=
{
1
,
2
,(
6
..
9
)};
template
SoI
t_imported_SoI2
:=
{
1
,
*
,
3
};
template
SoI
t_imported_SoI3
:=
{
20
,
21
,
22
};
import
from
imported_templates
all
;
// Test Target:
// B.1.3.3 Permutation
...
...
Regression_Test_java/src/all_from/all_from_subset.ttcn
View file @
209b97a4
...
...
@@ -14,20 +14,7 @@ module all_from_subset
{
import
from
types
all
;
import
from
functions
all
;
template
RoI
t_imported_RoI1
:=
{
1
,
2
,
(
6
..
9
)};
template
RoI
t_imported_RoI2
:=
{
1
,
*
,
3
};
template
RoI
t_imported_RoI3
:=
{
20
,
21
,
22
};
template
RoI
t_imported_RoI4
:=
{
1
,
?
,
3
};
//for permutation:
template
RoI
t_imported_RoI1_P
:=
{
1
,
2
,
*
};
template
RoI
t_imported_RoI3_P
:=
{
1
,
2
,
3
};
template
RoI
t_imported_RoI7_P
:=
{
1
,
2
,
?
};
//===========Set of Integer================================
template
SoI
t_imported_SoI1
:=
{
1
,
2
,(
6
..
9
)};
template
SoI
t_imported_SoI2
:=
{
1
,
*
,
3
};
template
SoI
t_imported_SoI3
:=
{
20
,
21
,
22
};
import
from
imported_templates
all
;
// Test Target:
// ETSI ES 201 873-1 v?.?
...
...
Regression_Test_java/src/all_from/all_from_subtype.ttcn
View file @
209b97a4
...
...
@@ -15,7 +15,7 @@
module
all_from_subtype
{
import
from
types
all
;
import
from
functions
all
;
/* * * * integer * * * */
template
RoI
t_RoI1
:=
{
1
,
2
,
(
6
..
9
)
};
...
...
Regression_Test_java/src/all_from/all_from_superset.ttcn
View file @
209b97a4
...
...
@@ -14,21 +14,7 @@ module all_from_superset
{
import
from
types
all
;
import
from
functions
all
;
template
RoI
t_imported_RoI1
:=
{
1
,
2
,
(
6
..
9
)};
template
RoI
t_imported_RoI2
:=
{
1
,
*
,
3
};
template
RoI
t_imported_RoI3
:=
{
20
,
21
,
22
};
template
RoI
t_imported_RoI4
:=
{
1
,
?
,
3
};
//for permutation:
template
RoI
t_imported_RoI1_P
:=
{
1
,
2
,
*
};
template
RoI
t_imported_RoI3_P
:=
{
1
,
2
,
3
};
template
RoI
t_imported_RoI7_P
:=
{
1
,
2
,
?
};
//===========Set of Integer================================
template
SoI
t_imported_SoI1
:=
{
1
,
2
,(
6
..
9
)};
template
SoI
t_imported_SoI2
:=
{
1
,
*
,
3
};
template
SoI
t_imported_SoI3
:=
{
20
,
21
,
22
};
import
from
imported_templates
all
;
template
RoI
t_RoI1
:=
{
1
,
2
,
(
6
..
9
)};
template
RoI
t_RoI2
:=
{
1
,
*
,
3
};
...
...
Regression_Test_java/src/all_from/all_from_with_functions.ttcn
View file @
209b97a4
...
...
@@ -14,7 +14,7 @@ module all_from_with_functions {
//for TR: HR91302 - compiler core dump if function called in "all from"
//
external function f_ext(in template RoI r) return template RoI;
external
function
f_ext
(
in
template
RoI
r
)
return
template
RoI
;
type
record
of
integer
RoI
with
{
encode
"JSON"
};
type
set
of
integer
SoI
;
...
...
@@ -65,7 +65,7 @@ testcase tc_all_from_with_functions() runs on CT_Empty {
var
template
RoI
t1
:=
{
permutation
(
all
from
f_dummy2
(
{
1
,
2
},
{
3
,
4
}
)
)
};
var
template
RoI
t2
:=
f_dummy2
(
{
1
,
2
},
{
3
,
4
}
);
var
template
RoI
t3
:=
{
permutation
(
all
from
t2
)
};
//
var template RoI t4 := { permutation ( all from f_ext( {1, 2} ) ) };
var
template
RoI
t4
:=
{
permutation
(
all
from
f_ext
(
{
1
,
2
}
)
)
};
var
template
integer
t5
:=
(
1
,
2
,
all
from
f_dummy
(
{
1
,
2
,
(
6
..
9
)}
),
10
);
var
template
integer
t6
:=
complement
(
1
,
2
,
all
from
f_dummy
(
{
1
,
2
,
(
6
..
9
)}
),
10
);
var
template
SoI
t7
:=
subset
(
1
,
2
,
all
from
f_dummy
(
{
3
,
4
}
),
5
)
length
(
2
..
3
);
...
...
@@ -91,7 +91,7 @@ testcase tc_all_from_with_functions() runs on CT_Empty {
//log("t13=", t13);
if
(
log2str
(
t1
)
==
"{ permutation(3, 4) }"
and
log2str
(
t2
)
==
"{ 3, 4 }"
and
log2str
(
t3
)
==
"{ permutation(3, 4) }"
/*
and log2str(t4) == "{ permutation(1, 2) }"
*/
and
log2str
(
t3
)
==
"{ permutation(3, 4) }"
and
log2str
(
t4
)
==
"{ permutation(1, 2) }"
and
log2str
(
t5
)
==
"(1, 2, 1, 2, (6 .. 9), 10)"
and
log2str
(
t6
)
==
"complement(1, 2, 1, 2, (6 .. 9), 10)"
and
log2str
(
t7
)
==
"subset(1, 2, 3, 4, 5) length (2 .. 3)"
and
...
...
@@ -129,41 +129,41 @@ function f_non_templ(in RoI x) return RoI
return
x
;
}
//
external function f_dec_roi(in octetstring os) return RoI
//
with { extension "prototype(convert) decode(JSON)" }
external
function
f_dec_roi
(
in
octetstring
os
)
return
RoI
with
{
extension
"prototype(convert) decode(JSON)"
}
// all from used on regular (non-template) functions
//
testcase tc_all_from_with_functions2() runs on CT_Empty
//
{
//
var template RoI vt_func_roi := { permutation ( all from f_non_templ( { 1, 4, 7, 10 } ) ) };
//
var template integer vt_func_int := ( 0, 1, all from f_non_templ( { 3, 6, 9 } ) );
//
//
var octetstring v_enc := char2oct("[ 4, 2, 10, 100 ]");
//
var template RoI vt_ext_func_roi := { permutation ( all from f_dec_roi(v_enc) ) };
//
var template integer vt_ext_func_int := ( 0, 1, all from f_dec_roi(v_enc) );
//
//
var charstring v_res_log := "{ permutation(1, 4, 7, 10) }";
//
if (log2str(vt_func_roi) != v_res_log) {
//
setverdict(fail, "Expected: ", v_res_log, ", got: ", vt_func_roi);
//
}
//
//
v_res_log := "(0, 1, 3, 6, 9)";
//
if (log2str(vt_func_int) != v_res_log) {
//
setverdict(fail, "Expected: ", v_res_log, ", got: ", vt_func_int);
//
}
//
//
v_res_log := "{ permutation(4, 2, 10, 100) }";
//
if (log2str(vt_ext_func_roi) != v_res_log) {
//
setverdict(fail, "Expected: ", v_res_log, ", got: ", vt_ext_func_roi);
//
}
//
//
v_res_log := "(0, 1, 4, 2, 10, 100)";
//
if (log2str(vt_ext_func_int) != v_res_log) {
//
setverdict(fail, "Expected: ", v_res_log, ", got: ", vt_ext_func_int);
//
}
//
//
setverdict(pass);
//
}
testcase
tc_all_from_with_functions2
()
runs
on
CT_Empty
{
var
template
RoI
vt_func_roi
:=
{
permutation
(
all
from
f_non_templ
(
{
1
,
4
,
7
,
10
}
)
)
};
var
template
integer
vt_func_int
:=
(
0
,
1
,
all
from
f_non_templ
(
{
3
,
6
,
9
}
)
);
var
octetstring
v_enc
:=
char2oct
(
"[ 4, 2, 10, 100 ]"
);
var
template
RoI
vt_ext_func_roi
:=
{
permutation
(
all
from
f_dec_roi
(
v_enc
)
)
};
var
template
integer
vt_ext_func_int
:=
(
0
,
1
,
all
from
f_dec_roi
(
v_enc
)
);
var
charstring
v_res_log
:=
"{ permutation(1, 4, 7, 10) }"
;
if
(
log2str
(
vt_func_roi
)
!=
v_res_log
)
{
setverdict
(
fail
,
"Expected: "
,
v_res_log
,
", got: "
,
vt_func_roi
);
}
v_res_log
:=
"(0, 1, 3, 6, 9)"
;
if
(
log2str
(
vt_func_int
)
!=
v_res_log
)
{
setverdict
(
fail
,
"Expected: "
,
v_res_log
,
", got: "
,
vt_func_int
);
}
v_res_log
:=
"{ permutation(4, 2, 10, 100) }"
;
if
(
log2str
(
vt_ext_func_roi
)
!=
v_res_log
)
{
setverdict
(
fail
,
"Expected: "
,
v_res_log
,
", got: "
,
vt_ext_func_roi
);
}
v_res_log
:=
"(0, 1, 4, 2, 10, 100)"
;
if
(
log2str
(
vt_ext_func_int
)
!=
v_res_log
)
{
setverdict
(
fail
,
"Expected: "
,
v_res_log
,
", got: "
,
vt_ext_func_int
);
}
setverdict
(
pass
);
}
// all from used in function actual parameters
template
RoI
t
:=
{
6
,
8
};
...
...
@@ -188,7 +188,7 @@ testcase tc_all_from_func_params2() runs on CT_Empty
control
{
execute
(
tc_all_from_with_functions
());
execute
(
tc_all_from_func_params
());
//
execute(tc_all_from_with_functions2());
execute
(
tc_all_from_with_functions2
());
execute
(
tc_all_from_func_params2
());
}
...
...
Regression_Test_java/src/json/.gitignore
0 → 100755
View file @
209b97a4
json
json.exe
AttributeTestcases*.cc
AttributeTestcases*.hh
Functions*.cc
Functions*.hh
JsonData*.cc
JsonData*.hh
OtherTypes*.cc
OtherTypes*.hh
SemanticCheck*.cc
SemanticCheck*.hh
Testcases*.cc
Testcases*.hh
Types*.cc
Types*.hh
Cbor*.cc
Cbor*.hh
Bson*.cc
Bson*.hh
logs
compile
Regression_Test_java/src/json/AttributeTestcases.ttcn
0 → 100755
View file @
209b97a4
This diff is collapsed.
Click to expand it.
Regression_Test_java/src/json/Bson.ttcn
0 → 100755
View file @
209b97a4
/******************************************************************************
* Copyright (c) 2000-2019 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
*
* Contributors:
* Szabo, Bence Janos
*
******************************************************************************/
module
Bson
{
type
component
EmptyCT
{
}
testcase
tc_bson_encdec
()
runs
on
EmptyCT
{
var
octetstring
os
,
expected_os
;
var
universal
charstring
json
,
decoded
,
decoded_json
;
json
:=
"{}"
expected_os
:=
'0500000000'O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
a
\"
:
\"
b
\"
}"
expected_os
:=
'
0
E00000002610002000000620000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
aaaab
\"
:
\"
bbbbbbc
\"
}"
expected_os
:=
'
180000000261616161620008000000626262626262630000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
ááá
\"
:
\"
óóó
\"
}"
expected_os
:=
'
1800000002
C3A1C3A1C3A10007000000C3B3C3B3C3B30000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
a
\"
:
\"
b
\"
,
\"
c
\"
:
\"
d
\"
}"
expected_os
:=
'1700000002610002000000620002630002000000640000'O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
a
\"
:1}"
expected_os
:=
'
0
C0000001061000100000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:15614615}"
expected_os
:=
'
0
E00000010616263009742EE0000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:-15614615}"
expected_os
:=
'
0
E000000106162630069BD11FF00
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:4586797657}"
expected_os
:=
'
12000000126162630059
FA64110100000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:-4586797657}"
expected_os
:=
'
120000001261626300
A7059BEEFEFFFFFF00
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:1.120000}"
expected_os
:=
'
090000000161626300
EC51B81E85EBF13F00
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:-11321.120465}"
expected_os
:=
'
090000000161626300
A8A9656B8F1CC6C000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:true}"
expected_os
:=
'
0900000008616263000100
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:false}"
expected_os
:=
'
0900000008616263000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:null}"
expected_os
:=
'
090000000
A6162630000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:[1]}"
expected_os
:=
'
1600000004616263000
C000000103000010000000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:[1,2,
\"
abc
\"
]}"
expected_os
:=
'
2800000004616263001
E000000103000010000001031000200000002320004000000616263000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:[1,2,[3,4],
\"
abc
\"
]}"
expected_os
:=
'
3
E00000004616263003400000010300001000000103100020000000432001300000010300003000000103100040000000002320004000000616263000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:{
\"
def
\"
:4}}"
expected_os
:=
'
1800000003616263000
E0000001064656600040000000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:{
\"
a
\"
:[2]}}"
expected_os
:=
'
1
E0000000361626300140000000461000C00000010300002000000000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:[2,{
\"
a
\"
:4}]}"
expected_os
:=
'
2500000004616263001
B000000103000020000000331000C00000010610004000000000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
json
:=
"{
\"
abc
\"
:{
\"
def
\"
:4,
\"
dd
\"
:[1,2,3,{
\"
q
\"
:3},3]},
\"
w
\"
:[{
\"
a
\"
:3}]}"
expected_os
:=
'
6300000003616263004200000010646566000400000004646400300000001030000100000010310002000000103200030000000333000
C0000001071000300000000103400030000000000047700140000000330000C00000010610003000000000000
'
O
;
os
:=
json2bson
(
json
);
log
(
os
);
if
(
not
match
(
os
,
expected_os
))
{
setverdict
(
fail
,
match
(
os
,
expected_os
));
}
decoded
:=
bson2json
(
os
);
if
(
not
match
(
decoded
,
json
))
{
setverdict
(
fail
,
match
(
decoded
,
json
));
}
// Special cases
json
:=
"{
\"
a
\"
:{
\"
$binary
\"
:
\"
VEVTVCBUM1NU
\"
,
\"
$type
\"
:
\"
01
\"
}}"