Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
4a6f3cf9
Commit
4a6f3cf9
authored
Oct 03, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests for XML escaping
parent
9ca8189d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
24 deletions
+33
-24
asn1c/tests/check-30.c
asn1c/tests/check-30.c
+1
-1
asn1c/tests/check-31.c
asn1c/tests/check-31.c
+1
-1
asn1c/tests/check-35.c
asn1c/tests/check-35.c
+31
-22
No files found.
asn1c/tests/check-30.c
View file @
4a6f3cf9
...
@@ -210,7 +210,7 @@ check_xer(uint8_t *buf, uint8_t size, char *xer_sample) {
...
@@ -210,7 +210,7 @@ check_xer(uint8_t *buf, uint8_t size, char *xer_sample) {
assert
(
xer_off
);
assert
(
xer_off
);
xer_buf
[
xer_off
]
=
0
;
xer_buf
[
xer_off
]
=
0
;
printf
(
"[%s] vs [%s]
\n
"
,
xer_buf
,
xer_sample
);
printf
(
"[%s] vs [%s]
\n
"
,
xer_buf
,
xer_sample
);
assert
(
xer_off
=
xer_sample_len
);
assert
(
xer_off
=
=
xer_sample_len
);
assert
(
memcmp
(
xer_buf
,
xer_sample
,
xer_off
)
==
0
);
assert
(
memcmp
(
xer_buf
,
xer_sample
,
xer_off
)
==
0
);
}
}
...
...
asn1c/tests/check-31.c
View file @
4a6f3cf9
...
@@ -171,7 +171,7 @@ check_xer(uint8_t *buf, uint8_t size, char *xer_sample) {
...
@@ -171,7 +171,7 @@ check_xer(uint8_t *buf, uint8_t size, char *xer_sample) {
assert
(
xer_off
);
assert
(
xer_off
);
xer_buf
[
xer_off
]
=
0
;
xer_buf
[
xer_off
]
=
0
;
printf
(
"[%s] vs [%s]
\n
"
,
xer_buf
,
xer_sample
);
printf
(
"[%s] vs [%s]
\n
"
,
xer_buf
,
xer_sample
);
assert
(
xer_off
=
xer_sample_len
);
assert
(
xer_off
=
=
xer_sample_len
);
assert
(
memcmp
(
xer_buf
,
xer_sample
,
xer_off
)
==
0
);
assert
(
memcmp
(
xer_buf
,
xer_sample
,
xer_off
)
==
0
);
}
}
...
...
asn1c/tests/check-35.c
View file @
4a6f3cf9
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
uint8_t
buf1
[]
=
{
uint8_t
buf1
[]
=
{
32
|
17
,
/* [UNIVERSAL 17], constructed */
32
|
17
,
/* [UNIVERSAL 17], constructed */
1
3
,
/* L */
1
5
,
/* L */
/* b CHOICE { b2 ObjectDescriptor }*/
/* b CHOICE { b2 ObjectDescriptor }*/
7
,
/* [UNIVERSAL 7] */
7
,
/* [UNIVERSAL 7] */
...
@@ -22,9 +22,11 @@ uint8_t buf1[] = {
...
@@ -22,9 +22,11 @@ uint8_t buf1[] = {
/* a NumericString */
/* a NumericString */
18
,
/* [UNIVERSAL 18] */
18
,
/* [UNIVERSAL 18] */
2
,
/* L */
4
,
/* L */
'n'
,
'='
,
's'
,
'<'
,
'&'
,
'>'
,
/* d.r-oid RELATIVE-OID */
/* d.r-oid RELATIVE-OID */
13
,
/* [UNIVERSAL 13] */
13
,
/* [UNIVERSAL 13] */
...
@@ -36,7 +38,7 @@ uint8_t buf1[] = {
...
@@ -36,7 +38,7 @@ uint8_t buf1[] = {
uint8_t
buf1_reconstr
[]
=
{
uint8_t
buf1_reconstr
[]
=
{
32
|
17
,
/* [UNIVERSAL 17], constructed */
32
|
17
,
/* [UNIVERSAL 17], constructed */
1
4
,
/* L */
1
6
,
/* L */
/* c BOOLEAN */
/* c BOOLEAN */
1
,
/* [UNIVERSAL 1] */
1
,
/* [UNIVERSAL 1] */
...
@@ -56,20 +58,24 @@ uint8_t buf1_reconstr[] = {
...
@@ -56,20 +58,24 @@ uint8_t buf1_reconstr[] = {
/* a NumericString */
/* a NumericString */
18
,
/* [UNIVERSAL 18] */
18
,
/* [UNIVERSAL 18] */
2
,
/* L */
4
,
/* L */
'n'
,
'='
,
's'
'<'
,
'&'
,
'>'
,
};
};
uint8_t
buf2
[]
=
{
uint8_t
buf2
[]
=
{
32
|
17
,
/* [UNIVERSAL 17], constructed */
32
|
17
,
/* [UNIVERSAL 17], constructed */
1
3
,
/* L */
1
5
,
/* L */
/* a NumericString */
/* a NumericString */
18
,
/* [UNIVERSAL 18] */
18
,
/* [UNIVERSAL 18] */
2
,
/* L */
4
,
/* L */
'n'
,
'='
,
's'
,
'<'
,
'&'
,
'>'
,
/* c BOOLEAN */
/* c BOOLEAN */
1
,
/* [UNIVERSAL 1] */
1
,
/* [UNIVERSAL 1] */
...
@@ -90,7 +96,7 @@ uint8_t buf2[] = {
...
@@ -90,7 +96,7 @@ uint8_t buf2[] = {
uint8_t
buf2_reconstr
[]
=
{
uint8_t
buf2_reconstr
[]
=
{
32
|
17
,
/* [UNIVERSAL 17], constructed */
32
|
17
,
/* [UNIVERSAL 17], constructed */
1
3
,
/* L */
1
5
,
/* L */
/* c BOOLEAN */
/* c BOOLEAN */
1
,
/* [UNIVERSAL 1] */
1
,
/* [UNIVERSAL 1] */
...
@@ -104,9 +110,11 @@ uint8_t buf2_reconstr[] = {
...
@@ -104,9 +110,11 @@ uint8_t buf2_reconstr[] = {
/* a NumericString */
/* a NumericString */
18
,
/* [UNIVERSAL 18] */
18
,
/* [UNIVERSAL 18] */
2
,
/* L */
4
,
/* L */
'n'
,
'='
,
's'
,
'<'
,
'&'
,
'>'
,
/* b CHOICE { b1 IA5String }*/
/* b CHOICE { b1 IA5String }*/
22
,
/* [UNIVERSAL 22] */
22
,
/* [UNIVERSAL 22] */
...
@@ -128,7 +136,7 @@ check(T_t *tp, uint8_t *buf, int size, size_t consumed) {
...
@@ -128,7 +136,7 @@ check(T_t *tp, uint8_t *buf, int size, size_t consumed) {
assert
(
rval
.
code
==
RC_OK
);
assert
(
rval
.
code
==
RC_OK
);
assert
(
rval
.
consumed
==
consumed
);
assert
(
rval
.
consumed
==
consumed
);
assert
(
strcmp
(
tp
->
a
.
buf
,
"
ns
"
)
==
0
);
assert
(
strcmp
(
tp
->
a
.
buf
,
"
=<&>
"
)
==
0
);
assert
(
strcmp
(
tp
->
b
.
choice
.
b1
.
buf
,
"z"
)
==
0
assert
(
strcmp
(
tp
->
b
.
choice
.
b1
.
buf
,
"z"
)
==
0
&&
strcmp
(
tp
->
b
.
choice
.
b2
.
buf
,
"z"
)
==
0
);
&&
strcmp
(
tp
->
b
.
choice
.
b2
.
buf
,
"z"
)
==
0
);
...
@@ -288,11 +296,12 @@ check_xer(uint8_t *buf, uint8_t size, char *xer_sample) {
...
@@ -288,11 +296,12 @@ check_xer(uint8_t *buf, uint8_t size, char *xer_sample) {
xer_off
=
0
;
xer_off
=
0
;
er
=
xer_encode
(
&
asn_DEF_T
,
tp
,
XER_F_CANONICAL
,
xer_cb
,
0
);
er
=
xer_encode
(
&
asn_DEF_T
,
tp
,
XER_F_CANONICAL
,
xer_cb
,
0
);
assert
(
er
.
encoded
==
xer_off
);
assert
(
xer_off
);
assert
(
xer_off
);
xer_buf
[
xer_off
]
=
0
;
xer_buf
[
xer_off
]
=
0
;
printf
(
"[%s] vs [%s]
\n
"
,
xer_buf
,
xer_sample
);
printf
(
"[%s] (%d/%d) vs [%s] (%d)
\n
"
,
assert
(
xer_off
=
xer_sample_len
);
xer_buf
,
er
.
encoded
,
xer_off
,
xer_sample
,
xer_sample_len
);
assert
(
er
.
encoded
==
xer_off
);
assert
(
xer_off
==
xer_sample_len
);
assert
(
memcmp
(
xer_buf
,
xer_sample
,
xer_off
)
==
0
);
assert
(
memcmp
(
xer_buf
,
xer_sample
,
xer_off
)
==
0
);
}
}
...
@@ -307,12 +316,12 @@ main(int ac, char **av) {
...
@@ -307,12 +316,12 @@ main(int ac, char **av) {
check
(
&
t
,
buf1
,
sizeof
(
buf1
)
+
10
,
sizeof
(
buf1
));
check
(
&
t
,
buf1
,
sizeof
(
buf1
)
+
10
,
sizeof
(
buf1
));
compare
(
&
t
,
buf1_reconstr
,
sizeof
(
buf1_reconstr
));
compare
(
&
t
,
buf1_reconstr
,
sizeof
(
buf1_reconstr
));
asn_DEF_T
.
free_struct
(
&
asn_DEF_T
,
&
t
,
1
);
asn_DEF_T
.
free_struct
(
&
asn_DEF_T
,
&
t
,
1
);
check_xer
(
buf1
,
sizeof
(
buf1
),
"<T><c><false/></c><b><b2>z</b2></b><a>
ns
</a><d><r-oid>85.79</r-oid></d></T>"
);
check_xer
(
buf1
,
sizeof
(
buf1
),
"<T><c><false/></c><b><b2>z</b2></b><a>
=<&>
</a><d><r-oid>85.79</r-oid></d></T>"
);
check
(
&
t
,
buf2
,
sizeof
(
buf2
)
+
10
,
sizeof
(
buf2
));
check
(
&
t
,
buf2
,
sizeof
(
buf2
)
+
10
,
sizeof
(
buf2
));
compare
(
&
t
,
buf2_reconstr
,
sizeof
(
buf2_reconstr
));
compare
(
&
t
,
buf2_reconstr
,
sizeof
(
buf2_reconstr
));
asn_DEF_T
.
free_struct
(
&
asn_DEF_T
,
&
t
,
1
);
asn_DEF_T
.
free_struct
(
&
asn_DEF_T
,
&
t
,
1
);
check_xer
(
buf2
,
sizeof
(
buf2
),
"<T><c><true/></c><b><b1>z</b1></b><a>
ns
</a><d><oid>2.1</oid></d></T>"
);
check_xer
(
buf2
,
sizeof
(
buf2
),
"<T><c><true/></c><b><b1>z</b1></b><a>
=<&>
</a><d><oid>2.1</oid></d></T>"
);
/* Split the buffer in parts and check decoder restartability */
/* Split the buffer in parts and check decoder restartability */
partial_read
(
buf1
,
sizeof
(
buf1
));
partial_read
(
buf1
,
sizeof
(
buf1
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment