/usr/include/snacc/asn1/err-test.asn1 is in snacc 1.3.1-7build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | -- .../asn1specs/err_test.asn1
--
-- This module exercises snacc's semantic error checking of ASN.1 types.
-- Every line that has the "error" comment should cause snacc to produce
-- at least one error message
--
-- Mike Sample 92/07
--
-- $Header: /usr/app/odstb/CVS/snacc/asn1specs/err-test.asn1,v 1.3 1995/07/25 19:53:16 rj Exp $
-- $Log: err-test.asn1,v $
-- Revision 1.3 1995/07/25 19:53:16 rj
-- changed `_' to `-' in file names.
--
-- Revision 1.2 1994/08/28 09:54:17 rj
-- comment leader fixed.
--
-- Revision 1.1 1994/08/28 09:51:13 rj
-- first check-in.
ERROR-TEST DEFINITIONS ::=
BEGIN
-- first check that CHOICEs and SETs without distinct tags
-- cause error msgs
AChoice ::= CHOICE -- error
{
f1 [0] INTEGER, -- these two have the same
f2 [0] INTEGER, -- tags
f3 INTEGER, -- the tag of f3
f4 AChoice3 -- conflicts with one of AChoice3's elmt tags
}
ASet ::= SET -- error
{
f1 [0] INTEGER, -- same [0] tags
f2 [0] INTEGER
}
T1 ::= INTEGER
T2 ::= BOOLEAN
AChoice2 ::= CHOICE -- error
{
T1,
INTEGER
}
ASet2 ::= SET -- error
{
T2,
BOOLEAN
}
AChoice3 ::= CHOICE
{
T1,
T2
}
--
-- now check that Sequence have distinct tags
-- on one or consective optional elmts and following (if any)
-- non-optional elmt
--
ASequence ::= SEQUENCE -- no errors
{
f1 [0] INTEGER,
f2 [0] BOOLEAN
}
ASequence1 ::= SEQUENCE
{
INTEGER OPTIONAL,
INTEGER OPTIONAL, -- error, ambiguous values possible
INTEGER, -- error
INTEGER
}
ASequence3 ::= SEQUENCE
{
f1 [0] OBJECT IDENTIFIER OPTIONAL,
f2 [1] INTEGER OPTIONAL,
f3 [0] BOOLEAN, -- error
f4 [2] OCTET STRING OPTIONAL,
f5 [2] BIT STRING OPTIONAL, -- error
f6 [3] ASequence OPTIONAL,
f7 [3] INTEGER, -- error
f8 [4] BOOLEAN OPTIONAL,
f9 [4] INTEGER OPTIONAL -- error
}
--
-- now check that duplicate APPLICATION tag errors are reported
--
Foo1 ::= [APPLICATION 0] INTEGER
Foo2 ::= [APPLICATION 1] INTEGER
Bar1 ::= [APPLICATION 0] IMPLICIT INTEGER -- error
Bar2 ::= [APPLICATION 1] IMPLICIT INTEGER -- error
--
-- check that field name errors are reported
--
AChoice4 ::= CHOICE
{
f1 INTEGER,
f2 BOOLEAN,
[0] AChoice4
}
ASet3 ::= SET
{
f1 [0] INTEGER,
f2 [1] INTEGER,
f3 [2] BOOLEAN,
f3 [3] BOOLEAN, -- error, field name conflict
[4] AChoice4 -- error, field name conflict too
}
--
-- now check some recursive type related errors
--
A2 ::= A2 -- error
A1 ::= B1 -- error
B1 ::= A1 -- error
C1 ::= D1 -- error
D1 ::= E1 -- error
E1 ::= F1 -- error
F1 ::= C1 -- error
RecSeq ::= SEQUENCE
{
INTEGER,
BOOLEAN,
RecSeq, -- warning, infinitely large values?
RecSeq OPTIONAL -- this should be ok 'cause it's optional
}
--
-- now check some named bit and named number related errors
--
aVal INTEGER ::= -4
Enum1 ::= ENUMERATED { zero(0), one(1), two(2), one(0) } -- 2 errors
Int1 ::= INTEGER { zero(0), one(1), two(2), yoyo(2), one(7), foo(aVal) } -- 2 errors
Bits1 ::= BIT STRING { zero(0), one(1), two(2), one(4), foo(-2), pogo(0),
gogo(aVal) } -- 4 errors
--
-- now check that implicitly tagged CHOICE, ANY and ANY DEFINED BY
-- cause error msgs
--
BChoice1 ::= [APPLICATION 5] IMPLICIT CHOICE -- error
{
INTEGER,
BOOLEAN
}
BChoice2 ::= CHOICE -- no error
{
INTEGER,
BOOLEAN
}
BChoice3 ::= [APPLICATION 6] CHOICE -- no error
{
INTEGER,
BOOLEAN
}
BSeq ::= SEQUENCE
{
INTEGER,
BOOLEAN,
[0] IMPLICIT BChoice2, -- error
[1] IMPLICIT BChoice3, -- no error
[2] IMPLICIT CHOICE {INTEGER, BOOLEAN} -- error
}
--
-- now test that errors are reported for multiply defined
-- types and valus
--
TypeCopy1 ::= INTEGER
TypeCopy1 ::= BOOLEAN
TypeCopy1 ::= INTEGER
valCopy1 INTEGER ::= 1
valCopy1 BOOLEAN ::= TRUE
valCopy1 INTEGER ::= 1
--
-- test some OBJECT IDENTIFER value errors
--
oid1 OBJECT IDENTIFIER ::= { oid1 ms(1) 1 } -- error: recursive value
oid2 OBJECT IDENTIFIER ::= { oid1 ms(1) 2 }
-- error: can only ref other oid values from first arc
oid3 OBJECT IDENTIFIER ::= { ms(1) oid2 2 }
boolVal BOOLEAN ::= TRUE
intVal1 INTEGER ::= 1
intVal2 INTEGER ::= -1
oid4 OBJECT IDENTIFIER ::= { oid2 intVal1 intVal2 boolVal 1}
oid5 OBJECT IDENTIFIER ::= { 1 2 -4}
oid6 OBJECT IDENTIFIER ::= { oid7 1}
oid7 OBJECT IDENTIFIER ::= { oid6 1 }
END
|