zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit b7e72cc4211d7b06e2b7095f48c579ce1daaf253 (tree)
parent 447dc2bb9011078e80acbe3f51135ff1ad2bf163
Author: Yuri Pieters <magejohnyjtp@gmail.com>
Date:   Thu,  9 Apr 2020 02:00:08 +0100

sort.binarySearch: test for regresson of #4980

Diffstat:
Mlib/std/sort.zig | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/std/sort.zig b/lib/std/sort.zig @@ -48,6 +48,10 @@ test "std.sort.binarySearch" { binarySearch(u32, 1, &[_]u32{0}, S.order_u32), ); testing.expectEqual( + @as(?usize, null), + binarySearch(u32, 0, &[_]u32{1}, S.order_u32), + ); + testing.expectEqual( @as(?usize, 4), binarySearch(u32, 5, &[_]u32{ 1, 2, 3, 4, 5 }, S.order_u32), );