Skip to content

Commit 5657945

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

File tree

62 files changed

+584
-263
lines changed

Some content is hidden

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

62 files changed

+584
-263
lines changed

test/easy/test_1431_kids_with_the_greatest_number_of_candies.rb

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

77
class KidsWithTheGreatestNumberOfCandiesTest < ::Minitest::Test
8-
def test_default
9-
assert_equal([true, true, true, false, true], kids_with_candies([2, 3, 5, 1, 3], 3))
10-
assert_equal([true, false, false, false, false], kids_with_candies([4, 2, 1, 1, 2], 1))
11-
assert_equal([true, false, true], kids_with_candies([12, 1, 12], 10))
8+
def test_default_one
9+
assert_equal(
10+
[true, true, true, false, true],
11+
kids_with_candies(
12+
[2, 3, 5, 1, 3],
13+
3
14+
)
15+
)
16+
end
17+
18+
def test_default_two
19+
assert_equal(
20+
[true, false, false, false, false],
21+
kids_with_candies(
22+
[4, 2, 1, 1, 2],
23+
1
24+
)
25+
)
26+
end
27+
28+
def test_default_three
29+
assert_equal(
30+
[true, false, true],
31+
kids_with_candies(
32+
[12, 1, 12],
33+
10
34+
)
35+
)
1236
end
1337
end

test/easy/test_1436_destination_city.rb

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

77
class DestinationCityTest < ::Minitest::Test
8-
def test_default
8+
def test_default_one
99
assert_equal(
1010
'Sao Paulo',
11-
dest_city([['London', 'New York'], ['New York', 'Lima'], ['Lima', 'Sao Paulo']])
11+
dest_city(
12+
[
13+
['London', 'New York'],
14+
['New York', 'Lima'],
15+
['Lima', 'Sao Paulo']
16+
]
17+
)
18+
)
19+
end
20+
21+
def test_default_two
22+
assert_equal(
23+
'A',
24+
dest_city(
25+
[%w[B C], %w[D B], %w[C A]]
26+
)
27+
)
28+
end
29+
30+
def test_default_three
31+
assert_equal(
32+
'Z',
33+
dest_city(
34+
[%w[A Z]]
35+
)
1236
)
13-
assert_equal('A', dest_city([%w[B C], %w[D B], %w[C A]]))
14-
assert_equal('Z', dest_city([%w[A Z]]))
1537
end
1638
end

test/easy/test_1437_check_if_all_1s_are_at_least_length_k_places_away.rb

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

77
class CheckIfAll1sAreAtLeastLengthKPlacesAwayTest < ::Minitest::Test
8-
def test_default
9-
assert(k_length_apart([1, 0, 0, 0, 1, 0, 0, 1], 2))
10-
assert(!k_length_apart([1, 0, 0, 1, 0, 1], 2))
11-
end
8+
def test_default_one = assert(k_length_apart([1, 0, 0, 0, 1, 0, 0, 1], 2))
9+
10+
def test_default_two = assert(!k_length_apart([1, 0, 0, 1, 0, 1], 2))
1211
end

test/easy/test_1446_consecutive_characters.rb

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

77
class ConsecutiveCharactersTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(2, max_power('leetcode'))
10-
assert_equal(5, max_power('abbcccddddeeeeedcba'))
11-
end
8+
def test_default_one = assert_equal(2, max_power('leetcode'))
9+
10+
def test_default_two = assert_equal(5, max_power('abbcccddddeeeeedcba'))
1211
end

test/easy/test_1450_number_of_students_doing_homework_at_a_given_time.rb

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

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

test/easy/test_1455_check_if_a_word_occurs_as_a_prefix_of_any_word_in_a_sentence.rb

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

