Skip to content

Commit 1f2294e

Browse files
committed
2024-08-20 v. 6.5.1: updated some tests
1 parent e9dc6c7 commit 1f2294e

File tree

106 files changed

+794
-385
lines changed

Some content is hidden

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

106 files changed

+794
-385
lines changed

test/easy/test_1002_find_common_characters.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
require 'minitest/autorun'
66

77
class FindCommonCharactersTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(%w[e l l], common_chars(%w[bella label roller]))
10-
assert_equal(%w[c o], common_chars(%w[cool lock cook]))
11-
end
8+
def test_default_one = assert_equal(%w[e l l], common_chars(%w[bella label roller]))
9+
10+
def test_default_two = assert_equal(%w[c o], common_chars(%w[cool lock cook]))
1211
end

test/easy/test_1005_maximize_sum_of_array_after_k_negations.rb

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

77
class MaximizeSumOfArrayAfterKNegationsTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(5, largest_sum_after_k_negations([4, 2, 3], 1))
10-
assert_equal(6, largest_sum_after_k_negations([3, -1, 0, 2], 3))
11-
assert_equal(13, largest_sum_after_k_negations([2, -3, -1, 5, -4], 2))
12-
end
8+
def test_default_one = assert_equal(5, largest_sum_after_k_negations([4, 2, 3], 1))
9+
10+
def test_default_two = assert_equal(6, largest_sum_after_k_negations([3, -1, 0, 2], 3))
11+
12+
def test_default_three = assert_equal(13, largest_sum_after_k_negations([2, -3, -1, 5, -4], 2))
1313
end

test/easy/test_1009_complement_of_base_10_integer.rb

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

77
class ComplementOfBase10IntegerTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(2, bitwise_complement(5))
10-
assert_equal(0, bitwise_complement(7))
11-
assert_equal(5, bitwise_complement(10))
12-
end
8+
def test_default_one = assert_equal(2, bitwise_complement(5))
9+
10+
def test_default_two = assert_equal(0, bitwise_complement(7))
11+
12+
def test_default_three = assert_equal(5, bitwise_complement(10))
1313
end

test/easy/test_1018_binary_prefix_divisible_by_5.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
require 'minitest/autorun'
66

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

test/easy/test_1021_remove_outermost_parentheses.rb

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

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

test/easy/test_1022_sum_of_root_to_leaf_binary_numbers.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
require 'minitest/autorun'
77

