Skip to content

Commit

Permalink
2024-08-20 v. 6.5.1: updated some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fartem committed Aug 20, 2024
1 parent 5657945 commit 72a7363
Show file tree
Hide file tree
Showing 132 changed files with 1,972 additions and 465 deletions.
14 changes: 12 additions & 2 deletions test/easy/test_1018_binary_prefix_divisible_by_5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@
require 'minitest/autorun'

class BinaryPrefixDivisibleBy5Test < ::Minitest::Test
def test_default_one = assert_equal([true, false, false], prefixes_div_by5([0, 1, 1]))
def test_default_one
assert_equal(
[true, false, false],
prefixes_div_by5([0, 1, 1])
)
end

def test_default_two = assert_equal([false, false, false], prefixes_div_by5([1, 1, 1]))
def test_default_two
assert_equal(
[false, false, false],
prefixes_div_by5([1, 1, 1])
)
end
end
21 changes: 18 additions & 3 deletions test/easy/test_1021_remove_outermost_parentheses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,24 @@
require 'minitest/autorun'

class RemoveOutermostParenthesesTest < ::Minitest::Test
def test_default_one = assert_equal('()()()', remove_outer_parentheses('(()())(())'))
def test_default_one
assert_equal(
'()()()',
remove_outer_parentheses('(()())(())')
)
end

def test_default_two = assert_equal('()()()()(())', remove_outer_parentheses('(()())(())(()(()))'))
def test_default_two
assert_equal(
'()()()()(())',
remove_outer_parentheses('(()())(())(()(()))')
)
end

def test_default_three = assert_equal('', remove_outer_parentheses('()()'))
def test_default_three
assert_equal(
'',
remove_outer_parentheses('()()')
)
end
end
10 changes: 8 additions & 2 deletions test/easy/test_1108_defanging_an_ip_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
class DefangingAnIPAddressTest < ::Minitest::Test
# rubocop:disable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses
def test_default_one
assert_equal('1[.]1[.]1[.]1', defang_i_paddr('1.1.1.1'))
assert_equal(
'1[.]1[.]1[.]1',
defang_i_paddr('1.1.1.1')
)
end

def test_default_two
assert_equal('255[.]100[.]50[.]0', defang_i_paddr('255.100.50.0'))
assert_equal(
'255[.]100[.]50[.]0',
defang_i_paddr('255.100.50.0')
)
end
# rubocop:enable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses
end
33 changes: 30 additions & 3 deletions test/easy/test_1184_distance_between_bus_stops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,36 @@
require 'minitest/autorun'

class DistanceBetweenBusStopsTest < ::Minitest::Test
def test_default_one = assert_equal(1, distance_between_bus_stops([1, 2, 3, 4], 0, 1))
def test_default_one
assert_equal(
1,
distance_between_bus_stops(
[1, 2, 3, 4],
0,
1
)
)
end

def test_default_two = assert_equal(3, distance_between_bus_stops([1, 2, 3, 4], 0, 2))
def test_default_two
assert_equal(
3,
distance_between_bus_stops(
[1, 2, 3, 4],
0,
2
)
)
end