77
class CheckIfAWordOccursAsAPrefixOfAnyWordInASentenceTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(4, is_prefix_of_word('i love eating burger', 'burg'))
10-
assert_equal(2, is_prefix_of_word('this problem is an easy problem', 'pro'))
11-
assert_equal(-1, is_prefix_of_word('i am tired', 'you'))
8+
def test_default_one
9+
assert_equal(
10+
4,
11+
is_prefix_of_word(
12+
'i love eating burger',
13+
'burg'
14+
)
15+
)
16+
end
17+
18+
def test_default_two
19+
assert_equal(
20+
2,
21+
is_prefix_of_word(
22+
'this problem is an easy problem',
23+
'pro'
24+
)
25+
)
26+
end
27+
28+
def test_default_three
29+
assert_equal(
30+
-1,
31+
is_prefix_of_word(
32+
'i am tired',
33+
'you'
34+
)
35+
)
1236
end
1337
end

test/easy/test_1460_make_two_arrays_equal_by_reversing_subarrays.rb

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

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

test/easy/test_1464_maximum_product_of_two_elements_in_an_array.rb

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

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

test/easy/test_1470_shuffle_the_array.rb

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

77
class ShuffleTheArrayTest < ::Minitest::Test
8-
def test_default
9-
assert_equal([2, 3, 5, 4, 1, 7], shuffle([2, 5, 1, 3, 4, 7], 3))
10-
assert_equal([1, 4, 2, 3, 3, 2, 4, 1], shuffle([1, 2, 3, 4, 4, 3, 2, 1], 4))
11-
assert_equal([1, 2, 1, 2], shuffle([1, 1, 2, 2], 2))
8+
def test_default_one
9+
assert_equal(
10+
[2, 3, 5, 4, 1, 7],
11+
shuffle(
12+
[2, 5, 1, 3, 4, 7],
13+
3
14+
)
15+
)
16+
end
17+
18+
def test_default_two
19+
assert_equal(
20+
[1, 4, 2, 3, 3, 2, 4, 1],
21+
shuffle(
22+
[1, 2, 3, 4, 4, 3, 2, 1],
23+
4
24+
)
25+
)
26+
end
27+
28+
def test_default_three
29+
assert_equal(
30+
[1, 2, 1, 2],
31+
shuffle(
32+
[1, 1, 2, 2],
33+
2
34+
)
35+
)
1236
end
1337
end

test/easy/test_1475_final_prices_with_a_special_discount_in_a_shop.rb

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

77
class FinalPricesWithASpecialDiscountInAShopTest < ::Minitest::Test
8-
def test_default
9-
assert_equal([4, 2, 4, 2, 3], final_prices([8, 4, 6, 2, 3]))
10-
assert_equal([1, 2, 3, 4, 5], final_prices([1, 2, 3, 4, 5]))
11-
assert_equal([9, 0, 1, 6], final_prices([10, 1, 1, 6]))
8+
def test_default_one
9+
assert_equal(
10+
[4, 2, 4, 2, 3],
11+
final_prices(
12+
[8, 4, 6, 2, 3]
13+
)
14+
)
15+
end
16+
17+
def test_default_two
18+
assert_equal(
19+
[1, 2, 3, 4, 5],
20+
final_prices(
21+
[1, 2, 3, 4, 5]
22+
)
23+
)
24+
end
25+
26+
def test_default_three
27+
assert_equal(
28+
[9, 0, 1, 6],
29+
final_prices(
30+
[10, 1, 1, 6]
31+
)
32+
)
1233
end
1334
end

test/easy/test_1480_running_sum_of_1d_array.rb

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

