tests: Test default values
This commit is contained in:
parent
954e09af64
commit
7f47321066
1 changed files with 36 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue