Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit 1945212

Browse files
committed
Decrease number of test cases and pretty print JSON files
1 parent 0a8b981 commit 1945212

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

Rakefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,18 @@ task :generate_ordered_string_test_cases do
5757
(0..rand(max_string_length -1)).map { rand(unicode_char_max + 1).chr }.join
5858
end
5959

60-
num_test_cases = 1_000
60+
# This number is arbitrary. 100 seems good because GitHub is willing to display
61+
# the output files in diffs in PRs, but will require pulling branches down for
62+
# larger numbers of test cases.
63+
num_test_cases = 100
6164

6265
orderise_string_cases = (0..(num_test_cases - 1)).map do
6366
str = random_ascii_string.call
6467
output = index.__send__ :orderise_string, str
6568
{input: str, output: output}
6669
end
6770

68-
File.write("orderise_string_test_cases.json", orderise_string_cases.to_json)
69-
70-
num_test_cases = 100
71+
File.write("orderise_string_test_cases.json", JSON.pretty_generate(orderise_string_cases))
7172

7273
string_comparison_cases = (0..(num_test_cases - 1)).map do
7374
str_a = random_ascii_string.call
@@ -88,7 +89,7 @@ task :generate_ordered_string_test_cases do
8889
{input: [str_a, str_b], output: output}
8990
end
9091

91-
File.write("string_comparison_test_cases.json", string_comparison_cases.to_json)
92+
File.write("string_comparison_test_cases.json", JSON.pretty_generate(string_comparison_cases))
9293
end
9394

9495
require 'yard'

0 commit comments

Comments
 (0)