def test_default_three = assert_equal(4, distance_between_bus_stops([1, 2, 3, 4], 0, 3))
def test_default_three
assert_equal(
4,
distance_between_bus_stops(
[1, 2, 3, 4],
0,
3
)
)
end
end
16 changes: 13 additions & 3 deletions test/easy/test_1200_minimum_absolute_difference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
class MinimumAbsoluteDifferenceTest < ::Minitest::Test
def test_default_one
assert_equal(
[[1, 2], [2, 3], [3, 4]],
[
[1, 2],
[2, 3],
[3, 4]
],
minimum_abs_difference(
[4, 2, 1, 3]
)
Expand All @@ -16,7 +20,9 @@ def test_default_one

def test_default_two
assert_equal(
[[1, 3]],
[
[1, 3]
],
minimum_abs_difference(
[1, 3, 6, 10, 15]
)
Expand All @@ -25,7 +31,11 @@ def test_default_two

def test_default_three
assert_equal(
[[-14, -10], [19, 23], [23, 27]],
[
[-14, -10],
[19, 23],
[23, 27]
],
minimum_abs_difference(
[3, 8, -10, 23, 19, -4, -14, 27]
)
Expand Down
24 changes: 21 additions & 3 deletions test/easy/test_1207_unique_number_of_occurrences.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,27 @@
require 'minitest/autorun'

class UniqueNumberOfOccurrencesTest < ::Minitest::Test
def test_default_one = assert(unique_occurrences([1, 2, 2, 1, 1, 3]))
def test_default_one
assert(
unique_occurrences(
[1, 2, 2, 1, 1, 3]
)
)
end

def test_default_two = assert(!unique_occurrences([1, 2]))
def test_default_two
assert(
!unique_occurrences(
[1, 2]
)
)
end

def test_default_three = assert(unique_occurrences([-3, 0, 1, -3, 1, 1, 1, -3, 10, 0]))
def test_default_three
assert(
unique_occurrences(
[-3, 0, 1, -3, 1, 1, 1, -3, 10, 0]
)
)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,30 @@
require 'minitest/autorun'

class MinimumCostToMoveChipsToTheSamePositionTest < ::Minitest::Test
def test_default_one = assert_equal(1, min_cost_to_move_chips([1, 2, 3]))
def test_default_one
assert_equal(
1,
min_cost_to_move_chips(
[1, 2, 3]
)
)
end

def test_default_two = assert_equal(2, min_cost_to_move_chips([2, 2, 2, 3, 3]))
def test_default_two
assert_equal(
2,
min_cost_to_move_chips(
[2, 2, 2, 3, 3]
)
)
end

def test_default_three = assert_equal(1, min_cost_to_move_chips([1, 1, 1_000_000_000]))
def test_default_three
assert_equal(
1,
min_cost_to_move_chips(
[1, 1, 1_000_000_000]
)
)
end
end
28 changes: 26 additions & 2 deletions test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,31 @@
require 'minitest/autorun'

class CellsWithOddValuesInAMatrixTest < ::Minitest::Test
def test_default_one = assert_equal(6, odd_cells(2, 3, [[0, 1], [1, 1]]))
def test_default_one
assert_equal(
6,
odd_cells(
2,
3,
[
[0, 1],
[1, 1]
]
)
)
end

def test_default_two = assert_equal(0, odd_cells(2, 2, [[1, 1], [0, 0]]))
def test_default_two
assert_equal(
0,
odd_cells(
2,
2,
[
[1, 1],
[0, 0]
]
)
)
end
end
11 changes: 9 additions & 2 deletions test/easy/test_1266_minimum_time_visiting_all_points.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ def test_default_one
assert_equal(
7,
min_time_to_visit_all_points(
[[1, 1], [3, 4], [-1, 0]]
[
[1, 1],
[3, 4],
[-1, 0]
]
)
)
end
Expand All @@ -18,7 +22,10 @@ def test_default_two
assert_equal(
5,
min_time_to_visit_all_points(
[[3, 2], [-2, 2]]
[
[3, 2],
[-2, 2]
]
)
)
end
Expand Down
18 changes: 16 additions & 2 deletions test/easy/test_1313_decompress_run_length_encoded_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,21 @@
require 'minitest/autorun'

class DecompressRunLengthEncodedListTest < ::Minitest::Test
def test_default_one = assert_equal([2, 4, 4, 4], decompress_rl_elist([1, 2, 3, 4]))
def test_default_one
assert_equal(
[2, 4, 4, 4],
decompress_rl_elist(
[1, 2, 3, 4]
)
)
end

def test_default_two = assert_equal([1, 3, 3], decompress_rl_elist([1, 1, 2, 3]))
def test_default_two
assert_equal(
[1, 3, 3],
decompress_rl_elist(
[1, 1, 2, 3]
)
)
end
end
19 changes: 17 additions & 2 deletions test/easy/test_1360_number_of_days_between_two_dates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
require 'minitest/autorun'

class NumberOfDaysBetweenTwoDatesTest < ::Minitest::Test
def test_default_one = assert_equal(1, days_between_dates('2019-06-29', '2019-06-30'))
def test_default_one
assert_equal(
1,
days_between_dates(
'2019-06-29',
'2019-06-30'
)
)
end

def test_default_two = assert_equal(15, days_between_dates('2020-01-15', '2019-12-31'))
def test_default_two
assert_equal(
15,
days_between_dates(
'2020-01-15', '2019-12-31'
)
)
end
end
18 changes: 16 additions & 2 deletions test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,21 @@
require 'minitest/autorun'

class MinimumSubsequenceInNonIncreasingOrderTest < ::Minitest::Test
def test_default_one = assert_equal([10, 9], min_subsequence([4, 3, 10, 9, 8]))
def test_default_one
assert_equal(
[10, 9],
min_subsequence(
[4, 3, 10, 9, 8]
)
)
end

def test_default_two = assert_equal([7, 7, 6], min_subsequence([4, 4, 7, 6, 7]))
def test_default_two
assert_equal(
[7, 7, 6],
min_subsequence(
[4, 4, 7, 6, 7]
)
)
end
end
27 changes: 24 additions & 3 deletions test/easy/test_1408_string_matching_in_an_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,30 @@
require 'minitest/autorun'

class StringMatchingInAnArrayTest < ::Minitest::Test
def test_default_one = assert_equal(%w[as hero], string_matching(%w[mass as hero superhero]))
def test_default_one
assert_equal(
%w[as hero],
string_matching(
%w[mass as hero superhero]
)
)
end

def test_default_two = assert_equal(%w[et code], string_matching(%w[leetcode et code]))
def test_default_two
assert_equal(
%w[et code],
string_matching(
%w[leetcode et code]
)
)
end

def test_default_three = assert_equal([], string_matching(%w[blue green bu]))
def test_default_three
assert_equal(
[],
string_matching(
%w[blue green bu]
)
)
end
end
Loading

0 comments on commit 72a7363

Please sign in to comment.