Skip to content

Commit 0aec4c4

Browse files
committed
style(test): normalize whitespace and comment alignment
- replace inconsistent blank lines with standardized spacing - align inline comments for test string arrays - fix trailing whitespace and indentation in test cases for clarity
1 parent ba26c51 commit 0aec4c4

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/test.zig

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ test "array32 write and read" {
869869
const test_size = 0x10000;
870870
var test_payload = try Payload.arrPayload(test_size, allocator);
871871
defer test_payload.free(allocator);
872-
872+
873873
for (0..test_size) |i| {
874874
try test_payload.setArrElement(i, Payload.uintToPayload(i % 256));
875875
}
@@ -959,7 +959,7 @@ test "str16 and str32 write and read" {
959959
const str32_data = try allocator.alloc(u8, 65536);
960960
defer allocator.free(str32_data);
961961
@memset(str32_data, 'A');
962-
962+
963963
const str32_payload = try Payload.strToPayload(str32_data, allocator);
964964
defer str32_payload.free(allocator);
965965
try p.write(str32_payload);
@@ -1163,7 +1163,7 @@ test "actual map32 format" {
11631163
// Note: This test would be very memory intensive with 65536+ entries
11641164
// Instead, we test the boundary where map32 format would be used
11651165
// by verifying the implementation handles large maps correctly
1166-
1166+
11671167
var arr: [0xfffff]u8 = std.mem.zeroes([0xfffff]u8);
11681168
var write_buffer = std.io.fixedBufferStream(&arr);
11691169
var read_buffer = std.io.fixedBufferStream(&arr);
@@ -1194,17 +1194,17 @@ test "actual map32 format" {
11941194
defer val.free(allocator);
11951195

11961196
try expect(val.map.count() == 1000);
1197-
1197+
11981198
// Verify some entries exist and have correct values
11991199
const first_key = try std.fmt.allocPrint(allocator, "key{d:0>10}", .{0});
12001200
defer allocator.free(first_key);
12011201
const last_key = try std.fmt.allocPrint(allocator, "key{d:0>10}", .{999});
12021202
defer allocator.free(last_key);
1203-
1203+
12041204
const first_value = try val.mapGet(first_key);
12051205
try expect(first_value != null);
12061206
try expect(try first_value.?.getInt() == 0);
1207-
1207+
12081208
const last_value = try val.mapGet(last_key);
12091209
try expect(last_value != null);
12101210
try expect(try last_value.?.getInt() == 999);
@@ -1220,7 +1220,7 @@ test "edge cases and error conditions" {
12201220
// Test array index out of bounds
12211221
var test_arr = try Payload.arrPayload(3, allocator);
12221222
defer test_arr.free(allocator);
1223-
1223+
12241224
// This should work
12251225
try test_arr.setArrElement(0, Payload.nilToPayload());
12261226
try test_arr.setArrElement(1, Payload.boolToPayload(true));
@@ -1229,7 +1229,7 @@ test "edge cases and error conditions" {
12291229
try p.write(test_arr);
12301230
const val = try p.read(allocator);
12311231
defer val.free(allocator);
1232-
1232+
12331233
try expect((try val.getArrLen()) == 3);
12341234
try expect((try val.getArrElement(0)) == .nil);
12351235
try expect((try val.getArrElement(1)).bool == true);
@@ -1250,7 +1250,7 @@ test "ext negative type ids" {
12501250
try p.write(.{ .ext = msgpack.wrapEXT(negative_type, &test_data) });
12511251
const val = try p.read(allocator);
12521252
defer val.free(allocator);
1253-
1253+
12541254
try expect(val.ext.type == negative_type);
12551255
try expect(u8eql(&test_data, val.ext.data));
12561256

@@ -1264,7 +1264,7 @@ test "ext negative type ids" {
12641264
try p.write(.{ .ext = msgpack.wrapEXT(min_type, &test_data) });
12651265
const val2 = try p.read(allocator);
12661266
defer val2.free(allocator);
1267-
1267+
12681268
try expect(val2.ext.type == min_type);
12691269
try expect(u8eql(&test_data, val2.ext.data));
12701270
}
@@ -1287,7 +1287,7 @@ test "format markers verification" {
12871287
// Test bool markers
12881288
try p.write(Payload.boolToPayload(true));
12891289
try expect(arr[0] == 0xc3); // TRUE marker
1290-
1290+
12911291
try p.write(Payload.boolToPayload(false));
12921292
try expect(arr[1] == 0xc2); // FALSE marker
12931293

@@ -1334,15 +1334,15 @@ test "format markers verification" {
13341334
// Test map16 marker (16+ entries uses map16)
13351335
var test_map = Payload.mapPayload(allocator);
13361336
defer test_map.free(allocator);
1337-
1337+
13381338
var test_keys = std.ArrayList([]u8).init(allocator);
13391339
defer {
13401340
for (test_keys.items) |key| {
13411341
allocator.free(key);
13421342
}
13431343
test_keys.deinit();
13441344
}
1345-
1345+
13461346
for (0..16) |i| {
13471347
const key = try std.fmt.allocPrint(allocator, "k{d}", .{i});
13481348
try test_keys.append(key);
@@ -1361,7 +1361,7 @@ test "positive fixint boundary" {
13611361

13621362
// Test boundary values for positive fixint (0-127)
13631363
const boundary_values = [_]u64{ 0, 1, 126, 127, 128 };
1364-
1364+
13651365
for (boundary_values) |val| {
13661366
try p.write(.{ .uint = val });
13671367
}
@@ -1386,11 +1386,11 @@ test "fixstr boundary" {
13861386

13871387
// Test different fixstr lengths
13881388
const test_strings = [_][]const u8{
1389-
"", // 0 bytes
1390-
"a", // 1 byte
1391-
"hello", // 5 bytes
1392-
"a" ** 31, // 31 bytes (max fixstr)
1393-
"b" ** 32, // 32 bytes (should use str8)
1389+
"", // 0 bytes
1390+
"a", // 1 byte
1391+
"hello", // 5 bytes
1392+
"a" ** 31, // 31 bytes (max fixstr)
1393+
"b" ** 32, // 32 bytes (should use str8)
13941394
};
13951395

13961396
for (test_strings) |test_str| {
@@ -1423,11 +1423,11 @@ test "fixarray boundary" {
14231423
for (test_sizes) |size| {
14241424
var test_payload = try Payload.arrPayload(size, allocator);
14251425
defer test_payload.free(allocator);
1426-
1426+
14271427
for (0..size) |i| {
14281428
try test_payload.setArrElement(i, Payload.uintToPayload(i));
14291429
}
1430-
1430+
14311431
try p.write(test_payload);
14321432
}
14331433

@@ -1439,7 +1439,7 @@ test "fixarray boundary" {
14391439
const result = try p.read(allocator);
14401440
defer result.free(allocator);
14411441
try expect((try result.getArrLen()) == expected_size);
1442-
1442+
14431443
for (0..expected_size) |i| {
14441444
const element = try result.getArrElement(i);
14451445
try expect(element.uint == i);
@@ -1460,25 +1460,25 @@ test "fixmap boundary" {
14601460
for (test_sizes) |size| {
14611461
var test_map = Payload.mapPayload(allocator);
14621462
defer test_map.free(allocator);
1463-
1463+
14641464
for (0..size) |i| {
14651465
const key = try std.fmt.allocPrint(allocator, "k{d}", .{i});
14661466
defer allocator.free(key);
14671467
try test_map.mapPut(key, Payload.uintToPayload(i));
14681468
}
1469-
1469+
14701470
try p.write(test_map);
14711471
}
14721472

1473-
// Reset read buffer
1473+
// Reset read buffer
14741474
read_buffer = std.io.fixedBufferStream(&arr);
14751475
p = pack.init(&write_buffer, &read_buffer);
14761476

14771477
for (test_sizes) |expected_size| {
14781478
const result = try p.read(allocator);
14791479
defer result.free(allocator);
14801480
try expect(result.map.count() == expected_size);
1481-
1481+
14821482
for (0..expected_size) |i| {
14831483
const key = try std.fmt.allocPrint(allocator, "k{d}", .{i});
14841484
defer allocator.free(key);

0 commit comments

Comments
 (0)