aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/asn1_SUITE_data/Constraints.py
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-09-22 14:21:55 +0200
committerBjörn Gustavsson <[email protected]>2015-01-12 11:40:24 +0100
commitb92e491aa5bfbaefb0f938bbb245a580837cb8c8 (patch)
tree23d176c1983dd35a25d398b7ab29ef62afc82788 /lib/asn1/test/asn1_SUITE_data/Constraints.py
parentd73a835b66911935024019fd55089a1e0f7a81d2 (diff)
downloadotp-b92e491aa5bfbaefb0f938bbb245a580837cb8c8.tar.gz
otp-b92e491aa5bfbaefb0f938bbb245a580837cb8c8.tar.bz2
otp-b92e491aa5bfbaefb0f938bbb245a580837cb8c8.zip
Refactor code involving calls to get_fieldname_element/3
Refactor and clean up code. While at it, add error handling and test cases. (Also add test cases for the existing values in ValueTest.asn while we are it.) Add support for defining INTEGER constants by extracting fields from objects. Example: int-from-object INTEGER ::= object.&id When extracting values from objects in constraints, only one level of extraction would work. That is, the following would work: SomeName ::= INTEGER (object.&int) but not: SomeName ::= INTEGER (object.&obj.&int)
Diffstat (limited to 'lib/asn1/test/asn1_SUITE_data/Constraints.py')
-rw-r--r--lib/asn1/test/asn1_SUITE_data/Constraints.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/Constraints.py b/lib/asn1/test/asn1_SUITE_data/Constraints.py
index 3495cd841b..bee619348a 100644
--- a/lib/asn1/test/asn1_SUITE_data/Constraints.py
+++ b/lib/asn1/test/asn1_SUITE_data/Constraints.py
@@ -144,5 +144,21 @@ NonOverlapping ::= INTEGER (7280..7560 |
23000..24000 |
24960..26900)
+--
+-- Test INTEGER constraints from fields in objects.
+--
+
+INT-HOLDER ::= CLASS {
+ &id INTEGER UNIQUE,
+ &obj INT-HOLDER OPTIONAL
+} WITH SYNTAX {
+ ID &id
+ [OBJ &obj]
+}
+
+int-holder-1 INT-HOLDER ::= { ID 2 }
+int-holder-2 INT-HOLDER ::= { ID 4 OBJ int-holder-1 }
+
+IntObjectConstr ::= INTEGER (int-holder-2.&obj.&id..int-holder-2.&id)
END