Remove some superfluous empty // comments

This commit is contained in:
Nigel Tao committed 2020-03-18 21:58:19 +11:00
1 parent 4b186b0b6b
commit c5c10e95b7
11 files changed
+327 -337

No files matched your search

+12
View File
@@ -4,3 +4,15 @@ Within this repository:
- `C` code is formatted by `clang-format-5.0 -style=Chromium`.
- `Go` code is formatted by `gofmt`.
- `Wuffs` code is formatted by [`wuffsfmt`](/cmd/wuffsfmt).
Some C code has empty `//` line-comments, which look superfluous at first, but
force clang-format to break the line. This ensures one element per line (in a
long list) or having a function's name (not just its type) start a line. For
example, `grep ^wuffs_base__utf_8_ release/c/wuffs-unsupported-snapshot.c` (and
note the `^`) gives you a rough overview of Wuffs' UTF-8 related functions,
because of the forced line breaks:
```
size_t //
wuffs_base__utf_8__encode(wuffs_base__slice_u8 dst, uint32_t code_point);
```
+9 -11
View File
@@ -70,11 +70,11 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// ---------------- Golden Tests
golden_test adler32_midsummer_gt = {
.src_filename = "test/data/midsummer.txt", //
.src_filename = "test/data/midsummer.txt",
};
golden_test adler32_pi_gt = {
.src_filename = "test/data/pi.txt", //
.src_filename = "test/data/pi.txt",
};
// ---------------- Adler32 Tests
@@ -299,26 +299,24 @@ bench_mimic_adler32_100k() {
// Note that the adler32 mimic tests and benches don't work with
// WUFFS_MIMICLIB_USE_MINIZ_INSTEAD_OF_ZLIB.
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
test_wuffs_adler32_golden, //
test_wuffs_adler32_interface, //
test_wuffs_adler32_pi, //
test_wuffs_adler32_golden,
test_wuffs_adler32_interface,
test_wuffs_adler32_pi,
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
bench_wuffs_adler32_10k, //
bench_wuffs_adler32_100k, //
bench_wuffs_adler32_10k,
bench_wuffs_adler32_100k,
#ifdef WUFFS_MIMIC
bench_mimic_adler32_10k, //
bench_mimic_adler32_100k, //
bench_mimic_adler32_10k,
bench_mimic_adler32_100k,
#endif // WUFFS_MIMIC
+5 -7
View File
@@ -69,7 +69,7 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// ---------------- BMP Tests
const char* //
const char* //
test_wuffs_bmp_decode_interface() {
CHECK_FOCUS(__func__);
wuffs_bmp__decoder dec;
@@ -82,7 +82,7 @@ test_wuffs_bmp_decode_interface() {
"test/data/hippopotamus.bmp", 0, SIZE_MAX, 36, 28, 0xFFF5F5F5);
}
const char* //
const char* //
test_wuffs_bmp_decode_frame_config() {
CHECK_FOCUS(__func__);
wuffs_bmp__decoder dec;
@@ -134,11 +134,10 @@ test_wuffs_bmp_decode_frame_config() {
// ---------------- Manifest
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
test_wuffs_bmp_decode_frame_config, //
test_wuffs_bmp_decode_interface, //
test_wuffs_bmp_decode_frame_config,
test_wuffs_bmp_decode_interface,
#ifdef WUFFS_MIMIC
@@ -149,7 +148,6 @@ proc tests[] = {
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
// No BMP benches.
@@ -163,7 +161,7 @@ proc benches[] = {
NULL,
};
int //
int //
main(int argc, char** argv) {
proc_package_name = "std/bmp";
return test_main(argc, argv, tests, benches);
+10 -12
View File
@@ -70,11 +70,11 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// ---------------- Golden Tests
golden_test crc32_midsummer_gt = {
.src_filename = "test/data/midsummer.txt", //
.src_filename = "test/data/midsummer.txt",
};
golden_test crc32_pi_gt = {
.src_filename = "test/data/pi.txt", //
.src_filename = "test/data/pi.txt",
};
// ---------------- CRC32 Tests
@@ -335,32 +335,30 @@ bench_mimic_crc32_ieee_100k() {
// Note that the crc32 mimic tests and benches don't work with
// WUFFS_MIMICLIB_USE_MINIZ_INSTEAD_OF_ZLIB.
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
test_wuffs_crc32_ieee_golden, //
test_wuffs_crc32_ieee_interface, //
test_wuffs_crc32_ieee_pi, //
test_wuffs_crc32_ieee_golden,
test_wuffs_crc32_ieee_interface,
test_wuffs_crc32_ieee_pi,
#ifdef WUFFS_MIMIC
test_mimic_crc32_ieee_pi, //
test_mimic_crc32_ieee_pi,
#endif // WUFFS_MIMIC
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
bench_wuffs_crc32_ieee_10k, //
bench_wuffs_crc32_ieee_100k, //
bench_wuffs_crc32_ieee_10k,
bench_wuffs_crc32_ieee_100k,
#ifdef WUFFS_MIMIC
bench_mimic_crc32_ieee_10k, //
bench_mimic_crc32_ieee_100k, //
bench_mimic_crc32_ieee_10k,
bench_mimic_crc32_ieee_100k,
#endif // WUFFS_MIMIC
+57 -61
View File
@@ -72,14 +72,12 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// The src_offset0 and src_offset1 magic numbers come from:
//
// go run script/extract-flate-offsets.go test/data/*.gz
//
// The empty comments forces clang-format to place one element per line.
golden_test deflate_256_bytes_gt = {
.want_filename = "test/data/artificial/256.bytes", //
.src_filename = "test/data/artificial/256.bytes.gz", //
.src_offset0 = 20, //
.src_offset1 = 281, //
.want_filename = "test/data/artificial/256.bytes",
.src_filename = "test/data/artificial/256.bytes.gz",
.src_offset0 = 20,
.src_offset1 = 281,
};
golden_test deflate_deflate_backref_crosses_blocks_gt = {
@@ -128,29 +126,29 @@ golden_test deflate_deflate_huffman_primlen_9_gt = {
};
golden_test deflate_midsummer_gt = {
.want_filename = "test/data/midsummer.txt", //
.src_filename = "test/data/midsummer.txt.gz", //
.src_offset0 = 24, //
.src_offset1 = 5166, //
.want_filename = "test/data/midsummer.txt",
.src_filename = "test/data/midsummer.txt.gz",
.src_offset0 = 24,
.src_offset1 = 5166,
};
golden_test deflate_pi_gt = {
.want_filename = "test/data/pi.txt", //
.src_filename = "test/data/pi.txt.gz", //
.src_offset0 = 17, //
.src_offset1 = 48335, //
.want_filename = "test/data/pi.txt",
.src_filename = "test/data/pi.txt.gz",
.src_offset0 = 17,
.src_offset1 = 48335,
};
golden_test deflate_romeo_gt = {
.want_filename = "test/data/romeo.txt", //
.src_filename = "test/data/romeo.txt.gz", //
.src_offset0 = 20, //
.src_offset1 = 550, //
.want_filename = "test/data/romeo.txt",
.src_filename = "test/data/romeo.txt.gz",
.src_offset0 = 20,
.src_offset1 = 550,
};
golden_test deflate_romeo_fixed_gt = {
.want_filename = "test/data/romeo.txt", //
.src_filename = "test/data/romeo.txt.fixed-huff.deflate", //
.want_filename = "test/data/romeo.txt",
.src_filename = "test/data/romeo.txt.fixed-huff.deflate",
};
// ---------------- Deflate Tests
@@ -895,63 +893,61 @@ bench_mimic_deflate_decode_100k_many_big_reads() {
// ---------------- Manifest
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
test_wuffs_deflate_decode_256_bytes, //
test_wuffs_deflate_decode_deflate_backref_crosses_blocks, //
test_wuffs_deflate_decode_deflate_degenerate_huffman_unused, //
test_wuffs_deflate_decode_deflate_distance_32768, //
test_wuffs_deflate_decode_deflate_distance_code_31, //
test_wuffs_deflate_decode_deflate_huffman_primlen_9, //
test_wuffs_deflate_decode_interface, //
test_wuffs_deflate_decode_midsummer, //
test_wuffs_deflate_decode_pi_just_one_read, //
test_wuffs_deflate_decode_pi_many_big_reads, //
test_wuffs_deflate_decode_pi_many_medium_reads, //
test_wuffs_deflate_decode_pi_many_small_writes_reads, //
test_wuffs_deflate_decode_romeo, //
test_wuffs_deflate_decode_romeo_fixed, //
test_wuffs_deflate_decode_split_src, //
test_wuffs_deflate_history_full, //
test_wuffs_deflate_history_partial, //
test_wuffs_deflate_table_redirect, //
test_wuffs_deflate_decode_256_bytes,
test_wuffs_deflate_decode_deflate_backref_crosses_blocks,
test_wuffs_deflate_decode_deflate_degenerate_huffman_unused,
test_wuffs_deflate_decode_deflate_distance_32768,
test_wuffs_deflate_decode_deflate_distance_code_31,
test_wuffs_deflate_decode_deflate_huffman_primlen_9,
test_wuffs_deflate_decode_interface,
test_wuffs_deflate_decode_midsummer,
test_wuffs_deflate_decode_pi_just_one_read,
test_wuffs_deflate_decode_pi_many_big_reads,
test_wuffs_deflate_decode_pi_many_medium_reads,
test_wuffs_deflate_decode_pi_many_small_writes_reads,
test_wuffs_deflate_decode_romeo,
test_wuffs_deflate_decode_romeo_fixed,
test_wuffs_deflate_decode_split_src,
test_wuffs_deflate_history_full,
test_wuffs_deflate_history_partial,
test_wuffs_deflate_table_redirect,
#ifdef WUFFS_MIMIC
test_mimic_deflate_decode_256_bytes, //
test_mimic_deflate_decode_deflate_backref_crosses_blocks, //
test_mimic_deflate_decode_deflate_degenerate_huffman_unused, //
test_mimic_deflate_decode_deflate_distance_32768, //
test_mimic_deflate_decode_deflate_distance_code_31, //
test_mimic_deflate_decode_deflate_huffman_primlen_9, //
test_mimic_deflate_decode_midsummer, //
test_mimic_deflate_decode_pi_just_one_read, //
test_mimic_deflate_decode_pi_many_big_reads, //
test_mimic_deflate_decode_romeo, //
test_mimic_deflate_decode_romeo_fixed, //
test_mimic_deflate_decode_256_bytes,
test_mimic_deflate_decode_deflate_backref_crosses_blocks,
test_mimic_deflate_decode_deflate_degenerate_huffman_unused,
test_mimic_deflate_decode_deflate_distance_32768,
test_mimic_deflate_decode_deflate_distance_code_31,
test_mimic_deflate_decode_deflate_huffman_primlen_9,
test_mimic_deflate_decode_midsummer,
test_mimic_deflate_decode_pi_just_one_read,
test_mimic_deflate_decode_pi_many_big_reads,
test_mimic_deflate_decode_romeo,
test_mimic_deflate_decode_romeo_fixed,
#endif // WUFFS_MIMIC
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
bench_wuffs_deflate_decode_1k_full_init, //
bench_wuffs_deflate_decode_1k_part_init, //
bench_wuffs_deflate_decode_10k_full_init, //
bench_wuffs_deflate_decode_10k_part_init, //
bench_wuffs_deflate_decode_100k_just_one_read, //
bench_wuffs_deflate_decode_100k_many_big_reads, //
bench_wuffs_deflate_decode_1k_full_init,
bench_wuffs_deflate_decode_1k_part_init,
bench_wuffs_deflate_decode_10k_full_init,
bench_wuffs_deflate_decode_10k_part_init,
bench_wuffs_deflate_decode_100k_just_one_read,
bench_wuffs_deflate_decode_100k_many_big_reads,
#ifdef WUFFS_MIMIC
bench_mimic_deflate_decode_1k, //
bench_mimic_deflate_decode_10k, //
bench_mimic_deflate_decode_100k_just_one_read, //
bench_mimic_deflate_decode_100k_many_big_reads, //
bench_mimic_deflate_decode_1k,
bench_mimic_deflate_decode_10k,
bench_mimic_deflate_decode_100k_just_one_read,
bench_mimic_deflate_decode_100k_many_big_reads,
#endif // WUFFS_MIMIC
+78 -80
View File
@@ -2354,106 +2354,104 @@ bench_mimic_gif_decode_anim_screencap() {
// ---------------- Manifest
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
// These basic tests are really testing the Wuffs compiler. They aren't
// specific to the std/gif code, but putting them here is as good as any
// other place.
test_basic_bad_receiver, //
test_basic_bad_sizeof_receiver, //
test_basic_bad_wuffs_version, //
test_basic_initialize_not_called, //
test_basic_status_is_error, //
test_basic_sub_struct_initializer, //
test_basic_bad_receiver,
test_basic_bad_sizeof_receiver,
test_basic_bad_wuffs_version,
test_basic_initialize_not_called,
test_basic_status_is_error,
test_basic_sub_struct_initializer,
test_wuffs_gif_call_interleaved, //
test_wuffs_gif_call_sequence, //
test_wuffs_gif_decode_animated_big, //
test_wuffs_gif_decode_animated_medium, //
test_wuffs_gif_decode_animated_small, //
test_wuffs_gif_decode_background_color, //
test_wuffs_gif_decode_delay_num_frames_decoded, //
test_wuffs_gif_decode_empty_palette, //
test_wuffs_gif_decode_first_frame_is_opaque, //
test_wuffs_gif_decode_frame_out_of_bounds, //
test_wuffs_gif_decode_input_is_a_gif_just_one_read, //
test_wuffs_gif_decode_input_is_a_gif_many_big_reads, //
test_wuffs_gif_decode_input_is_a_gif_many_medium_reads, //
test_wuffs_gif_decode_input_is_a_gif_many_small_reads, //
test_wuffs_gif_decode_input_is_a_png, //
test_wuffs_gif_decode_interface_image_config_decoder, //
test_wuffs_gif_decode_interface_image_decoder, //
test_wuffs_gif_decode_interlaced_truncated, //
test_wuffs_gif_decode_metadata_empty, //
test_wuffs_gif_decode_metadata_full, //
test_wuffs_gif_decode_missing_two_src_bytes, //
test_wuffs_gif_decode_multiple_graphic_controls, //
test_wuffs_gif_decode_multiple_loop_counts, //
test_wuffs_gif_decode_pixel_data_none, //
test_wuffs_gif_decode_pixel_data_not_enough, //
test_wuffs_gif_decode_pixel_data_too_much_sans_quirk, //
test_wuffs_gif_decode_pixel_data_too_much_with_quirk, //
test_wuffs_gif_decode_pixfmt_bgr, //
test_wuffs_gif_decode_pixfmt_bgr_565, //
test_wuffs_gif_decode_pixfmt_bgra_nonpremul, //
test_wuffs_gif_decode_pixfmt_rgb, //
test_wuffs_gif_decode_pixfmt_rgba_nonpremul, //
test_wuffs_gif_decode_zero_width_frame, //
test_wuffs_gif_frame_dirty_rect, //
test_wuffs_gif_num_decoded_frame_configs, //
test_wuffs_gif_num_decoded_frames, //
test_wuffs_gif_io_position_one_chunk, //
test_wuffs_gif_io_position_two_chunks, //
test_wuffs_gif_small_frame_interlaced, //
test_wuffs_gif_sizeof, //
test_wuffs_gif_call_interleaved,
test_wuffs_gif_call_sequence,
test_wuffs_gif_decode_animated_big,
test_wuffs_gif_decode_animated_medium,
test_wuffs_gif_decode_animated_small,
test_wuffs_gif_decode_background_color,
test_wuffs_gif_decode_delay_num_frames_decoded,
test_wuffs_gif_decode_empty_palette,
test_wuffs_gif_decode_first_frame_is_opaque,
test_wuffs_gif_decode_frame_out_of_bounds,
test_wuffs_gif_decode_input_is_a_gif_just_one_read,
test_wuffs_gif_decode_input_is_a_gif_many_big_reads,
test_wuffs_gif_decode_input_is_a_gif_many_medium_reads,
test_wuffs_gif_decode_input_is_a_gif_many_small_reads,
test_wuffs_gif_decode_input_is_a_png,
test_wuffs_gif_decode_interface_image_config_decoder,
test_wuffs_gif_decode_interface_image_decoder,
test_wuffs_gif_decode_interlaced_truncated,
test_wuffs_gif_decode_metadata_empty,
test_wuffs_gif_decode_metadata_full,
test_wuffs_gif_decode_missing_two_src_bytes,
test_wuffs_gif_decode_multiple_graphic_controls,
test_wuffs_gif_decode_multiple_loop_counts,
test_wuffs_gif_decode_pixel_data_none,
test_wuffs_gif_decode_pixel_data_not_enough,
test_wuffs_gif_decode_pixel_data_too_much_sans_quirk,
test_wuffs_gif_decode_pixel_data_too_much_with_quirk,
test_wuffs_gif_decode_pixfmt_bgr,
test_wuffs_gif_decode_pixfmt_bgr_565,
test_wuffs_gif_decode_pixfmt_bgra_nonpremul,
test_wuffs_gif_decode_pixfmt_rgb,
test_wuffs_gif_decode_pixfmt_rgba_nonpremul,
test_wuffs_gif_decode_zero_width_frame,
test_wuffs_gif_frame_dirty_rect,
test_wuffs_gif_num_decoded_frame_configs,
test_wuffs_gif_num_decoded_frames,
test_wuffs_gif_io_position_one_chunk,
test_wuffs_gif_io_position_two_chunks,
test_wuffs_gif_small_frame_interlaced,
test_wuffs_gif_sizeof,
#ifdef WUFFS_MIMIC
test_mimic_gif_decode_animated_small, //
test_mimic_gif_decode_bricks_dither, //
test_mimic_gif_decode_bricks_gray, //
test_mimic_gif_decode_bricks_nodither, //
test_mimic_gif_decode_gifplayer_muybridge, //
test_mimic_gif_decode_harvesters, //
test_mimic_gif_decode_hat, //
test_mimic_gif_decode_hibiscus_primitive, //
test_mimic_gif_decode_hibiscus_regular, //
test_mimic_gif_decode_hippopotamus_interlaced, //
test_mimic_gif_decode_hippopotamus_regular, //
test_mimic_gif_decode_muybridge, //
test_mimic_gif_decode_pjw_thumbnail, //
test_mimic_gif_decode_animated_small,
test_mimic_gif_decode_bricks_dither,
test_mimic_gif_decode_bricks_gray,
test_mimic_gif_decode_bricks_nodither,
test_mimic_gif_decode_gifplayer_muybridge,
test_mimic_gif_decode_harvesters,
test_mimic_gif_decode_hat,
test_mimic_gif_decode_hibiscus_primitive,
test_mimic_gif_decode_hibiscus_regular,
test_mimic_gif_decode_hippopotamus_interlaced,
test_mimic_gif_decode_hippopotamus_regular,
test_mimic_gif_decode_muybridge,
test_mimic_gif_decode_pjw_thumbnail,
#endif // WUFFS_MIMIC
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
bench_wuffs_gif_decode_1k_bw, //
bench_wuffs_gif_decode_1k_color_full_init, //
bench_wuffs_gif_decode_1k_color_part_init, //
bench_wuffs_gif_decode_10k_bgra, //
bench_wuffs_gif_decode_10k_indexed, //
bench_wuffs_gif_decode_20k, //
bench_wuffs_gif_decode_100k_artificial, //
bench_wuffs_gif_decode_100k_realistic, //
bench_wuffs_gif_decode_1000k_full_init, //
bench_wuffs_gif_decode_1000k_part_init, //
bench_wuffs_gif_decode_anim_screencap, //
bench_wuffs_gif_decode_1k_bw,
bench_wuffs_gif_decode_1k_color_full_init,
bench_wuffs_gif_decode_1k_color_part_init,
bench_wuffs_gif_decode_10k_bgra,
bench_wuffs_gif_decode_10k_indexed,
bench_wuffs_gif_decode_20k,
bench_wuffs_gif_decode_100k_artificial,
bench_wuffs_gif_decode_100k_realistic,
bench_wuffs_gif_decode_1000k_full_init,
bench_wuffs_gif_decode_1000k_part_init,
bench_wuffs_gif_decode_anim_screencap,
#ifdef WUFFS_MIMIC
bench_mimic_gif_decode_1k_bw, //
bench_mimic_gif_decode_1k_color, //
bench_mimic_gif_decode_10k_indexed, //
bench_mimic_gif_decode_20k, //
bench_mimic_gif_decode_100k_artificial, //
bench_mimic_gif_decode_100k_realistic, //
bench_mimic_gif_decode_1000k, //
bench_mimic_gif_decode_anim_screencap, //
bench_mimic_gif_decode_1k_bw,
bench_mimic_gif_decode_1k_color,
bench_mimic_gif_decode_10k_indexed,
bench_mimic_gif_decode_20k,
bench_mimic_gif_decode_100k_artificial,
bench_mimic_gif_decode_100k_realistic,
bench_mimic_gif_decode_1000k,
bench_mimic_gif_decode_anim_screencap,
#endif // WUFFS_MIMIC
+17 -19
View File
@@ -72,13 +72,13 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// ---------------- Golden Tests
golden_test gzip_midsummer_gt = {
.want_filename = "test/data/midsummer.txt", //
.src_filename = "test/data/midsummer.txt.gz", //
.want_filename = "test/data/midsummer.txt",
.src_filename = "test/data/midsummer.txt.gz",
};
golden_test gzip_pi_gt = {
.want_filename = "test/data/pi.txt", //
.src_filename = "test/data/pi.txt.gz", //
.want_filename = "test/data/pi.txt",
.src_filename = "test/data/pi.txt.gz",
};
// ---------------- Gzip Tests
@@ -292,37 +292,35 @@ bench_mimic_gzip_decode_100k() {
// Note that the gzip mimic tests and benches don't work with
// WUFFS_MIMICLIB_USE_MINIZ_INSTEAD_OF_ZLIB.
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
test_wuffs_gzip_checksum_ignore, //
test_wuffs_gzip_checksum_verify_bad0, //
test_wuffs_gzip_checksum_verify_bad7, //
test_wuffs_gzip_checksum_verify_good, //
test_wuffs_gzip_decode_interface, //
test_wuffs_gzip_decode_midsummer, //
test_wuffs_gzip_decode_pi, //
test_wuffs_gzip_checksum_ignore,
test_wuffs_gzip_checksum_verify_bad0,
test_wuffs_gzip_checksum_verify_bad7,
test_wuffs_gzip_checksum_verify_good,
test_wuffs_gzip_decode_interface,
test_wuffs_gzip_decode_midsummer,
test_wuffs_gzip_decode_pi,
#ifdef WUFFS_MIMIC
test_mimic_gzip_decode_midsummer, //
test_mimic_gzip_decode_pi, //
test_mimic_gzip_decode_midsummer,
test_mimic_gzip_decode_pi,
#endif // WUFFS_MIMIC
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
bench_wuffs_gzip_decode_10k, //
bench_wuffs_gzip_decode_100k, //
bench_wuffs_gzip_decode_10k,
bench_wuffs_gzip_decode_100k,
#ifdef WUFFS_MIMIC
bench_mimic_gzip_decode_10k, //
bench_mimic_gzip_decode_100k, //
bench_mimic_gzip_decode_10k,
bench_mimic_gzip_decode_100k,
#endif // WUFFS_MIMIC
+105 -107
View File
@@ -217,39 +217,39 @@ test_strconv_hpd_rounded_integer() {
uint64_t want;
const char* str;
} test_cases[] = {
{.want = 4, .str = "-3.9"}, //
{.want = 3, .str = "-3.14159"}, //
{.want = 0, .str = "+0"}, //
{.want = 0, .str = "0.0000000009"}, //
{.want = 0, .str = "0.1"}, //
{.want = 1, .str = "0.9"}, //
{.want = 12, .str = "1234e-2"}, //
{.want = 57, .str = "5678e-2"}, //
{.want = 60, .str = "60.0"}, //
{.want = 60, .str = "60.4999"}, //
{.want = 60, .str = "60.5"}, //
{.want = 60, .str = "60.5000"}, //
{.want = 61, .str = "60.5001"}, //
{.want = 61, .str = "60.6"}, //
{.want = 61, .str = "61.0"}, //
{.want = 61, .str = "61.4999"}, //
{.want = 62, .str = "61.5"}, //
{.want = 62, .str = "61.5000"}, //
{.want = 62, .str = "61.5001"}, //
{.want = 62, .str = "61.6"}, //
{.want = 62, .str = "62.0"}, //
{.want = 62, .str = "62.4999"}, //
{.want = 62, .str = "62.5"}, //
{.want = 62, .str = "62.5000"}, //
{.want = 63, .str = "62.5001"}, //
{.want = 63, .str = "62.6"}, //
{.want = 1000, .str = "999.999"}, //
{.want = 4560000, .str = "456e+4"}, //
{.want = 4, .str = "-3.9"},
{.want = 3, .str = "-3.14159"},
{.want = 0, .str = "+0"},
{.want = 0, .str = "0.0000000009"},
{.want = 0, .str = "0.1"},
{.want = 1, .str = "0.9"},
{.want = 12, .str = "1234e-2"},
{.want = 57, .str = "5678e-2"},
{.want = 60, .str = "60.0"},
{.want = 60, .str = "60.4999"},
{.want = 60, .str = "60.5"},
{.want = 60, .str = "60.5000"},
{.want = 61, .str = "60.5001"},
{.want = 61, .str = "60.6"},
{.want = 61, .str = "61.0"},
{.want = 61, .str = "61.4999"},
{.want = 62, .str = "61.5"},
{.want = 62, .str = "61.5000"},
{.want = 62, .str = "61.5001"},
{.want = 62, .str = "61.6"},
{.want = 62, .str = "62.0"},
{.want = 62, .str = "62.4999"},
{.want = 62, .str = "62.5"},
{.want = 62, .str = "62.5000"},
{.want = 63, .str = "62.5001"},
{.want = 63, .str = "62.6"},
{.want = 1000, .str = "999.999"},
{.want = 4560000, .str = "456e+4"},
// With round-to-even, ½ rounds to 0 but "a tiny bit more than ½" rounds
// to 1, even if the HPD struct truncates that "1" digit.
{.want = 0, .str = "0.5"}, //
{.want = 1, // 50 '0's per row.
{.want = 0, .str = "0.5"},
{.want = 1, // 50 '0's per row.
.str = "0.500000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000"
@@ -262,14 +262,14 @@ test_strconv_hpd_rounded_integer() {
"00000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000001"}, //
"00000000000000000000000000000000000000000000000001"},
// Inputs with exactly 18 decimal digits before the decimal point.
{.want = 123456789012345679, .str = "123456789012345678.9"}, //
{.want = 1000000000000000000, .str = "999999999999999999.9"}, //
{.want = 123456789012345679, .str = "123456789012345678.9"},
{.want = 1000000000000000000, .str = "999999999999999999.9"},
// Inputs with exactly 19 decimal digits before the decimal point.
{.want = UINT64_MAX, .str = "1234567890123456789"}, //
{.want = UINT64_MAX, .str = "1234567890123456789"},
};
int tc;
@@ -300,21 +300,21 @@ test_strconv_hpd_shift() {
int32_t shift; // -ve means left shift, +ve means right shift.
const char* want;
} test_cases[] = {
{.str = "0", .shift = +2, .want = "+0"}, //
{.str = "1", .shift = +3, .want = "+.125"}, //
{.str = "12e3", .shift = +5, .want = "+375."}, //
{.str = "-0.007", .shift = +8, .want = "-.00002734375"}, //
{.str = "0", .shift = +2, .want = "+0"},
{.str = "1", .shift = +3, .want = "+.125"},
{.str = "12e3", .shift = +5, .want = "+375."},
{.str = "-0.007", .shift = +8, .want = "-.00002734375"},
{.str = "3.14159E+26",
.shift = +60,
.want = "+272489496.244698869986677891574800014495849609375"}, //
.want = "+272489496.244698869986677891574800014495849609375"},
{.str = "0", .shift = -2, .want = "+0"}, //
{.str = ".125", .shift = -3, .want = "+1."}, //
{.str = "3750e-1", .shift = -5, .want = "+12000."}, //
{.str = "-2.734375e-5", .shift = -8, .want = "-.007"}, //
{.str = "0", .shift = -2, .want = "+0"},
{.str = ".125", .shift = -3, .want = "+1."},
{.str = "3750e-1", .shift = -5, .want = "+12000."},
{.str = "-2.734375e-5", .shift = -8, .want = "-.007"},
{.str = "+272489496.244698869986677891574800014495849609375",
.shift = -60,
.want = "+314159000000000000000000000."}, //
.want = "+314159000000000000000000000."},
};
int tc;
@@ -713,25 +713,25 @@ test_strconv_utf_8_next() {
// ---------------- Golden Tests
golden_test json_australian_abc_gt = {
.want_filename = "test/data/australian-abc-local-stations.tokens", //
.src_filename = "test/data/australian-abc-local-stations.json", //
.want_filename = "test/data/australian-abc-local-stations.tokens",
.src_filename = "test/data/australian-abc-local-stations.json",
};
golden_test json_file_sizes_gt = {
.src_filename = "test/data/file-sizes.json", //
.src_filename = "test/data/file-sizes.json",
};
golden_test json_github_tags_gt = {
.src_filename = "test/data/github-tags.json", //
.src_filename = "test/data/github-tags.json",
};
golden_test json_json_things_unformatted_gt = {
.want_filename = "test/data/json-things.unformatted.tokens", //
.src_filename = "test/data/json-things.unformatted.json", //
.want_filename = "test/data/json-things.unformatted.tokens",
.src_filename = "test/data/json-things.unformatted.json",
};
golden_test json_nobel_prizes_gt = {
.src_filename = "test/data/nobel-prizes.json", //
.src_filename = "test/data/nobel-prizes.json",
};
// ---------------- JSON Tests
@@ -854,30 +854,30 @@ test_wuffs_json_decode_long_numbers() {
bool valid;
const char* suffix;
} test_cases[] = {
{.valid = true, .suffix = ""}, //
{.valid = true, .suffix = " "}, //
{.valid = fals, .suffix = "."}, //
{.valid = fals, .suffix = ". "}, //
{.valid = fals, .suffix = "E"}, //
{.valid = fals, .suffix = "E "}, //
{.valid = fals, .suffix = "E-"}, //
{.valid = fals, .suffix = "E- "}, //
{.valid = true, .suffix = "e2"}, //
{.valid = true, .suffix = "e2 "}, //
{.valid = true, .suffix = "e+34"}, //
{.valid = true, .suffix = "e+34 "}, //
{.valid = true, .suffix = ".2"}, //
{.valid = true, .suffix = ".2 "}, //
{.valid = fals, .suffix = ".2e"}, //
{.valid = fals, .suffix = ".2e "}, //
{.valid = fals, .suffix = ".2e+"}, //
{.valid = fals, .suffix = ".2e+ "}, //
{.valid = true, .suffix = ".2e4"}, //
{.valid = true, .suffix = ".2e4 "}, //
{.valid = true, .suffix = ".2E+5"}, //
{.valid = true, .suffix = ".2E+5 "}, //
{.valid = true, .suffix = ".2e-5678"}, //
{.valid = true, .suffix = ".2e-5678 "}, //
{.valid = true, .suffix = ""},
{.valid = true, .suffix = " "},
{.valid = fals, .suffix = "."},
{.valid = fals, .suffix = ". "},
{.valid = fals, .suffix = "E"},
{.valid = fals, .suffix = "E "},
{.valid = fals, .suffix = "E-"},
{.valid = fals, .suffix = "E- "},
{.valid = true, .suffix = "e2"},
{.valid = true, .suffix = "e2 "},
{.valid = true, .suffix = "e+34"},
{.valid = true, .suffix = "e+34 "},
{.valid = true, .suffix = ".2"},
{.valid = true, .suffix = ".2 "},
{.valid = fals, .suffix = ".2e"},
{.valid = fals, .suffix = ".2e "},
{.valid = fals, .suffix = ".2e+"},
{.valid = fals, .suffix = ".2e+ "},
{.valid = true, .suffix = ".2e4"},
{.valid = true, .suffix = ".2e4 "},
{.valid = true, .suffix = ".2E+5"},
{.valid = true, .suffix = ".2E+5 "},
{.valid = true, .suffix = ".2e-5678"},
{.valid = true, .suffix = ".2e-5678 "},
};
// src_array holds the overall test string. 119 is arbitrary but long enough.
@@ -1118,17 +1118,17 @@ test_wuffs_json_decode_quirk_allow_leading_etc() {
const char* want;
const char* str;
} test_cases[] = {
{.want = "-X-X", .str = "\x1Etrue"}, //
{.want = "--XX", .str = "\xEF\xBB\xBFtrue"}, //
{.want = "---X", .str = "\x1E\xEF\xBB\xBFtrue"}, //
{.want = "---X", .str = "\xEF\xBB\xBF\x1Etrue"}, //
{.want = "----", .str = " \x1Etrue"}, //
{.want = "----", .str = "\x1E \xEF\xBB\xBFtrue"}, //
{.want = "----", .str = "\x1E\x1Etrue"}, //
{.want = "----", .str = "\xEF\xBB"}, //
{.want = "----", .str = "\xEF\xBB\xBF"}, //
{.want = "----", .str = "\xEF\xBB\xBF$"}, //
{.want = "----", .str = "\xEFtrue"}, //
{.want = "-X-X", .str = "\x1Etrue"},
{.want = "--XX", .str = "\xEF\xBB\xBFtrue"},
{.want = "---X", .str = "\x1E\xEF\xBB\xBFtrue"},
{.want = "---X", .str = "\xEF\xBB\xBF\x1Etrue"},
{.want = "----", .str = " \x1Etrue"},
{.want = "----", .str = "\x1E \xEF\xBB\xBFtrue"},
{.want = "----", .str = "\x1E\x1Etrue"},
{.want = "----", .str = "\xEF\xBB"},
{.want = "----", .str = "\xEF\xBB\xBF"},
{.want = "----", .str = "\xEF\xBB\xBF$"},
{.want = "----", .str = "\xEFtrue"},
};
int tc;
@@ -1596,28 +1596,27 @@ bench_wuffs_json_decode_217k_stringy() {
// ---------------- Manifest
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
// These strconv tests are really testing the Wuffs base library. They
// aren't specific to the std/json code, but putting them here is as good
// as any other place.
test_strconv_hpd_rounded_integer, //
test_strconv_hpd_shift, //
test_strconv_parse_number_f64, //
test_strconv_parse_number_i64, //
test_strconv_parse_number_u64, //
test_strconv_utf_8_next, //
test_strconv_hpd_rounded_integer,
test_strconv_hpd_shift,
test_strconv_parse_number_f64,
test_strconv_parse_number_i64,
test_strconv_parse_number_u64,
test_strconv_utf_8_next,
test_wuffs_json_decode_end_of_data, //
test_wuffs_json_decode_interface, //
test_wuffs_json_decode_long_numbers, //
test_wuffs_json_decode_prior_valid_utf_8, //
test_wuffs_json_decode_quirk_allow_leading_etc, //
test_wuffs_json_decode_quirk_allow_trailing_etc, //
test_wuffs_json_decode_src_io_buffer_length, //
test_wuffs_json_decode_string, //
test_wuffs_json_decode_unicode4_escapes, //
test_wuffs_json_decode_end_of_data,
test_wuffs_json_decode_interface,
test_wuffs_json_decode_long_numbers,
test_wuffs_json_decode_prior_valid_utf_8,
test_wuffs_json_decode_quirk_allow_leading_etc,
test_wuffs_json_decode_quirk_allow_trailing_etc,
test_wuffs_json_decode_src_io_buffer_length,
test_wuffs_json_decode_string,
test_wuffs_json_decode_unicode4_escapes,
#ifdef WUFFS_MIMIC
@@ -1628,13 +1627,12 @@ proc tests[] = {
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
bench_wuffs_json_decode_1k, //
bench_wuffs_json_decode_21k_formatted, //
bench_wuffs_json_decode_26k_compact, //
bench_wuffs_json_decode_217k_stringy, //
bench_wuffs_json_decode_1k,
bench_wuffs_json_decode_21k_formatted,
bench_wuffs_json_decode_26k_compact,
bench_wuffs_json_decode_217k_stringy,
#ifdef WUFFS_MIMIC
+12 -14
View File
@@ -437,28 +437,26 @@ bench_wuffs_lzw_decode_100k() {
// ---------------- Manifest
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
test_wuffs_lzw_decode_bricks_dither, //
test_wuffs_lzw_decode_bricks_nodither, //
test_wuffs_lzw_decode_interface, //
test_wuffs_lzw_decode_many_big_reads, //
test_wuffs_lzw_decode_many_small_writes_reads, //
test_wuffs_lzw_decode_output_bad, //
test_wuffs_lzw_decode_output_empty, //
test_wuffs_lzw_decode_pi, //
test_wuffs_lzw_decode_width_0, //
test_wuffs_lzw_decode_width_1, //
test_wuffs_lzw_decode_bricks_dither,
test_wuffs_lzw_decode_bricks_nodither,
test_wuffs_lzw_decode_interface,
test_wuffs_lzw_decode_many_big_reads,
test_wuffs_lzw_decode_many_small_writes_reads,
test_wuffs_lzw_decode_output_bad,
test_wuffs_lzw_decode_output_empty,
test_wuffs_lzw_decode_pi,
test_wuffs_lzw_decode_width_0,
test_wuffs_lzw_decode_width_1,
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
bench_wuffs_lzw_decode_20k, //
bench_wuffs_lzw_decode_100k, //
bench_wuffs_lzw_decode_20k,
bench_wuffs_lzw_decode_100k,
NULL,
};
+3 -5
View File
@@ -166,12 +166,11 @@ test_wuffs_wbmp_decode_image_config() {
// ---------------- Manifest
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
test_wuffs_wbmp_decode_frame_config, //
test_wuffs_wbmp_decode_image_config, //
test_wuffs_wbmp_decode_interface, //
test_wuffs_wbmp_decode_frame_config,
test_wuffs_wbmp_decode_image_config,
test_wuffs_wbmp_decode_interface,
#ifdef WUFFS_MIMIC
@@ -182,7 +181,6 @@ proc tests[] = {
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
// No WBMP benches.
+19 -21
View File
@@ -72,13 +72,13 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// ---------------- Golden Tests
golden_test zlib_midsummer_gt = {
.want_filename = "test/data/midsummer.txt", //
.src_filename = "test/data/midsummer.txt.zlib", //
.want_filename = "test/data/midsummer.txt",
.src_filename = "test/data/midsummer.txt.zlib",
};
golden_test zlib_pi_gt = {
.want_filename = "test/data/pi.txt", //
.src_filename = "test/data/pi.txt.zlib", //
.want_filename = "test/data/pi.txt",
.src_filename = "test/data/pi.txt.zlib",
};
// This dictionary-using zlib-encoded data comes from
@@ -368,39 +368,37 @@ bench_mimic_zlib_decode_100k() {
// ---------------- Manifest
// The empty comments forces clang-format to place one element per line.
proc tests[] = {
test_wuffs_zlib_checksum_ignore, //
test_wuffs_zlib_checksum_verify_bad0, //
test_wuffs_zlib_checksum_verify_bad3, //
test_wuffs_zlib_checksum_verify_good, //
test_wuffs_zlib_decode_interface, //
test_wuffs_zlib_decode_midsummer, //
test_wuffs_zlib_decode_pi, //
test_wuffs_zlib_decode_sheep, //
test_wuffs_zlib_checksum_ignore,
test_wuffs_zlib_checksum_verify_bad0,
test_wuffs_zlib_checksum_verify_bad3,
test_wuffs_zlib_checksum_verify_good,
test_wuffs_zlib_decode_interface,
test_wuffs_zlib_decode_midsummer,
test_wuffs_zlib_decode_pi,
test_wuffs_zlib_decode_sheep,
#ifdef WUFFS_MIMIC
test_mimic_zlib_decode_midsummer, //
test_mimic_zlib_decode_pi, //
test_mimic_zlib_decode_sheep, //
test_mimic_zlib_decode_midsummer,
test_mimic_zlib_decode_pi,
test_mimic_zlib_decode_sheep,
#endif // WUFFS_MIMIC
NULL,
};
// The empty comments forces clang-format to place one element per line.
proc benches[] = {
bench_wuffs_zlib_decode_10k, //
bench_wuffs_zlib_decode_100k, //
bench_wuffs_zlib_decode_10k,
bench_wuffs_zlib_decode_100k,
#ifdef WUFFS_MIMIC
bench_mimic_zlib_decode_10k, //
bench_mimic_zlib_decode_100k, //
bench_mimic_zlib_decode_10k,
bench_mimic_zlib_decode_100k,
#endif // WUFFS_MIMIC