Skip to content

Commit c5fb4f8

Browse files
committed
expectEqual and naming
1 parent d6eb6d2 commit c5fb4f8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/browser/html/performance.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub const Performance = struct {
3333
// else -> Resolution in non-isolated contexts: 100 microseconds
3434
const ms_resolution = 100;
3535

36-
fn limited_resolution_ms(nanoseconds: u64) f64 {
36+
fn limitedResolutionMs(nanoseconds: u64) f64 {
3737
const elapsed_at_resolution = ((nanoseconds / std.time.ns_per_us) + ms_resolution / 2) / ms_resolution * ms_resolution;
3838
const elapsed = @as(f64, @floatFromInt(elapsed_at_resolution));
3939
return elapsed / @as(f64, std.time.us_per_ms);
@@ -46,11 +46,11 @@ pub const Performance = struct {
4646
};
4747
const zero = std.time.Instant{ .timestamp = if (!is_posix) 0 else .{ .sec = 0, .nsec = 0 } };
4848
const started = self.time_origin.started.since(zero);
49-
return limited_resolution_ms(started);
49+
return limitedResolutionMs(started);
5050
}
5151

5252
pub fn _now(self: *Performance) f64 {
53-
return limited_resolution_ms(self.time_origin.read());
53+
return limitedResolutionMs(self.time_origin.read());
5454
}
5555
};
5656

@@ -71,15 +71,15 @@ test "Performance: now" {
7171
// Monotonically increasing
7272
var now = perf._now();
7373
while (now <= 0) { // Loop for now to not be 0
74-
try testing.expect(now == 0);
74+
try testing.expectEqual(now, 0);
7575
now = perf._now();
7676
}
7777
// Check resolution
7878
try testing.expectDelta(@rem(now * std.time.us_per_ms, 100.0), 0.0, 0.1);
7979

8080
var after = perf._now();
8181
while (after <= now) { // Loop untill after > now
82-
try testing.expect(after == now);
82+
try testing.expectEqual(after, now);
8383
after = perf._now();
8484
}
8585
// Check resolution

0 commit comments

Comments
 (0)