| 1 | package berscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.13 bytes/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 6 | "ioscip-go gomod github.com/golang/go/src go1.13 io/" |
| 7 | "io/ioutilscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/" |
| 8 | "mathscip-go gomod github.com/golang/go/src go1.13 math/" |
| 9 | "testingscip-go gomod github.com/golang/go/src go1.13 testing/" |
| 10 | ) |
| 11 | |
| 12 | var errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF. = ioscip-go gomod github.com/golang/go/src go1.13 io/.ErrUnexpectedEOFscip-go gomod github.com/golang/go/src go1.13 io/ErrUnexpectedEOF..Error() |
| 13 | |
| 14 | // Tests from http://www.strozhevsky.com/free_docs/free_asn1_testsuite_descr.pdf |
| 15 | // Source files and descriptions at http://www.strozhevsky.com/free_docs/TEST_SUITE.zip |
| 16 | var testCasesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases. = []struct { |
| 17 | // File contains the path to the BER-encoded file |
| 18 | Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File. string |
| 19 | // Error indicates whether a decoding error is expected |
| 20 | Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error. string |
| 21 | // AbnormalEncoding indicates whether a normalized re-encoding is expected to differ from the original source |
| 22 | AbnormalEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:AbnormalEncoding. bool |
| 23 | // IndefiniteEncoding indicates the source file used indefinite-length encoding, so the re-encoding is expected to differ (since the length is known) |
| 24 | IndefiniteEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:IndefiniteEncoding. bool |
| 25 | }{ |
| 26 | // Common blocks |
| 27 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc1.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "high-tag-number tag overflow"}, |
| 28 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc2.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 29 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc3.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 30 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc4.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "invalid length byte 0xff"}, |
| 31 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc5.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "", AbnormalEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:AbnormalEncoding.: true}, |
| 32 | // Real numbers (some expected failures are disabled until support is added) |
| 33 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc6.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "REAL value +0 must be encoded with zero-length value block"}, |
| 34 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc7.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "REAL value -0 must be encoded as a special value"}, |
| 35 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc8.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: `encoding of "special value" must not contain exponent and mantissa`}, |
| 36 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc9.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "bits 6 and 5 of information octet for REAL are equal to 11"}, |
| 37 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc10.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 38 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc11.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "incorrect NR form"}, |
| 39 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc12.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: `encoding of "special value" not from ASN.1 standard`}, |
| 40 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc13.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 41 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc14.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 42 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc15.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "too big value of exponent"}, |
| 43 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc16.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "too big value of mantissa"}, |
| 44 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc17.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "too big value of exponent"}, // Error: "Too big values for exponent and mantissa + using of "scaling factor" value" |
| 45 | // Integers |
| 46 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc18.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 47 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc19.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 48 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc20.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 49 | // Object identifiers |
| 50 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc21.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 51 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc22.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 52 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc23.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 53 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc24.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 54 | // Booleans |
| 55 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc25.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 56 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc26.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 57 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc27.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 58 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc28.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 59 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc29.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 60 | // Null |
| 61 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc30.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 62 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc31.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 63 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc32.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 64 | // Bit string (some expected failures are disabled until support is added) |
| 65 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc33.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, // Error: "Too big value for "unused bits"" |
| 66 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc34.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 67 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc35.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "", IndefiniteEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:IndefiniteEncoding.: true}, // Error: "Using of different from BIT STRING types as internal types for constructive encoding" |
| 68 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc36.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "", IndefiniteEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:IndefiniteEncoding.: true}, // Error: "Using of "unused bits" in internal BIT STRINGs with constructive form of encoding" |
| 69 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc37.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 70 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc38.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "", IndefiniteEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:IndefiniteEncoding.: true}, |
| 71 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc39.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 72 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc40.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 73 | // Octet string (some expected failures are disabled until support is added) |
| 74 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc41.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "", IndefiniteEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:IndefiniteEncoding.: true}, // Error: "Using of different from OCTET STRING types as internal types for constructive encoding" |
| 75 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc42.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 76 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc43.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: errEOFscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/errEOF.}, |
| 77 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc44.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 78 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc45.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 79 | // Bit string |
| 80 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc46.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "indefinite length used with primitive type"}, |
| 81 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc47.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "eoc child not allowed with definite length"}, |
| 82 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc48.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: "", IndefiniteEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:IndefiniteEncoding.: true}, // Error: "Using of more than 7 "unused bits" in BIT STRING with constrictive encoding form" |
| 83 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc49.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: ""}, |
| 84 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc50.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: is64bitscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/is64bit().("length cannot be less than -1", "long-form length overflow")}, |
| 85 | {Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File.: "tests/tc51.ber", Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.: is64bitscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/is64bit().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("length 206966894640 greater than maximum %v", MaxPacketLengthBytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/MaxPacketLengthBytes.), "long-form length overflow")}, |
| 86 | } |
| 87 | |
| 88 | func is64bitscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/is64bit().(a, b string) string { |
| 89 | maxInt64 := int64(mathscip-go gomod github.com/golang/go/src go1.13 math/.MaxInt64scip-go gomod github.com/golang/go/src go1.13 math/MaxInt64.) |
| 90 | length := int(maxInt64) |
| 91 | if int64(length) != maxInt64 { |
| 92 | return b |
| 93 | } |
| 94 | return a |
| 95 | } |
| 96 | |
| 97 | func TestSuiteDecodePacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TestSuiteDecodePacket().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 98 | // Debug = true |
| 99 | for _, tc := range testCasesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases. { |
| 100 | file := tc.Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File. |
| 101 | |
| 102 | dataIn, err := ioutilscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/.ReadFilescip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/ReadFile().(file) |
| 103 | if err != nil { |
| 104 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: %v", file, err) |
| 105 | continue |
| 106 | } |
| 107 | |
| 108 | // fmt.Printf("%s: decode %d\n", file, len(dataIn)) |
| 109 | packet, err := DecodePacketErrscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodePacketErr().(dataIn) |
| 110 | if err != nil { |
| 111 | if tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error. == "" { |
| 112 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: unexpected error during DecodePacket: %v", file, err) |
| 113 | } else if tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error. != err.Error() { |
| 114 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: expected error %q during DecodePacket, got %q", file, tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error., err) |
| 115 | } |
| 116 | continue |
| 117 | } |
| 118 | if tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error. != "" { |
| 119 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: expected error %q, got none", file, tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.) |
| 120 | continue |
| 121 | } |
| 122 | |
| 123 | dataOut := packet.Bytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Bytes().() |
| 124 | if tc.AbnormalEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:AbnormalEncoding. || tc.IndefiniteEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:IndefiniteEncoding. { |
| 125 | // Abnormal encodings and encodings that used indefinite length should re-encode differently |
| 126 | if bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Equalscip-go gomod github.com/golang/go/src go1.13 bytes/Equal().(dataOut, dataIn) { |
| 127 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: data should have been re-encoded differently", file) |
| 128 | } |
| 129 | } else if !bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Equalscip-go gomod github.com/golang/go/src go1.13 bytes/Equal().(dataOut, dataIn) { |
| 130 | // Make sure the serialized data matches the source |
| 131 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: data should be the same\nwant: %#v\ngot: %#v", file, dataIn, dataOut) |
| 132 | } |
| 133 | |
| 134 | packet, err = DecodePacketErrscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodePacketErr().(dataOut) |
| 135 | if err != nil { |
| 136 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: unexpected error: %v", file, err) |
| 137 | continue |
| 138 | } |
| 139 | |
| 140 | // Make sure the re-serialized data matches our original serialization |
| 141 | dataOut2 := packet.Bytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Bytes().() |
| 142 | if !bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Equalscip-go gomod github.com/golang/go/src go1.13 bytes/Equal().(dataOut, dataOut2) { |
| 143 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: data should be the same\nwant: %#v\ngot: %#v", file, dataOut, dataOut2) |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | func TestSuiteReadPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TestSuiteReadPacket().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 149 | for _, tc := range testCasesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases. { |
| 150 | file := tc.Filescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:File. |
| 151 | |
| 152 | dataIn, err := ioutilscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/.ReadFilescip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/ReadFile().(file) |
| 153 | if err != nil { |
| 154 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: %v", file, err) |
| 155 | continue |
| 156 | } |
| 157 | |
| 158 | buffer := bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.NewBufferscip-go gomod github.com/golang/go/src go1.13 bytes/NewBuffer().(dataIn) |
| 159 | packet, err := ReadPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ReadPacket().(buffer) |
| 160 | if err != nil { |
| 161 | if tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error. == "" { |
| 162 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: unexpected error during ReadPacket: %v", file, err) |
| 163 | } else if tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error. != err.Error() { |
| 164 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: expected error %q during ReadPacket, got %q", file, tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error., err) |
| 165 | } |
| 166 | continue |
| 167 | } |
| 168 | if tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error. != "" { |
| 169 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: expected error %q, got none", file, tc.Errorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:Error.) |
| 170 | continue |
| 171 | } |
| 172 | |
| 173 | dataOut := packet.Bytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Bytes().() |
| 174 | if tc.AbnormalEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:AbnormalEncoding. || tc.IndefiniteEncodingscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/testCases:IndefiniteEncoding. { |
| 175 | // Abnormal encodings and encodings that used indefinite length should re-encode differently |
| 176 | if bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Equalscip-go gomod github.com/golang/go/src go1.13 bytes/Equal().(dataOut, dataIn) { |
| 177 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: data should have been re-encoded differently", file) |
| 178 | } |
| 179 | } else if !bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Equalscip-go gomod github.com/golang/go/src go1.13 bytes/Equal().(dataOut, dataIn) { |
| 180 | // Make sure the serialized data matches the source |
| 181 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: data should be the same\nwant: %#v\ngot: %#v", file, dataIn, dataOut) |
| 182 | } |
| 183 | |
| 184 | packet, err = DecodePacketErrscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodePacketErr().(dataOut) |
| 185 | if err != nil { |
| 186 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: unexpected error: %v", file, err) |
| 187 | continue |
| 188 | } |
| 189 | |
| 190 | // Make sure the re-serialized data matches our original serialization |
| 191 | dataOut2 := packet.Bytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Bytes().() |
| 192 | if !bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Equalscip-go gomod github.com/golang/go/src go1.13 bytes/Equal().(dataOut, dataOut2) { |
| 193 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("%s: data should be the same\nwant: %#v\ngot: %#v", file, dataOut, dataOut2) |
| 194 | } |
| 195 | } |
| 196 | } |