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
f65e9377
Commit
f65e9377
authored
Oct 17, 2013
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
additional PER test
parent
9c70e74c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
0 deletions
+106
-0
asn1c/tests/check-133.-gen-PER.c
asn1c/tests/check-133.-gen-PER.c
+83
-0
tests/133-per-constraints-OK.asn1
tests/133-per-constraints-OK.asn1
+23
-0
No files found.
asn1c/tests/check-133.-gen-PER.c
0 → 100644
View file @
f65e9377
#undef NDEBUG
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <T.h>
static
void
verify
(
int
testNo
,
T_t
*
ti
)
{
asn_enc_rval_t
er
;
asn_dec_rval_t
rv
;
unsigned
char
buf
[
8
];
T_t
*
to
=
0
;
er
=
uper_encode_to_buffer
(
&
asn_DEF_T
,
ti
,
buf
,
sizeof
buf
);
fprintf
(
stderr
,
"%d IN: %d => %zd
\n
"
,
testNo
,
ti
->
present
,
er
.
encoded
);
assert
(
er
.
encoded
>=
1
);
assert
(
er
.
encoded
<=
8
*
sizeof
(
buf
));
rv
=
uper_decode
(
0
,
&
asn_DEF_T
,
(
void
*
)
&
to
,
buf
,
sizeof
buf
,
0
,
0
);
assert
(
rv
.
code
==
RC_OK
);
fprintf
(
stderr
,
"%d ENC: %2x%2x
\n
"
,
testNo
,
buf
[
0
],
buf
[
1
]);
fprintf
(
stderr
,
"%d OUT: %d
\n
"
,
testNo
,
ti
->
present
);
assert
(
ti
->
present
==
to
->
present
);
switch
(
ti
->
present
)
{
case
T_PR_NOTHING
:
assert
(
ti
->
present
!=
T_PR_NOTHING
);
break
;
case
T_PR_first
:
assert
(
ti
->
choice
.
first
.
present
==
to
->
choice
.
first
.
present
);
assert
(
ti
->
choice
.
first
.
choice
.
nothing
==
to
->
choice
.
first
.
choice
.
nothing
);
break
;
case
T_PR_second
:
assert
(
ti
->
choice
.
second
==
to
->
choice
.
second
);
break
;
case
T_PR_third
:
assert
(
ti
->
choice
.
third
==
to
->
choice
.
third
);
break
;
}
xer_fprint
(
stderr
,
&
asn_DEF_T
,
ti
);
xer_fprint
(
stderr
,
&
asn_DEF_T
,
to
);
}
int
main
()
{
T_t
t
;
return
0
;
// this test fails, but not important atm.
memset
(
&
t
,
0
,
sizeof
(
t
));
t
.
present
=
T_PR_first
;
t
.
choice
.
first
.
present
=
first_PR_nothing
;
t
.
choice
.
first
.
choice
.
nothing
=
5
;
verify
(
0
,
&
t
);
memset
(
&
t
,
0
,
sizeof
(
t
));
t
.
present
=
T_PR_second
;
t
.
choice
.
second
=
-
5
;
verify
(
1
,
&
t
);
memset
(
&
t
,
0
,
sizeof
(
t
));
t
.
present
=
T_PR_second
;
t
.
choice
.
second
=
10
;
verify
(
2
,
&
t
);
memset
(
&
t
,
0
,
sizeof
(
t
));
t
.
present
=
T_PR_third
;
t
.
choice
.
third
=
-
10
;
verify
(
3
,
&
t
);
memset
(
&
t
,
0
,
sizeof
(
t
));
t
.
present
=
T_PR_third
;
t
.
choice
.
third
=
4097
;
verify
(
4
,
&
t
);
return
0
;
}
tests/133-per-constraints-OK.asn1
0 → 100644
View file @
f65e9377
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .133
ModulePERConstraints
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 133 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
T ::= CHOICE {
first [2] CHOICE {
nothing INTEGER (5..MAX)
},
second [0] INTEGER (MIN..10),
...,
third [1] INTEGER (-10..MAX)
}
END
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