aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
AgeCommit message (Collapse)Author
2013-09-27Teach the ASN.1 compiler the no_ok_wrapper optionBjörn Gustavsson
Add the no_ok_wrapper option so that the generated M:encode/2 and M:decode/2 functions will not wrap a successful return value in an {ok,...} tuple. Errors will cause exceptions. Eliminating the wrapping tuple allows simpler nesting of calls.
2013-09-18No longer compile the X420 specs for plain BERBjörn Gustavsson
We used to compile the X420 specs for both DER and PER, but 9ec0a0ba changed that to compile for DER and plain BER (probably accidentally). Since the X420 suite contains 99 source files and compilations takes more than 40 seconds on my computer for one backend, we only want to do compilations that are likely to find bugs. Compiling with the BER backend after having compiled for the DER backend is very unlikely to detect any bugs. Compiling for PER (as well as DER) is slightly more likely to expose bugs, but I don't think it is worth the extra running time for the test suite.
2013-09-18Combine the testSeqIndefinite/1 and testSetIndefinite/1 test casesBjörn Gustavsson
They use the same ASN.1 spec.
2013-09-18Remove asn1_wrapperBjörn Gustavsson
2013-09-18Eliminate the use of asn1_wrapperBjörn Gustavsson
The asn1_wrapper made some sense when encode functions could either produce a list or a binary, depending on the backend. Now encode functions always produce a binary. To improve readbility of the test suites, eliminate the asn1_wrapper functions by replacing them with calls to one of the roundtrip functions in asn1_test_lib. When it is not possible to use the roundtrip functions, call the module in question directly. While at it, also remove ?line macros that are near to the touched code and use asn1_test_lib:hex_to_bin/1 instead of home-brewn hex conversion routines.
2013-09-18Simplify tests of CHOICE with OPTIONALBjörn Gustavsson
Test ChoOptional and ChoOptionalImplicitTag with the same test code and data.
2013-09-18asn1_test_lib: Add roundtrip functions and use them everywhereBjörn Gustavsson
Even if the roundtrip functions are very simply, putting them here makes it possible to change its behavior in one place (e.g. if we are to change encode and decode not to wrap the result in a ok tuple in some future release).
2013-09-18Makefile: Release Emakefile to ensure warnings are treated as errorsBjörn Gustavsson
The generated Emakefile was not copied when releasing the test suites, which meant that the suites were compiled with default options (without the 'warnings_as_errors' option in the generated Emakefile). While at it, eliminate left-over dependecies.
2013-09-18Don't allow unused exported functions in test case helpersBjörn Gustavsson
To keep the test case clean, add an xref test case to ensure that there are no unused functions in the any of the test case helper modules. Eliminate 4 functions that were exported just so that timer:tc/3 could be used (use timer:tc/1 with a fun instead).
2013-09-18Move out specific tests from asn1_test_libBjörn Gustavsson
asn1_test_lib is supposed to be a general-purpose helper module for test cases. Move all specific test cases into asn1_SUITE.
2013-09-18testMegaco: Remove unused exported function msg11/0Björn Gustavsson
Also remove records, defines, and request/4 that were only used by msg11/0.
2013-09-18ASN.1 tests: Don't export functions that are only locally calledBjörn Gustavsson
2013-09-18Remove unused pem_performance.erl fileBjörn Gustavsson
The module tests the performance of the OTP-PUB-KEY module in the public_key application, so it is off-topic and should not be reinstated.
2013-09-18asn1_SUITE: Reinstate test of sub-constraintBjörn Gustavsson
A test of sub-constraints for PER/UPER was lost in commit 9ec0a0babace.
2013-09-18ASN.1 tests: Remove unused choice_extension.erlBjörn Gustavsson
The testChoExtension module tests the same thing (and more) as choice_extension.erl.
2013-09-18Remove unused compile() functionsBjörn Gustavsson
2013-09-18asn1_test_lib: Remove unnecessary loading of a compiled ASN.1 specBjörn Gustavsson
asn1ct:compile/2 calls c:c/2 to invoke the compiler and to load the compiled code. That means that there is no need load the module after having invoked the ASN.1 compiler. To make sure that we'll notice if that behavior changes in the future, extend the rtUI/1 test case to verify that the loaded module has the correct encoding rule (if asn1ct:compile/2 would fail to reload the module, the previous encoding rule would be returned). While at it, it also makes sense to test calling M:bit_string_format/0 to ensure that it continues working.
2013-09-18Slightly clean up testX420Björn Gustavsson
2013-09-18asn1_SUITE: Combine most tests that use External.asn1Björn Gustavsson
By combining most tests that use External.asn, we will only need to compile that spec once instead of 11 times. While combining the test cases, make sure to remove the redundant code in testPrimExternal/1 that tests primitive strings in exactly the same way as testPrimString/1. Removing the redundant code shaves off a few seconds of testing time. Keep testSeqExtension/1 as a separate test case, since it is a complicated test case that does hairy stuff to the source files.
2013-09-18asn1_SUITE: Remove useless test case testInvokeMod/1Björn Gustavsson
It seems that the original purpose is to test encoding by directly calling the module (as opposed to calling indirectly using asn1rt). That is tested in many other test cases (such as testPrimStrings); thus this test case no longer serves any useful purpose.
2013-09-18asn_SUITE: Fold per_GeneralString/1 into h323testBjörn Gustavsson
The per_GeneralString/1 test case compiles MULTIMEDIA-SYSTEM-CONTROL and then does a single decoding. Save some compilation time by folding the test into the h323test/1 test case.
2013-09-18asn1_SUITE: Remove unused function case_dir/2Björn Gustavsson
2013-09-18asn1_SUITE: Remove useless test_driver_load/1 test caseBjörn Gustavsson
The PER back-end no longer use a driver (or even a NIF), and the test case would not fail if it didn't work because the spawned processed were not linked.
2013-09-03PER, UPER: Fix encoding/decoding of open types greater than 16KBjörn Gustavsson
2013-08-30PER, UPER: Optimize encoding using an intermediate formatBjörn Gustavsson
There are some minor incompatibilities for BIT STRING: {bit,Position} is now only only supported for a named BIT STRING type. Values longer than the maximum size for the BIT STRING type would be truncated silently - they now cause an exception.
2013-08-30Clean up checking of objectsBjörn Gustavsson
2013-08-30Improve tests of deep table constraintsBjörn Gustavsson
2013-08-30BER: Handle multiple optional SEQUENCE fields with table constraintsBjörn Gustavsson
2013-08-30Test OPTIONAL and DEFAULT for open typesBjörn Gustavsson
2013-08-30PER/UPER: Fix encoding of an object set with multiple inlined constructsBjörn Gustavsson
Also extend the test suite with more tests of inlined constructs in object sets.
2013-08-30Extend the test for parameterized information objectsBjörn Gustavsson
2013-08-30asn1_SUITE: Remove off-topic (and slow) smp/1 test caseBjörn Gustavsson
The smp1/1 test case seems test how well the SMP emulator can parallelize tasks, not any functionality in the asn1 application that is not tested in other tests.
2013-08-30SeqOf: Add more tricky SEQUENCE OF testsBjörn Gustavsson
2013-06-12Update copyright yearsBjörn-Egil Dahlberg
2013-06-10Merge branch 'bjorn/asn1/not-small-bugs/OTP-11153' into maintBjörn Gustavsson
* bjorn/asn1/not-small-bugs/OTP-11153: PER/UPER: Correct decoding of SEQUENCEs with more than 64 extensions testConstraints: Improve tests of semi-constrained INTEGERs Test ENUMERATED with many extended values UPER: Correct encoding of ENUMERATED with more than 63 extended values Add asn1_test_lib:hex_to_bin/1
2013-06-08PER/UPER: Correct decoding of SEQUENCEs with more than 64 extensionsBjörn Gustavsson
2013-06-08testConstraints: Improve tests of semi-constrained INTEGERsBjörn Gustavsson
Make sure that semi-constrained integers are correctly encoded in the mininum number of bytes. (The roundtrip test does not catch problems with non-minimal encodings.) Also test huge values that must be encoded in 128 or 256 bytes.
2013-06-08Test ENUMERATED with many extended valuesBjörn Gustavsson
2013-06-07PER, UPER: Fix record name mismatch between HRL file and decoding codeBjörn Gustavsson
When a SEQUENCE was defined inline inside extension addition group like this: InlinedSeq ::= SEQUENCE { ..., [[ s SEQUENCE { a INTEGER, b BOOLEAN } ]] } the decoding code would return the contents of the SEQUENCE in a record named 'InlinedSeq_ExtAddGroup1_s', while the record definition in the generated HRL file would be 'InlinedSeq_s'. Since there is no reason to use the longer record name (no risk for ambiguity), correct the name in the decoding code.
2013-06-07Add asn1_test_lib:hex_to_bin/1Björn Gustavsson
2013-06-03testSeqOf: Test constrained, extensible sizesBjörn Gustavsson
2013-05-31Clean up testSeqOfBjörn Gustavsson
2013-05-31Extend tests cases for BIT STRINGBjörn Gustavsson
2013-05-31Improve tests of ENUMERATEDBjörn Gustavsson
2013-05-31asn1ct_check: Don't pass on #'ObjectClassFieldType'{} with fixed typeBjörn Gustavsson
Simplify the backends by letting asn1ct_check replacing a with the actual type.
2013-05-31Fix encoding of semi-constrained, extensible INTEGERsBjörn Gustavsson
Given: Semi ::= INTEGER (Lb..MAX, ...) where Lb is an arbitrary integer, attempting to encode an integer less than Lb would cause the encoder to enter an infinite loop.
2013-05-31PER/UPER: Fix decoding of semi-constrained INTEGERsBjörn Gustavsson
A semi-constrained INTEGER with a non-zero lower bound would be incorrectly decoded. This bug was introduced in R16.
2013-05-31testPrim: Simplify test cases using a roundtrip functionBjörn Gustavsson
While at it, also test more integer values.
2013-05-31BER: Fix handling of a constructed default value for a classBjörn Gustavsson
2013-05-31PER: Generate code for deep table constraints at compile-timeBjörn Gustavsson
For the PER backends, generate code for accessing deep table constraints at compile-time in the same way as is done for BER. While at it, remove the complicated indentation code. Also modernize the test suite and add a test for a deeper nested constraint.