aboutsummaryrefslogtreecommitdiffstats
path: root/BERTLVStreamTest.st
diff options
context:
space:
mode:
Diffstat (limited to 'BERTLVStreamTest.st')
-rw-r--r--BERTLVStreamTest.st22
1 files changed, 22 insertions, 0 deletions
diff --git a/BERTLVStreamTest.st b/BERTLVStreamTest.st
index ef470a2..113672d 100644
--- a/BERTLVStreamTest.st
+++ b/BERTLVStreamTest.st
@@ -112,3 +112,25 @@ TestCase subclass: BERTLVStreamTest [
self assert: value second size = 3.
]
]
+
+TestCase subclass: DERTLVStreamTest [
+ <comment: 'I test DER encoding to some degree'>
+
+ testDecodeEncodeAll [
+ | data decoded stream |
+ "I test that we can encode what we decode. At least to
+ some very very basic degree."
+
+ data := #(16rA1 16r13 16r02 16r01 16r04 16r02 16r01 16r3B
+ 16r30 16r0B 16r04 16r01 16r0F 16r04 16r06 16r2A
+ 16rD5 16r4C 16r16 16r1B 16r01) asByteArray.
+
+ decoded := (DERTLVStream on: data readStream) nextAllRecursive.
+
+ stream := WriteStream on: (ByteArray new: 20).
+ (DERTLVStream on: stream) nextPutAll: decoded.
+
+ self assert: data ~= decoded.
+ self assert: stream contents = data.
+ ]
+]