88
class SumOfRootToLeafBinaryNumbersTest < ::Minitest::Test
9-
def test_default
9+
def test_default_one
1010
assert_equal(
1111
22,
1212
sum_root_to_leaf(
@@ -25,6 +25,9 @@ def test_default
2525
)
2626
)
2727
)
28+
end
29+
30+
def test_default_two
2831
assert_equal(
2932
0,
3033
sum_root_to_leaf(

test/easy/test_1025_divisor_game.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
require 'minitest/autorun'
66

77
class DivisorGameTest < ::Minitest::Test
8-
def test_default
9-
assert(divisor_game(2))
10-
assert(!divisor_game(3))
11-
end
8+
def test_default_one = assert(divisor_game(2))
9+
10+
def test_default_two = assert(!divisor_game(3))
1211
end

test/easy/test_1046_last_stone_weight.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
require 'minitest/autorun'
66

77
class LastStoneWeightTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(1, last_stone_weight([2, 7, 4, 1, 8, 1]))
10-
assert_equal(1, last_stone_weight([1]))
11-
end
8+
def test_default_one = assert_equal(1, last_stone_weight([2, 7, 4, 1, 8, 1]))
9+
10+
def test_default_two = assert_equal(1, last_stone_weight([1]))
1211
end

test/easy/test_1047_remove_all_adjacent_duplicates_in_string.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
require 'minitest/autorun'
66

77
class RemoveAllAdjacentDuplicatesInStringTest < ::Minitest::Test
8-
def test_default
9-
assert_equal('ca', remove_duplicates_all('abbaca'))
10-
assert_equal('ay', remove_duplicates_all('azxxzy'))
11-
end
8+
def test_default_one = assert_equal('ca', remove_duplicates_all('abbaca'))
9+
10+
def test_default_two = assert_equal('ay', remove_duplicates_all('azxxzy'))
1211
end

test/easy/test_1051_height_checker.rb

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

77
class HeightCheckerTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(3, height_checker([1, 1, 4, 2, 1, 3]))
10-
assert_equal(5, height_checker([5, 1, 2, 3, 4]))
11-
assert_equal(0, height_checker([1, 2, 3, 4, 5]))
12-
end
8+
def test_default_one = assert_equal(3, height_checker([1, 1, 4, 2, 1, 3]))
9+
10+
def test_default_two = assert_equal(5, height_checker([5, 1, 2, 3, 4]))
11+
12+
def test_default_three = assert_equal(0, height_checker([1, 2, 3, 4, 5]))
1313
end

test/easy/test_1071_greatest_common_divisor_of_strings.rb

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

77
class GreatestCommonDivisorOfStringsTest < ::Minitest::Test
8-
def test_default
9-
assert_equal('ABC', gcd_of_strings('ABCABC', 'ABC'))
10-
assert_equal('AB', gcd_of_strings('ABABAB', 'ABAB'))
11-
assert_equal('', gcd_of_strings('LEET', 'CODE'))
12-
end
8+
def test_default_one = assert_equal('ABC', gcd_of_strings('ABCABC', 'ABC'))
9+
10+
def test_default_two = assert_equal('AB', gcd_of_strings('ABABAB', 'ABAB'))
11+
12+
def test_default_three = assert_equal('', gcd_of_strings('LEET', 'CODE'))
1313
end

test/easy/test_1078_occurrences_after_bigram.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
require 'minitest/autorun'
66

77
class OccurrencesAfterBigramTest < ::Minitest::Test
8-
def test_default
8+
def test_default_one
99
assert_equal(
1010
%w[girl student],
1111
find_occurrences(
@@ -14,6 +14,9 @@ def test_default
1414
'good'
1515
)
1616
)
17+
end
18+
19+
def test_default_two
1720
assert_equal(
1821
%w[we rock],
1922
find_occurrences(

test/easy/test_1089_duplicate_zeros.rb

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

77
class DuplicateZerosTest < ::Minitest::Test
8-
def test_default
8+
def test_default_one
99
arr = [1, 0, 2, 3, 0, 4, 5, 0]
1010
duplicate_zeros(arr)
1111
assert_equal([1, 0, 0, 2, 3, 0, 0, 4], arr)
12+
end
1213

14+
def test_default_two
1315
arr = [1, 2, 3]
1416
duplicate_zeros(arr)
1517
assert_equal([1, 2, 3], arr)
1618
end
1719

18-
def test_additional
20+
def test_additional_one
1921
arr = [8, 4, 5, 0, 0, 0, 0, 7]
2022
duplicate_zeros(arr)
2123
assert_equal([8, 4, 5, 0, 0, 0, 0, 0], arr)

test/easy/test_1103_distribute_candies_to_people.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
require 'minitest/autorun'
66

77
class DistributeCandiesToPeopleTest < ::Minitest::Test
8-
def test_default
9-
assert_equal([1, 2, 3, 1], distribute_candies(7, 4))
10-
assert_equal([5, 2, 3], distribute_candies(10, 3))
11-
end
8+
def test_default_one = assert_equal([1, 2, 3, 1], distribute_candies(7, 4))
9+
10+
def test_default_two = assert_equal([5, 2, 3], distribute_candies(10, 3))
1211
end

test/easy/test_1108_defanging_an_ip_address.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
require 'minitest/autorun'
66

77
class DefangingAnIPAddressTest < ::Minitest::Test
8-
def test_default
9-
# rubocop:disable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses
8+
# rubocop:disable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses
9+
def test_default_one
1010
assert_equal('1[.]1[.]1[.]1', defang_i_paddr('1.1.1.1'))
11+
end
12+
13+
def test_default_two
1114
assert_equal('255[.]100[.]50[.]0', defang_i_paddr('255.100.50.0'))
12-
# rubocop:enable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses
1315
end
16+
# rubocop:enable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses
1417
end

test/easy/test_1137_n_th_tribonacci_number.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
require 'minitest/autorun'
66

77
class NThTribonacciNumberTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(4, tribonacci(4))
10-
assert_equal(1_389_537, tribonacci(25))
11-
end
8+
def test_default_one = assert_equal(4, tribonacci(4))
9+
10+
def test_default_two = assert_equal(1_389_537, tribonacci(25))
1211
end

test/easy/test_1154_day_of_the_year.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
require 'minitest/autorun'
66

77
class DayOfTheYearTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(9, day_of_year('2019-01-09'))
10-
assert_equal(41, day_of_year('2019-02-10'))
11-
end
8+
def test_default_one = assert_equal(9, day_of_year('2019-01-09'))
9+
10+
def test_default_two = assert_equal(41, day_of_year('2019-02-10'))
1211
end

test/easy/test_1160_find_words_that_can_be_formed_by_characters.rb

+19-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,27 @@
55
require 'minitest/autorun'
66

77
class FindWordsThatCanBeFormedByCharactersTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(6, count_characters(%w[cat bt hat tree], 'atach'))
10-
assert_equal(10, count_characters(%w[hello world leetcode], 'welldonehoneyr'))
8+
def test_default_one
9+
assert_equal(
10+
6,
11+
count_characters(
12+
%w[cat bt hat tree],
13+
'atach'
14+
)
15+
)
16+
end
17+
18+
def test_default_two
19+
assert_equal(
20+
10,
21+
count_characters(
22+
%w[hello world leetcode],
23+
'welldonehoneyr'
24+
)
25+
)
1126
end
1227

13-
def test_additional
28+
def test_additional_one
1429
assert_equal(
1530
0,
1631
count_characters(

test/easy/test_1184_distance_between_bus_stops.rb

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

77
class DistanceBetweenBusStopsTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(1, distance_between_bus_stops([1, 2, 3, 4], 0, 1))
10-
assert_equal(3, distance_between_bus_stops([1, 2, 3, 4], 0, 2))
11-
assert_equal(4, distance_between_bus_stops([1, 2, 3, 4], 0, 3))
12-
end
8+
def test_default_one = assert_equal(1, distance_between_bus_stops([1, 2, 3, 4], 0, 1))
9+
10+
def test_default_two = assert_equal(3, distance_between_bus_stops([1, 2, 3, 4], 0, 2))
11+
12+
def test_default_three = assert_equal(4, distance_between_bus_stops([1, 2, 3, 4], 0, 3))
1313
end

test/easy/test_1185_day_of_the_week.rb

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

77
class DayOfTheWeekTest < ::Minitest::Test
8-
def test_default
9-
assert_equal('Saturday', day_of_the_week(31, 8, 2019))
10-
assert_equal('Sunday', day_of_the_week(18, 7, 1999))
11-
assert_equal('Sunday', day_of_the_week(15, 8, 1993))
12-
end
8+
def test_default_one = assert_equal('Saturday', day_of_the_week(31, 8, 2019))
9+
10+
def test_default_two = assert_equal('Sunday', day_of_the_week(18, 7, 1999))
11+
12+
def test_default_three = assert_equal('Sunday', day_of_the_week(15, 8, 1993))
1313
end

test/easy/test_1189_maximum_number_of_balloons.rb

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

77
class MaximumNumberOfBalloonsTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(1, max_number_of_balloons('nlaebolko'))
10-
assert_equal(2, max_number_of_balloons('loonbalxballpoon'))
11-
assert_equal(0, max_number_of_balloons('leetcode'))
12-
end
8+
def test_default_one = assert_equal(1, max_number_of_balloons('nlaebolko'))
9+
10+
def test_default_two = assert_equal(2, max_number_of_balloons('loonbalxballpoon'))
11+
12+
def test_default_three = assert_equal(0, max_number_of_balloons('leetcode'))
1313
end

test/easy/test_1200_minimum_absolute_difference.rb

+16-4
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,30 @@
55
require 'minitest/autorun'
66

77
class MinimumAbsoluteDifferenceTest < ::Minitest::Test
8-
def test_default
8+
def test_default_one
99
assert_equal(
1010
[[1, 2], [2, 3], [3, 4]],
11-
minimum_abs_difference([4, 2, 1, 3])
11+
minimum_abs_difference(
12+
[4, 2, 1, 3]
13+
)
1214
)
15+
end
16+
17+
def test_default_two
1318
assert_equal(
1419
[[1, 3]],
15-
minimum_abs_difference([1, 3, 6, 10, 15])
20+
minimum_abs_difference(
21+
[1, 3, 6, 10, 15]
22+
)
1623
)
24+
end
25+
26+
def test_default_three
1727
assert_equal(
1828
[[-14, -10], [19, 23], [23, 27]],
19-
minimum_abs_difference([3, 8, -10, 23, 19, -4, -14, 27])
29+
minimum_abs_difference(
30+
[3, 8, -10, 23, 19, -4, -14, 27]
31+
)
2032
)
2133
end
2234
end

test/easy/test_1207_unique_number_of_occurrences.rb

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

77
class UniqueNumberOfOccurrencesTest < ::Minitest::Test
8-
def test_default
9-
assert(unique_occurrences([1, 2, 2, 1, 1, 3]))
10-
assert(!unique_occurrences([1, 2]))
11-
assert(unique_occurrences([-3, 0, 1, -3, 1, 1, 1, -3, 10, 0]))
12-
end
8+
def test_default_one = assert(unique_occurrences([1, 2, 2, 1, 1, 3]))
9+
10+
def test_default_two = assert(!unique_occurrences([1, 2]))
11+
12+
def test_default_three = assert(unique_occurrences([-3, 0, 1, -3, 1, 1, 1, -3, 10, 0]))
1313
end

test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb

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

77
class MinimumCostToMoveChipsToTheSamePositionTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(1, min_cost_to_move_chips([1, 2, 3]))
10-
assert_equal(2, min_cost_to_move_chips([2, 2, 2, 3, 3]))
11-
assert_equal(1, min_cost_to_move_chips([1, 1, 1_000_000_000]))
12-
end
8+
def test_default_one = assert_equal(1, min_cost_to_move_chips([1, 2, 3]))
9+
10+
def test_default_two = assert_equal(2, min_cost_to_move_chips([2, 2, 2, 3, 3]))
11+
12+
def test_default_three = assert_equal(1, min_cost_to_move_chips([1, 1, 1_000_000_000]))
1313
end

0 commit comments

Comments
 (0)