Skip to content

Commit 72a7363

Browse files
committed
2024-08-20 v. 6.5.1: updated some tests
1 parent 5657945 commit 72a7363

File tree

132 files changed

+1972
-465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1972
-465
lines changed

test/easy/test_1018_binary_prefix_divisible_by_5.rb

+12-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@
55
require 'minitest/autorun'
66

77
class BinaryPrefixDivisibleBy5Test < ::Minitest::Test
8-
def test_default_one = assert_equal([true, false, false], prefixes_div_by5([0, 1, 1]))
8+
def test_default_one
9+
assert_equal(
10+
[true, false, false],
11+
prefixes_div_by5([0, 1, 1])
12+
)
13+
end
914

10-
def test_default_two = assert_equal([false, false, false], prefixes_div_by5([1, 1, 1]))
15+
def test_default_two
16+
assert_equal(
17+
[false, false, false],
18+
prefixes_div_by5([1, 1, 1])
19+
)
20+
end
1121
end

test/easy/test_1021_remove_outermost_parentheses.rb

+18-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,24 @@
55
require 'minitest/autorun'
66

77
class RemoveOutermostParenthesesTest < ::Minitest::Test
8-
def test_default_one = assert_equal('()()()', remove_outer_parentheses('(()())(())'))
8+
def test_default_one
9+
assert_equal(
10+
'()()()',
11+
remove_outer_parentheses('(()())(())')
12+
)
13+
end
914

10-
def test_default_two = assert_equal('()()()()(())', remove_outer_parentheses('(()())(())(()(()))'))
15+
def test_default_two
16+
assert_equal(
17+
'()()()()(())',
18+
remove_outer_parentheses('(()())(())(()(()))')
19+
)
20+
end
1121

12-
def test_default_three = assert_equal('', remove_outer_parentheses('()()'))
22+
def test_default_three
23+
assert_equal(
24+
'',
25+
remove_outer_parentheses('()()')
26+
)
27+
end
1328
end

test/easy/test_1108_defanging_an_ip_address.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77
class DefangingAnIPAddressTest < ::Minitest::Test
88
# rubocop:disable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses
99
def test_default_one
10-
assert_equal('1[.]1[.]1[.]1', defang_i_paddr('1.1.1.1'))
10+
assert_equal(
11+
'1[.]1[.]1[.]1',
12+
defang_i_paddr('1.1.1.1')
13+
)
1114
end
1215

1316
def test_default_two
14-
assert_equal('255[.]100[.]50[.]0', defang_i_paddr('255.100.50.0'))
17+
assert_equal(
18+
'255[.]100[.]50[.]0',
19+
defang_i_paddr('255.100.50.0')
20+
)
1521
end
1622
# rubocop:enable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses
1723
end

test/easy/test_1184_distance_between_bus_stops.rb

+30-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,36 @@
55
require 'minitest/autorun'
66

77
class DistanceBetweenBusStopsTest < ::Minitest::Test
8-
def test_default_one = assert_equal(1, distance_between_bus_stops([1, 2, 3, 4], 0, 1))
8+
def test_default_one
9+
assert_equal(
10+
1,
11+
distance_between_bus_stops(
12+
[1, 2, 3, 4],
13+
0,
14+
1
15+
)
16+
)
17+
end
918

10-
def test_default_two = assert_equal(3, distance_between_bus_stops([1, 2, 3, 4], 0, 2))
19+
def test_default_two
20+
assert_equal(
21+
3,
22+
distance_between_bus_stops(
23+
[1, 2, 3, 4],
24+
0,
25+
2
26+
)
27+
)
28+
end
1129

12-
def test_default_three = assert_equal(4, distance_between_bus_stops([1, 2, 3, 4], 0, 3))
30+
def test_default_three
31+
assert_equal(
32+
4,
33+
distance_between_bus_stops(
34+
[1, 2, 3, 4],
35+
0,
36+
3
37+
)
38+
)
39+
end
1340
end

test/easy/test_1200_minimum_absolute_difference.rb

