2025-03-31 00:02:39 +02:00
|
|
|
const std = @import("std");
|
|
|
|
|
|
|
|
|
|
pub const binary = @import("binary.zig");
|
|
|
|
|
pub const string = @import("string.zig");
|
|
|
|
|
pub const int = @import("int.zig");
|
2025-03-31 02:22:53 +02:00
|
|
|
pub const uint = @import("uint.zig");
|
2025-03-31 00:02:39 +02:00
|
|
|
|
|
|
|
|
pub const msgpack = @import("msgpack");
|
|
|
|
|
|
|
|
|
|
const deserialise = msgpack.deserialise.deserialise;
|
|
|
|
|
|
|
|
|
|
test {
|
|
|
|
|
@import("std").testing.refAllDecls(@This());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test "nil" {
|
|
|
|
|
const alloc = std.testing.allocator;
|
|
|
|
|
|
|
|
|
|
const obj = try deserialise(alloc, &[_]u8{0xc0});
|
|
|
|
|
defer obj.deinit(alloc);
|
|
|
|
|
|
|
|
|
|
try std.testing.expectEqualDeep(msgpack.Object.nil, obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test "bool" {
|
|
|
|
|
const alloc = std.testing.allocator;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
const obj = try deserialise(alloc, &[_]u8{0xc2});
|
|
|
|
|
defer obj.deinit(alloc);
|
|
|
|
|
|
|
|
|
|
try std.testing.expectEqualDeep(msgpack.Object{ .bool = false }, obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
const obj = try deserialise(alloc, &[_]u8{0xc3});
|
|
|
|
|
defer obj.deinit(alloc);
|
|
|
|
|
|
|
|
|
|
try std.testing.expectEqualDeep(msgpack.Object{ .bool = true }, obj);
|
|
|
|
|
}
|
|
|
|
|
}
|