Add NULL support to Client DER library
This commit is contained in:
@@ -180,6 +180,10 @@ void main(string[] args) {
|
||||
test_encode(choice, expected);
|
||||
});
|
||||
|
||||
Test.add_func("/encode/null", () => {
|
||||
test_encode(new Der.Null(), { 0x05, 0x00 });
|
||||
});
|
||||
|
||||
/*
|
||||
* Decoding
|
||||
*/
|
||||
@@ -289,5 +293,23 @@ void main(string[] args) {
|
||||
test_utf8string_value("foo", choice.value);
|
||||
});
|
||||
|
||||
Test.add_func("/decode/null", () => {
|
||||
var bytes = new uint8[] { 0x05, 0x00 };
|
||||
Der.Null @null;
|
||||
try {
|
||||
@null = decode(bytes) as Der.Null;
|
||||
} catch (DecodeError err) {
|
||||
Test.message("Decoding failed: %s", err.message);
|
||||
Test.fail();
|
||||
return;
|
||||
}
|
||||
if (@null == null) {
|
||||
Test.message("Bytes were not decoded as a NULL");
|
||||
Test.fail();
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Test.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user