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
54f34516
Commit
54f34516
authored
Jul 10, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add failed test for INTEGER decode OER
parent
4558ad06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
skeletons/tests/check-OER-INTEGER.c
skeletons/tests/check-OER-INTEGER.c
+32
-2
No files found.
skeletons/tests/check-OER-INTEGER.c
View file @
54f34516
...
@@ -5,11 +5,41 @@
...
@@ -5,11 +5,41 @@
#include <INTEGER.c>
#include <INTEGER.c>
#include <INTEGER_oer.c>
#include <INTEGER_oer.c>
#define CHECK_DECODE_OK(a, b, c) check_decode_ok(__LINE__, a, b, c)
void
void
check_decode_ok
(
intmax_t
control
,
uint8_t
*
buf
,
size_t
size
)
{
check_decode_ok
(
int
lineno
,
intmax_t
control
,
char
*
buf
,
size_t
size
)
{
INTEGER_t
*
st
=
NULL
;
asn_dec_rval_t
ret
;
ret
=
asn_DEF_INTEGER
.
oer_decoder
(
0
,
&
asn_DEF_INTEGER
,
0
,
(
void
**
)
&
st
,
buf
,
size
);
if
(
ret
.
code
!=
RC_OK
)
{
/* Basic OER decode does not work */
fprintf
(
stderr
,
"%d: Failed oer_decode(ctl=%"
PRIdMAX
", size=%zu)
\n
"
,
lineno
,
control
,
size
);
assert
(
ret
.
code
==
RC_OK
);
}
else
{
intmax_t
outcome
;
if
(
asn_INTEGER2imax
(
st
,
&
outcome
)
!=
0
)
{
/* Result of decode is structurally incorrect */
fprintf
(
stderr
,
"%d: Failed to convert INTEGER 2 imax
\n
"
,
lineno
);
assert
(
!
"Unreachable"
);
}
else
if
(
outcome
!=
control
)
{
/* Decoded value is wrong */
fprintf
(
stderr
,
"%d: Decode result %"
PRIdMAX
" is not expected %"
PRIdMAX
"
\n
"
,
lineno
,
outcome
,
control
);
assert
(
outcome
==
control
);
}
}
fprintf
(
stderr
,
"%d: Decode result %"
PRIdMAX
"
\n
"
,
lineno
,
control
);
}
}
int
int
main
()
{
main
()
{
check_decode_ok
(
0
,
""
,
1
);
CHECK_DECODE_OK
(
0
,
""
,
1
);
}
}
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