+13-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
class MinimumAbsoluteDifferenceTest < ::Minitest::Test
88
def test_default_one
99
assert_equal(
10-
[[1, 2], [2, 3], [3, 4]],
10+
[
11+
[1, 2],
12+
[2, 3],
13+
[3, 4]
14+
],
1115
minimum_abs_difference(
1216
[4, 2, 1, 3]
1317
)
@@ -16,7 +20,9 @@ def test_default_one
1620

1721
def test_default_two
1822
assert_equal(
19-
[[1, 3]],
23+
[
24+
[1, 3]
25+
],
2026
minimum_abs_difference(
2127
[1, 3, 6, 10, 15]
2228
)
@@ -25,7 +31,11 @@ def test_default_two
2531

2632
def test_default_three
2733
assert_equal(
28-
[[-14, -10], [19, 23], [23, 27]],
34+
[
35+
[-14, -10],
36+
[19, 23],
37+
[23, 27]
38+
],
2939
minimum_abs_difference(
3040
[3, 8, -10, 23, 19, -4, -14, 27]
3141
)

test/easy/test_1207_unique_number_of_occurrences.rb

+21-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,27 @@
55
require 'minitest/autorun'
66

77
class UniqueNumberOfOccurrencesTest < ::Minitest::Test
8-
def test_default_one = assert(unique_occurrences([1, 2, 2, 1, 1, 3]))
8+
def test_default_one
9+
assert(
10+
unique_occurrences(
11+
[1, 2, 2, 1, 1, 3]
12+
)
13+
)
14+
end
915

10-
def test_default_two = assert(!unique_occurrences([1, 2]))
16+
def test_default_two
17+
assert(
18+
!unique_occurrences(
19+
[1, 2]
20+
)
21+
)
22+
end
1123

12-
def test_default_three = assert(unique_occurrences([-3, 0, 1, -3, 1, 1, 1, -3, 10, 0]))
24+
def test_default_three
25+
assert(
26+
unique_occurrences(
27+
[-3, 0, 1, -3, 1, 1, 1, -3, 10, 0]
28+
)
29+
)
30+
end
1331
end

test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb

+24-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,30 @@
55
require 'minitest/autorun'
66

77
class MinimumCostToMoveChipsToTheSamePositionTest < ::Minitest::Test
8-
def test_default_one = assert_equal(1, min_cost_to_move_chips([1, 2, 3]))
8+
def test_default_one
9+
assert_equal(
10+
1,
11+
min_cost_to_move_chips(
12+
[1, 2, 3]
13+
)
14+
)
15+
end
916

10-
def test_default_two = assert_equal(2, min_cost_to_move_chips([2, 2, 2, 3, 3]))
17+
def test_default_two
18+
assert_equal(
19+
2,
20+
min_cost_to_move_chips(
21+
[2, 2, 2, 3, 3]
22+
)
23+
)
24+
end
1125

12-
def test_default_three = assert_equal(1, min_cost_to_move_chips([1, 1, 1_000_000_000]))
26+
def test_default_three
27+
assert_equal(
28+
1,
29+
min_cost_to_move_chips(
30+
[1, 1, 1_000_000_000]
31+
)
32+
)
33+
end
1334
end

test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb

+26-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,31 @@
55
require 'minitest/autorun'
66

77
class CellsWithOddValuesInAMatrixTest < ::Minitest::Test
8-
def test_default_one = assert_equal(6, odd_cells(2, 3, [[0, 1], [1, 1]]))
8+
def test_default_one
9+
assert_equal(
10+
6,
11+
odd_cells(
12+
2,
13+
3,
14+
[
15+
[0, 1],
16+
[1, 1]
17+
]
18+
)
19+
)
20+
end
921

10-
def test_default_two = assert_equal(0, odd_cells(2, 2, [[1, 1], [0, 0]]))
22+
def test_default_two
23+
assert_equal(
24+
0,
25+
odd_cells(
26+
2,
27+
2,
28+
[
29+
[1, 1],
30+
[0, 0]
31+
]
32+
)
33+
)
34+
end
1135
end

test/easy/test_1266_minimum_time_visiting_all_points.rb

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ def test_default_one
99
assert_equal(
1010
7,
1111
min_time_to_visit_all_points(
12-
[[1, 1], [3, 4], [-1, 0]]
12+
[
13+
[1, 1],
14+
[3, 4],
15+
[-1, 0]
16+
]
1317
)
1418
)
1519
end
@@ -18,7 +22,10 @@ def test_default_two
1822
assert_equal(
1923
5,
2024
min_time_to_visit_all_points(
21-
[[3, 2], [-2, 2]]
25+
[
26+
[3, 2],
27+
[-2, 2]
28+
]
2229
)
2330
)
2431
end

test/easy/test_1313_decompress_run_length_encoded_list.rb

+16-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@
55
require 'minitest/autorun'
66

77
class DecompressRunLengthEncodedListTest < ::Minitest::Test
8-
def test_default_one = assert_equal([2, 4, 4, 4], decompress_rl_elist([1, 2, 3, 4]))
8+
def test_default_one
9+
assert_equal(
10+
[2, 4, 4, 4],
11+
decompress_rl_elist(
12+
[1, 2, 3, 4]
13+
)
14+
)
15+
end
916

10-
def test_default_two = assert_equal([1, 3, 3], decompress_rl_elist([1, 1, 2, 3]))
17+
def test_default_two
18+
assert_equal(
19+
[1, 3, 3],
20+
decompress_rl_elist(
21+
[1, 1, 2, 3]
22+
)
23+
)
24+
end
1125
end

test/easy/test_1360_number_of_days_between_two_dates.rb

+17-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,22 @@
55
require 'minitest/autorun'
66

77
class NumberOfDaysBetweenTwoDatesTest < ::Minitest::Test
8-
def test_default_one = assert_equal(1, days_between_dates('2019-06-29', '2019-06-30'))
8+
def test_default_one
9+
assert_equal(
10+
1,
11+
days_between_dates(
12+
'2019-06-29',
13+
'2019-06-30'
14+
)
15+
)
16+
end
917

10-
def test_default_two = assert_equal(15, days_between_dates('2020-01-15', '2019-12-31'))
18+
def test_default_two
19+
assert_equal(
20+
15,
21+
days_between_dates(
22+
'2020-01-15', '2019-12-31'
23+
)
24+
)
25+
end
1126
end

test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb

+16-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@
55
require 'minitest/autorun'
66

77
class MinimumSubsequenceInNonIncreasingOrderTest < ::Minitest::Test
8-
def test_default_one = assert_equal([10, 9], min_subsequence([4, 3, 10, 9, 8]))
8+
def test_default_one
9+
assert_equal(
10+
[10, 9],
11+
min_subsequence(
12+
[4, 3, 10, 9, 8]
13+
)
14+
)
15+
end
916

10-
def test_default_two = assert_equal([7, 7, 6], min_subsequence([4, 4, 7, 6, 7]))
17+
def test_default_two
18+
assert_equal(
19+
[7, 7, 6],
20+
min_subsequence(
21+
[4, 4, 7, 6, 7]
22+
)
23+
)
24+
end
1125
end

test/easy/test_1408_string_matching_in_an_array.rb

+24-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,30 @@
55
require 'minitest/autorun'
66

77
class StringMatchingInAnArrayTest < ::Minitest::Test
8-
def test_default_one = assert_equal(%w[as hero], string_matching(%w[mass as hero superhero]))
8+
def test_default_one
9+
assert_equal(
10+
%w[as hero],
11+
string_matching(
12+
%w[mass as hero superhero]
13+
)
14+
)
15+
end
916

10-
def test_default_two = assert_equal(%w[et code], string_matching(%w[leetcode et code]))
17+
def test_default_two
18+
assert_equal(
19+
%w[et code],
20+
string_matching(
21+
%w[leetcode et code]
22+
)
23+
)
24+
end
1125

12-
def test_default_three = assert_equal([], string_matching(%w[blue green bu]))
26+
def test_default_three
27+
assert_equal(
28+
[],
29+
string_matching(
30+
%w[blue green bu]
31+
)
32+
)
33+
end
1334
end

0 commit comments

Comments
 (0)