authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-05-03 17:30:39+02:00
committergravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-05-28 16:28:27+02:00
log5ab3a21e390384672bc58171c9985d2d1d11b46e
tree560ef2f68bcff76b6b0ba9d73ff1b878aac91fff
parentf6deade4e0033031d2161049dc62ab94c27209f4

std.crypto.codecs: include asn1 tests

Make sure the asn1 code compiles and runs.

2 files changed, 15 insertions(+), 0 deletions(-)

lib/std/crypto/codecs.zig+6
......@@ -1,3 +1,9 @@
11pub const asn1 = @import("codecs/asn1.zig");
22pub const base64 = @import("codecs/base64_hex_ct.zig").base64;
33pub const hex = @import("codecs/base64_hex_ct.zig").hex;
4
5test {
6 _ = asn1;
7 _ = base64;
8 _ = hex;
9}
lib/std/crypto/codecs/asn1.zig+9
......@@ -366,6 +366,15 @@ pub const BitString = struct {
366366 }
367367};
368368
369test BitString {
370 const bs = BitString{ .bytes = &.{ 0x6e, 0x5d, 0xc0 }, .right_padding = 6 };
371 const allocator = std.testing.allocator;
372 const buf = try der.encode(allocator, bs);
373 defer allocator.free(buf);
374 try std.testing.expectEqualSlices(u8, &.{ 0x03, 0x04, 0x06, 0x6e, 0x5d, 0xc0 }, buf);
375 try std.testing.expectEqualDeep(bs, try der.decode(BitString, buf));
376}
377
369378pub fn Opaque(comptime tag: Tag) type {
370379 return struct {
371380 bytes: []const u8,