authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-09 15:44:08-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-09 15:44:08-07:00
logfd85cfe15457bd695b978e327ce8af84c7990c28
treeba1eaa93392066f88b4362cd840373c85daad887
parent83bb3d1ad692127cd51c101b6a01fc853ab72990

std.mem: remove redundant namespaces in test names

related: #7923

1 files changed, 24 insertions(+), 24 deletions(-)

lib/std/mem.zig+24-24
......@@ -163,7 +163,7 @@ fn failAllocatorAlloc(_: *anyopaque, n: usize, alignment: u29, len_align: u29, r
163163 return error.OutOfMemory;
164164}
165165
166test "mem.Allocator basics" {
166test "Allocator basics" {
167167 try testing.expectError(error.OutOfMemory, fail_allocator.alloc(u8, 1));
168168 try testing.expectError(error.OutOfMemory, fail_allocator.allocSentinel(u8, 1, 0));
169169}
......@@ -330,7 +330,7 @@ pub fn zeroes(comptime T: type) T {
330330 }
331331}
332332
333test "mem.zeroes" {
333test "zeroes" {
334334 const C_struct = extern struct {
335335 x: u32,
336336 y: u32,
......@@ -544,7 +544,7 @@ pub fn lessThan(comptime T: type, lhs: []const T, rhs: []const T) bool {
544544 return order(T, lhs, rhs) == .lt;
545545}
546546
547test "mem.lessThan" {
547test "lessThan" {
548548 try testing.expect(lessThan(u8, "abcd", "bee"));
549549 try testing.expect(!lessThan(u8, "abc", "abc"));
550550 try testing.expect(lessThan(u8, "abc", "abc0"));
......@@ -970,7 +970,7 @@ pub fn trim(comptime T: type, slice: []const T, values_to_strip: []const T) []co
970970 return slice[begin..end];
971971}
972972
973test "mem.trim" {
973test "trim" {
974974 try testing.expectEqualSlices(u8, "foo\n ", trimLeft(u8, " foo\n ", " \n"));
975975 try testing.expectEqualSlices(u8, " foo", trimRight(u8, " foo\n ", " \n"));
976976 try testing.expectEqualSlices(u8, "foo", trim(u8, " foo\n ", " \n"));
......@@ -1132,7 +1132,7 @@ pub fn indexOfPos(comptime T: type, haystack: []const T, start_index: usize, nee
11321132 return null;
11331133}
11341134
1135test "mem.indexOf" {
1135test "indexOf" {
11361136 try testing.expect(indexOf(u8, "one two three four five six seven eight nine ten eleven", "three four").? == 8);
11371137 try testing.expect(lastIndexOf(u8, "one two three four five six seven eight nine ten eleven", "three four").? == 8);
11381138 try testing.expect(indexOf(u8, "one two three four five six seven eight nine ten eleven", "two two") == null);
......@@ -1157,7 +1157,7 @@ test "mem.indexOf" {
11571157 try testing.expect(lastIndexOfScalar(u8, "boo", 'o').? == 2);
11581158}
11591159
1160test "mem.indexOf multibyte" {
1160test "indexOf multibyte" {
11611161 {
11621162 // make haystack and needle long enough to trigger boyer-moore-horspool algorithm
11631163 const haystack = [1]u16{0} ** 100 ++ [_]u16{ 0xbbaa, 0xccbb, 0xddcc, 0xeedd, 0xffee, 0x00ff };
......@@ -1185,7 +1185,7 @@ test "mem.indexOf multibyte" {
11851185 }
11861186}
11871187
1188test "mem.indexOfPos empty needle" {
1188test "indexOfPos empty needle" {
11891189 try testing.expectEqual(indexOfPos(u8, "abracadabra", 5, ""), 5);
11901190}
11911191
......@@ -1205,7 +1205,7 @@ pub fn count(comptime T: type, haystack: []const T, needle: []const T) usize {
12051205 return found;
12061206}
12071207
1208test "mem.count" {
1208test "count" {
12091209 try testing.expect(count(u8, "", "h") == 0);
12101210 try testing.expect(count(u8, "h", "h") == 1);
12111211 try testing.expect(count(u8, "hh", "h") == 2);
......@@ -1237,7 +1237,7 @@ pub fn containsAtLeast(comptime T: type, haystack: []const T, expected_count: us
12371237 return false;
12381238}
12391239
1240test "mem.containsAtLeast" {
1240test "containsAtLeast" {
12411241 try testing.expect(containsAtLeast(u8, "aa", 0, "a"));
12421242 try testing.expect(containsAtLeast(u8, "aa", 1, "a"));
12431243 try testing.expect(containsAtLeast(u8, "aa", 2, "a"));
......@@ -1583,7 +1583,7 @@ pub fn tokenize(comptime T: type, buffer: []const T, delimiter_bytes: []const T)
15831583 };
15841584}
15851585
1586test "mem.tokenize" {
1586test "tokenize" {
15871587 var it = tokenize(u8, " abc def ghi ", " ");
15881588 try testing.expect(eql(u8, it.next().?, "abc"));
15891589 try testing.expect(eql(u8, it.next().?, "def"));
......@@ -1625,7 +1625,7 @@ test "mem.tokenize" {
16251625 try testing.expect(it16.next() == null);
16261626}
16271627
1628test "mem.tokenize (multibyte)" {
1628test "tokenize (multibyte)" {
16291629 var it = tokenize(u8, "a|b,c/d e", " /,|");
16301630 try testing.expect(eql(u8, it.next().?, "a"));
16311631 try testing.expect(eql(u8, it.next().?, "b"));
......@@ -1647,7 +1647,7 @@ test "mem.tokenize (multibyte)" {
16471647 try testing.expect(it16.next() == null);
16481648}
16491649
1650test "mem.tokenize (reset)" {
1650test "tokenize (reset)" {
16511651 var it = tokenize(u8, " abc def ghi ", " ");
16521652 try testing.expect(eql(u8, it.next().?, "abc"));
16531653 try testing.expect(eql(u8, it.next().?, "def"));
......@@ -1678,7 +1678,7 @@ pub fn split(comptime T: type, buffer: []const T, delimiter: []const T) SplitIte
16781678 };
16791679}
16801680
1681test "mem.split" {
1681test "split" {
16821682 var it = split(u8, "abc|def||ghi", "|");
16831683 try testing.expect(eql(u8, it.next().?, "abc"));
16841684 try testing.expect(eql(u8, it.next().?, "def"));
......@@ -1708,7 +1708,7 @@ test "mem.split" {
17081708 try testing.expect(it16.next() == null);
17091709}
17101710
1711test "mem.split (multibyte)" {
1711test "split (multibyte)" {
17121712 var it = split(u8, "a, b ,, c, d, e", ", ");
17131713 try testing.expect(eql(u8, it.next().?, "a"));
17141714 try testing.expect(eql(u8, it.next().?, "b ,"));
......@@ -1734,7 +1734,7 @@ pub fn startsWith(comptime T: type, haystack: []const T, needle: []const T) bool
17341734 return if (needle.len > haystack.len) false else eql(T, haystack[0..needle.len], needle);
17351735}
17361736
1737test "mem.startsWith" {
1737test "startsWith" {
17381738 try testing.expect(startsWith(u8, "Bob", "Bo"));
17391739 try testing.expect(!startsWith(u8, "Needle in haystack", "haystack"));
17401740}
......@@ -1743,7 +1743,7 @@ pub fn endsWith(comptime T: type, haystack: []const T, needle: []const T) bool {
17431743 return if (needle.len > haystack.len) false else eql(T, haystack[haystack.len - needle.len ..], needle);
17441744}
17451745
1746test "mem.endsWith" {
1746test "endsWith" {
17471747 try testing.expect(endsWith(u8, "Needle in haystack", "haystack"));
17481748 try testing.expect(!endsWith(u8, "Bob", "Bo"));
17491749}
......@@ -1867,7 +1867,7 @@ fn joinMaybeZ(allocator: Allocator, separator: []const u8, slices: []const []con
18671867 return buf;
18681868}
18691869
1870test "mem.join" {
1870test "join" {
18711871 {
18721872 const str = try join(testing.allocator, ",", &[_][]const u8{});
18731873 defer testing.allocator.free(str);
......@@ -1890,7 +1890,7 @@ test "mem.join" {
18901890 }
18911891}
18921892
1893test "mem.joinZ" {
1893test "joinZ" {
18941894 {
18951895 const str = try joinZ(testing.allocator, ",", &[_][]const u8{});
18961896 defer testing.allocator.free(str);
......@@ -2168,7 +2168,7 @@ pub fn min(comptime T: type, slice: []const T) T {
21682168 return best;
21692169}
21702170
2171test "mem.min" {
2171test "min" {
21722172 try testing.expectEqual(min(u8, "abcdefg"), 'a');
21732173 try testing.expectEqual(min(u8, "bcdefga"), 'a');
21742174 try testing.expectEqual(min(u8, "a"), 'a');
......@@ -2185,7 +2185,7 @@ pub fn max(comptime T: type, slice: []const T) T {
21852185 return best;
21862186}
21872187
2188test "mem.max" {
2188test "max" {
21892189 try testing.expectEqual(max(u8, "abcdefg"), 'g');
21902190 try testing.expectEqual(max(u8, "gabcdef"), 'g');
21912191 try testing.expectEqual(max(u8, "g"), 'g');
......@@ -2205,7 +2205,7 @@ pub fn minMax(comptime T: type, slice: []const T) struct { min: T, max: T } {
22052205 return .{ .min = minVal, .max = maxVal };
22062206}
22072207
2208test "mem.minMax" {
2208test "minMax" {
22092209 try testing.expectEqual(minMax(u8, "abcdefg"), .{ .min = 'a', .max = 'g' });
22102210 try testing.expectEqual(minMax(u8, "bcdefga"), .{ .min = 'a', .max = 'g' });
22112211 try testing.expectEqual(minMax(u8, "a"), .{ .min = 'a', .max = 'a' });
......@@ -2226,7 +2226,7 @@ pub fn indexOfMin(comptime T: type, slice: []const T) usize {
22262226 return index;
22272227}
22282228
2229test "mem.indexOfMin" {
2229test "indexOfMin" {
22302230 try testing.expectEqual(indexOfMin(u8, "abcdefg"), 0);
22312231 try testing.expectEqual(indexOfMin(u8, "bcdefga"), 6);
22322232 try testing.expectEqual(indexOfMin(u8, "a"), 0);
......@@ -2247,7 +2247,7 @@ pub fn indexOfMax(comptime T: type, slice: []const T) usize {
22472247 return index;
22482248}
22492249
2250test "mem.indexOfMax" {
2250test "indexOfMax" {
22512251 try testing.expectEqual(indexOfMax(u8, "abcdefg"), 6);
22522252 try testing.expectEqual(indexOfMax(u8, "gabcdef"), 0);
22532253 try testing.expectEqual(indexOfMax(u8, "a"), 0);
......@@ -2275,7 +2275,7 @@ pub fn indexOfMinMax(comptime T: type, slice: []const T) struct { index_min: usi
22752275 return .{ .index_min = minIdx, .index_max = maxIdx };
22762276}
22772277
2278test "mem.indexOfMinMax" {
2278test "indexOfMinMax" {
22792279 try testing.expectEqual(indexOfMinMax(u8, "abcdefg"), .{ .index_min = 0, .index_max = 6 });
22802280 try testing.expectEqual(indexOfMinMax(u8, "gabcdef"), .{ .index_min = 1, .index_max = 0 });
22812281 try testing.expectEqual(indexOfMinMax(u8, "a"), .{ .index_min = 0, .index_max = 0 });