tests: Test default values

This commit is contained in:
Kalle Carlbark 2024-05-15 22:33:07 +02:00
parent 954e09af64
commit 7f47321066
No known key found for this signature in database

View file

@ -118,3 +118,39 @@ const Zpinner = struct {
}
}
};
test "empty options struct contains default delay value" {
const expectedValue = std.time.ns_per_s * 0.1;
const defaultOptions = Options{};
try std.testing.expectEqual(@as(u64, defaultOptions.delay), @as(u64, expectedValue));
}
test "empty options struct contains default snake charset" {
const expectedValue = chars.Snake;
const opts = Options{};
try std.testing.expectEqual(opts.chars, expectedValue);
}
test "empty options struct contains default empty prefix" {
const expectedValue = "";
const opts = Options{};
try std.testing.expectEqual(opts.prefix, expectedValue);
}
test "empty options struct contains default empty suffix" {
const expectedValue = "";
const opts = Options{};
try std.testing.expectEqual(opts.suffix, expectedValue);
}
test "empty options struct contains default style default" {
const expectedValue = Style{ .foreground = Color.Default, .background = Color.Default };
const opts = Options{};
try std.testing.expectEqual(opts.style, expectedValue);
}