77
class RunningSumOf1dArrayTest < ::Minitest::Test
8-
def test_default
9-
assert_equal([1, 3, 6, 10], running_sum([1, 2, 3, 4]))
10-
assert_equal([1, 2, 3, 4, 5], running_sum([1, 1, 1, 1, 1]))
11-
assert_equal([3, 4, 6, 16, 17], running_sum([3, 1, 2, 10, 1]))
8+
def test_default_one
9+
assert_equal(
10+
[1, 3, 6, 10],
11+
running_sum(
12+
[1, 2, 3, 4]
13+
)
14+
)
15+
end
16+
17+
def test_default_two
18+
assert_equal(
19+
[1, 2, 3, 4, 5],
20+
running_sum(
21+
[1, 1, 1, 1, 1]
22+
)
23+
)
24+
end
25+
26+
def test_default_three
27+
assert_equal(
28+
[3, 4, 6, 16, 17],
29+
running_sum(
30+
[3, 1, 2, 10, 1]
31+
)
32+
)
1233
end
1334
end

test/easy/test_1486_xor_operation_in_an_array.rb

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

77
class XOROperationInAnArrayTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(8, xor_operation(5, 0))
10-
assert_equal(8, xor_operation(4, 3))
11-
end
8+
def test_default_one = assert_equal(8, xor_operation(5, 0))
9+
10+
def test_default_two = assert_equal(8, xor_operation(4, 3))
1211
end

test/easy/test_1491_average_salary_excluding_the_minimum_and_maximum_salary.rb

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

77
class AverageSalaryExcludingTheMinimumAndMaximumSalaryTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(2500.00000, average([4000, 3000, 1000, 2000]))
10-
assert_equal(2000.00000, average([1000, 2000, 3000]))
8+
def test_default_one
9+
assert_equal(
10+
2500.00000,
11+
average(
12+
[4000, 3000, 1000, 2000]
13+
)
14+
)
15+
end
16+
17+
def test_default_two
18+
assert_equal(
19+
2000.00000,
20+
average(
21+
[1000, 2000, 3000]
22+
)
23+
)
1124
end
1225
end

test/easy/test_1496_path_crossing.rb

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

77
class PathCrossingTest < ::Minitest::Test
8-
def test_default
9-
assert(!is_path_crossing('NES'))
10-
assert(is_path_crossing('NESWW'))
11-
end
8+
def test_default_one = assert(!is_path_crossing('NES'))
9+
10+
def test_default_two = assert(is_path_crossing('NESWW'))
1211
end

test/easy/test_1502_can_make_arithmetic_progression_from_sequence.rb

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

77
class CanMakeArithmeticProgressionFromSequenceTest < ::Minitest::Test
8-
def test_default
9-
assert(can_make_arithmetic_progression([3, 5, 1]))
10-
assert(!can_make_arithmetic_progression([1, 2, 4]))
11-
end
8+
def test_default_one = assert(can_make_arithmetic_progression([3, 5, 1]))
9+
10+
def test_default_two = assert(!can_make_arithmetic_progression([1, 2, 4]))
1211
end

test/easy/test_1507_reformat_date.rb

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

77
class ReformatDateTest < ::Minitest::Test
8-
def test_default
9-
assert_equal('2052-10-20', reformat_date('20th Oct 2052'))
10-
assert_equal('1933-06-06', reformat_date('6th Jun 1933'))
11-
assert_equal('1960-05-26', reformat_date('26th May 1960'))
12-
end
8+
def test_default_one = assert_equal('2052-10-20', reformat_date('20th Oct 2052'))
9+
10+
def test_default_two = assert_equal('1933-06-06', reformat_date('6th Jun 1933'))
11+
12+
def test_default_three = assert_equal('1960-05-26', reformat_date('26th May 1960'))
1313
end

test/easy/test_1512_number_of_good_pairs.rb

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

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

test/easy/test_1518_water_bottles.rb

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

77
class WaterBottlesTest < ::Minitest::Test
8-
def test_default
9-
assert_equal(13, num_water_bottles(9, 3))
10-
assert_equal(19, num_water_bottles(15, 4))
11-
end
8+
def test_default_one = assert_equal(13, num_water_bottles(9, 3))
9+
10+
def test_default_two = assert_equal(19, num_water_bottles(15, 4))
1211
end

0 commit comments

Comments
 (0)