From c74b4f7de32236fd3af119f1599209e48eadb15c Mon Sep 17 00:00:00 2001 From: fartem Date: Tue, 20 Aug 2024 10:02:01 +0300 Subject: [PATCH 1/9] 2024-08-20 v. 6.5.1: updated some tests --- test/easy/test_100_same_tree.rb | 8 +++++- test/easy/test_101_symmetric_tree.rb | 5 +++- .../test_104_maximum_depth_of_binary_tree.rb | 5 +++- ...vert_sorted_array_to_binary_search_tree.rb | 9 +++++-- test/easy/test_110_balanced_binary_tree.rb | 8 ++++-- .../test_111_minimum_depth_of_binary_tree.rb | 5 +++- test/easy/test_112_path_sum.rb | 8 ++++-- test/easy/test_118_pascals_triangle.rb | 13 +++++++--- test/easy/test_119_pascals_triangle_ii.rb | 10 ++++---- ...est_121_best_time_to_buy_and_sell_stock.rb | 7 +++--- test/easy/test_125_valid_palindrome.rb | 10 ++++---- test/easy/test_136_single_number.rb | 10 ++++---- test/easy/test_13_roman_to_integer.rb | 10 ++++---- test/easy/test_141_linked_list_cycle.rb | 8 +++--- ...test_144_binary_tree_preorder_traversal.rb | 8 +++++- ...est_145_binary_tree_postorder_traversal.rb | 20 ++++++++++++--- test/easy/test_14_longest_common_prefix.rb | 7 +++--- ...st_160_intersection_of_two_linked_lists.rb | 6 ++++- .../easy/test_168_excel_sheet_column_title.rb | 10 ++++---- test/easy/test_169_majority_element.rb | 7 +++--- .../test_171_excel_sheet_column_number.rb | 10 ++++---- test/easy/test_190_reverse_bits.rb | 13 +++------- test/easy/test_191_number_of_1_bits.rb | 10 ++++---- test/easy/test_1_two_sum.rb | 10 ++++---- test/easy/test_202_happy_number.rb | 7 +++--- .../test_203_remove_linked_list_elements.rb | 16 +++++++++--- test/easy/test_205_isomorphic_strings.rb | 10 ++++---- test/easy/test_206_reverse_linked_list.rb | 20 +++++++++++---- test/easy/test_20_valid_parentheses.rb | 10 ++++---- test/easy/test_217_contains_duplicate.rb | 10 ++++---- test/easy/test_219_contains_duplicate_ii.rb | 10 ++++---- test/easy/test_21_merge_two_sorted_lists.rb | 10 +++++++- .../test_225_implement_stack_using_queues.rb | 2 +- test/easy/test_226_invert_binary_tree.rb | 8 ++++-- test/easy/test_228_summary_ranges.rb | 5 +++- test/easy/test_231_power_of_two.rb | 10 ++++---- .../test_232_implement_queue_using_stacks.rb | 3 ++- test/easy/test_234_palindrome_linked_list.rb | 7 +++--- test/easy/test_242_valid_anagram.rb | 7 +++--- test/easy/test_257_binary_tree_paths.rb | 5 +++- test/easy/test_258_add_digits.rb | 7 +++--- ..._26_remove_duplicates_from_sorted_array.rb | 4 ++- test/easy/test_27_remove_element.rb | 4 ++- ...dex_of_the_first_occurrence_in_a_string.rb | 7 +++--- test/easy/test_35_search_insert_position.rb | 10 ++++---- test/easy/test_58_length_of_last_word.rb | 10 ++++---- test/easy/test_66_plus_one.rb | 10 ++++---- test/easy/test_67_add_binary.rb | 7 +++--- test/easy/test_69_sqrtx.rb | 7 +++--- test/easy/test_70_climbing_stairs.rb | 7 +++--- ...t_83_remove_duplicates_from_sorted_list.rb | 25 +++++++++++++++---- test/easy/test_88_merge_sorted_array.rb | 6 ++++- .../test_94_binary_tree_inorder_traversal.rb | 8 +++++- test/easy/test_9_palindrome_number.rb | 10 ++++---- 54 files changed, 294 insertions(+), 185 deletions(-) diff --git a/test/easy/test_100_same_tree.rb b/test/easy/test_100_same_tree.rb index 3b93d31d..877c253e 100644 --- a/test/easy/test_100_same_tree.rb +++ b/test/easy/test_100_same_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class SameTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( is_same_tree( ::TreeNode.new( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert( !is_same_tree( ::TreeNode.new( @@ -32,6 +35,9 @@ def test_default ) ) ) + end + + def test_default_three assert( !is_same_tree( ::TreeNode.new( diff --git a/test/easy/test_101_symmetric_tree.rb b/test/easy/test_101_symmetric_tree.rb index c4e4d7fc..3aab789e 100644 --- a/test/easy/test_101_symmetric_tree.rb +++ b/test/easy/test_101_symmetric_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class SymmetricTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( is_symmetric( ::TreeNode.new( @@ -24,6 +24,9 @@ def test_default ) ) ) + end + + def test_default_two assert( !is_symmetric( ::TreeNode.new( diff --git a/test/easy/test_104_maximum_depth_of_binary_tree.rb b/test/easy/test_104_maximum_depth_of_binary_tree.rb index 799491fa..7678daa8 100644 --- a/test/easy/test_104_maximum_depth_of_binary_tree.rb +++ b/test/easy/test_104_maximum_depth_of_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class MaximumDepthOfBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 3, max_depth( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 2, max_depth( diff --git a/test/easy/test_108_convert_sorted_array_to_binary_search_tree.rb b/test/easy/test_108_convert_sorted_array_to_binary_search_tree.rb index 6f89c768..8297e77d 100644 --- a/test/easy/test_108_convert_sorted_array_to_binary_search_tree.rb +++ b/test/easy/test_108_convert_sorted_array_to_binary_search_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class ConvertSortedArrayToBinarySearchTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -27,6 +27,9 @@ def test_default ) ) ) + end + + def test_default_two assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -34,7 +37,9 @@ def test_default nil, ::TreeNode.new(3) ), - sorted_array_to_bst([1, 3]) + sorted_array_to_bst( + [1, 3] + ) ) ) end diff --git a/test/easy/test_110_balanced_binary_tree.rb b/test/easy/test_110_balanced_binary_tree.rb index 45a597d5..217fd32b 100644 --- a/test/easy/test_110_balanced_binary_tree.rb +++ b/test/easy/test_110_balanced_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class BalancedBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( is_balanced( ::TreeNode.new( @@ -20,6 +20,9 @@ def test_default ) ) ) + end + + def test_default_two assert( !is_balanced( ::TreeNode.new( @@ -37,6 +40,7 @@ def test_default ) ) ) - assert(is_balanced(nil)) end + + def test_default_three = assert(is_balanced(nil)) end diff --git a/test/easy/test_111_minimum_depth_of_binary_tree.rb b/test/easy/test_111_minimum_depth_of_binary_tree.rb index be859364..62cc12ca 100644 --- a/test/easy/test_111_minimum_depth_of_binary_tree.rb +++ b/test/easy/test_111_minimum_depth_of_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class MinimumDepthOfBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 2, min_depth( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 5, min_depth( diff --git a/test/easy/test_112_path_sum.rb b/test/easy/test_112_path_sum.rb index 8add1539..414e47d3 100644 --- a/test/easy/test_112_path_sum.rb +++ b/test/easy/test_112_path_sum.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class PathSumTest < ::Minitest::Test - def test_default + def test_default_one assert( has_path_sum( ::TreeNode.new( @@ -32,6 +32,9 @@ def test_default 22 ) ) + end + + def test_default_two assert( !has_path_sum( ::TreeNode.new( @@ -42,6 +45,7 @@ def test_default 5 ) ) - assert(!has_path_sum(nil, 0)) end + + def test_default_three = assert(!has_path_sum(nil, 0)) end diff --git a/test/easy/test_118_pascals_triangle.rb b/test/easy/test_118_pascals_triangle.rb index 1812c470..301ab706 100644 --- a/test/easy/test_118_pascals_triangle.rb +++ b/test/easy/test_118_pascals_triangle.rb @@ -5,11 +5,18 @@ require 'minitest/autorun' class PascalsTriangleTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]], + [ + [1], + [1, 1], + [1, 2, 1], + [1, 3, 3, 1], + [1, 4, 6, 4, 1] + ], generate(5) ) - assert_equal([[1]], generate(1)) end + + def test_default_two = assert_equal([[1]], generate(1)) end diff --git a/test/easy/test_119_pascals_triangle_ii.rb b/test/easy/test_119_pascals_triangle_ii.rb index b8e2bb5b..3f0e6c0a 100644 --- a/test/easy/test_119_pascals_triangle_ii.rb +++ b/test/easy/test_119_pascals_triangle_ii.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class PascalsTriangleIITest < ::Minitest::Test - def test_default - assert_equal([1, 3, 3, 1], get_row(3)) - assert_equal([1], get_row(0)) - assert_equal([1, 1], get_row(1)) - end + def test_default_one = assert_equal([1, 3, 3, 1], get_row(3)) + + def test_default_two = assert_equal([1], get_row(0)) + + def test_default_three = assert_equal([1, 1], get_row(1)) end diff --git a/test/easy/test_121_best_time_to_buy_and_sell_stock.rb b/test/easy/test_121_best_time_to_buy_and_sell_stock.rb index 83fc101c..20fdb869 100644 --- a/test/easy/test_121_best_time_to_buy_and_sell_stock.rb +++ b/test/easy/test_121_best_time_to_buy_and_sell_stock.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class BestTimeToBuyAndSellStockTest < ::Minitest::Test - def test_default - assert_equal(5, max_profit([7, 1, 5, 3, 6, 4])) - assert_equal(0, max_profit([7, 6, 4, 3, 1])) - end + def test_default_one = assert_equal(5, max_profit([7, 1, 5, 3, 6, 4])) + + def test_default_two = assert_equal(0, max_profit([7, 6, 4, 3, 1])) end diff --git a/test/easy/test_125_valid_palindrome.rb b/test/easy/test_125_valid_palindrome.rb index 06b6c5a3..ab89cd7f 100644 --- a/test/easy/test_125_valid_palindrome.rb +++ b/test/easy/test_125_valid_palindrome.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ValidPalindromeTest < ::Minitest::Test - def test_default - assert(is_valid_palindrome('A man, a plan, a canal: Panama')) - assert(!is_valid_palindrome('race a car')) - assert(is_valid_palindrome(' ')) - end + def test_default_one = assert(is_valid_palindrome('A man, a plan, a canal: Panama')) + + def test_default_two = assert(!is_valid_palindrome('race a car')) + + def test_default_three = assert(is_valid_palindrome(' ')) end diff --git a/test/easy/test_136_single_number.rb b/test/easy/test_136_single_number.rb index 9a3ae5cd..bc9c9c3d 100644 --- a/test/easy/test_136_single_number.rb +++ b/test/easy/test_136_single_number.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class SingleNumberTest < ::Minitest::Test - def test_default - assert_equal(1, single_number([2, 2, 1])) - assert_equal(4, single_number([4, 1, 2, 1, 2])) - assert_equal(1, single_number([1])) - end + def test_default_one = assert_equal(1, single_number([2, 2, 1])) + + def test_default_two = assert_equal(4, single_number([4, 1, 2, 1, 2])) + + def test_default_three = assert_equal(1, single_number([1])) end diff --git a/test/easy/test_13_roman_to_integer.rb b/test/easy/test_13_roman_to_integer.rb index 1172b751..a94b22b8 100644 --- a/test/easy/test_13_roman_to_integer.rb +++ b/test/easy/test_13_roman_to_integer.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class RomanToIntegerTest < ::Minitest::Test - def test_default - assert_equal(3, roman_to_int('III')) - assert_equal(58, roman_to_int('LVIII')) - assert_equal(1994, roman_to_int('MCMXCIV')) - end + def test_default_one = assert_equal(3, roman_to_int('III')) + + def test_default_two = assert_equal(58, roman_to_int('LVIII')) + + def test_default_three = assert_equal(1994, roman_to_int('MCMXCIV')) end diff --git a/test/easy/test_141_linked_list_cycle.rb b/test/easy/test_141_linked_list_cycle.rb index 31bf607a..2a9e3739 100644 --- a/test/easy/test_141_linked_list_cycle.rb +++ b/test/easy/test_141_linked_list_cycle.rb @@ -6,19 +6,21 @@ require 'minitest/autorun' class LinkedListCycleTest < ::Minitest::Test - def test_default + def test_default_one fourth = ::ListNode.new(-4) third = ::ListNode.new(0, fourth) second = ::ListNode.new(2, third) first = ::ListNode.new(3, second) fourth.next = second assert(has_cycle(first)) + end + def test_default_two second = ::ListNode.new(2) first = ::ListNode.new(1, second) second.next = first assert(has_cycle(first)) - - assert(!has_cycle(::ListNode.new(1))) end + + def test_default_three = assert(!has_cycle(::ListNode.new(1))) end diff --git a/test/easy/test_144_binary_tree_preorder_traversal.rb b/test/easy/test_144_binary_tree_preorder_traversal.rb index 405af619..6f032e28 100644 --- a/test/easy/test_144_binary_tree_preorder_traversal.rb +++ b/test/easy/test_144_binary_tree_preorder_traversal.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class BinaryTreePreorderTraversalTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [1, 2, 3], preorder_traversal( @@ -20,10 +20,16 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( [], preorder_traversal(nil) ) + end + + def test_default_three assert_equal( [1], preorder_traversal( diff --git a/test/easy/test_145_binary_tree_postorder_traversal.rb b/test/easy/test_145_binary_tree_postorder_traversal.rb index d53b2862..f929dd39 100644 --- a/test/easy/test_145_binary_tree_postorder_traversal.rb +++ b/test/easy/test_145_binary_tree_postorder_traversal.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class BinaryTreePostorderTraversalTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [3, 2, 1], postorder_traversal( @@ -20,7 +20,21 @@ def test_default ) ) ) - assert_equal([], postorder_traversal(nil)) - assert_equal([1], postorder_traversal(::TreeNode.new(1))) + end + + def test_default_two + assert_equal( + [], + postorder_traversal(nil) + ) + end + + def test_default_three + assert_equal( + [1], + postorder_traversal( + ::TreeNode.new(1) + ) + ) end end diff --git a/test/easy/test_14_longest_common_prefix.rb b/test/easy/test_14_longest_common_prefix.rb index f5009c40..19fe0e89 100644 --- a/test/easy/test_14_longest_common_prefix.rb +++ b/test/easy/test_14_longest_common_prefix.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class LongestCommonPrefixTest < ::Minitest::Test - def test_default - assert('fl', longest_common_prefix(%w[flower flow flight])) - assert(longest_common_prefix(%w[dog racecar car]).empty?) - end + def test_default_one = assert('fl', longest_common_prefix(%w[flower flow flight])) + + def test_default_two = assert(longest_common_prefix(%w[dog racecar car]).empty?) end diff --git a/test/easy/test_160_intersection_of_two_linked_lists.rb b/test/easy/test_160_intersection_of_two_linked_lists.rb index 7db7d5f3..c4d07a72 100644 --- a/test/easy/test_160_intersection_of_two_linked_lists.rb +++ b/test/easy/test_160_intersection_of_two_linked_lists.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class IntersectionOfTwoLinkedListsTest < ::Minitest::Test - def test_default + def test_default_one intersection = ::ListNode.from_array([8, 4, 5]) head_a = ::ListNode.from_array([4, 1]) head_a.next = intersection @@ -19,7 +19,9 @@ def test_default head_b ) ) + end + def test_default_two intersection = ::ListNode.from_array([2, 4]) head_a = ::ListNode.from_array([1, 9, 1]) head_a.next = intersection @@ -32,7 +34,9 @@ def test_default head_b ) ) + end + def test_default_three assert_nil( get_intersection_node( ::ListNode.from_array([2, 6, 4]), diff --git a/test/easy/test_168_excel_sheet_column_title.rb b/test/easy/test_168_excel_sheet_column_title.rb index ee2486bb..2b793eff 100644 --- a/test/easy/test_168_excel_sheet_column_title.rb +++ b/test/easy/test_168_excel_sheet_column_title.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ExcelSheetColumnTitleTest < ::Minitest::Test - def test_default - assert_equal('A', convert_to_title(1)) - assert_equal('AB', convert_to_title(28)) - assert_equal('ZY', convert_to_title(701)) - end + def test_default_one = assert_equal('A', convert_to_title(1)) + + def test_default_two = assert_equal('AB', convert_to_title(28)) + + def test_default_three = assert_equal('ZY', convert_to_title(701)) end diff --git a/test/easy/test_169_majority_element.rb b/test/easy/test_169_majority_element.rb index cfbc718b..fc964f0e 100644 --- a/test/easy/test_169_majority_element.rb +++ b/test/easy/test_169_majority_element.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class MajorityElementTest < ::Minitest::Test - def test_default - assert_equal(3, majority_element([3, 2, 3])) - assert_equal(2, majority_element([2, 2, 1, 1, 1, 2, 2])) - end + def test_default_one = assert_equal(3, majority_element([3, 2, 3])) + + def test_default_two = assert_equal(2, majority_element([2, 2, 1, 1, 1, 2, 2])) end diff --git a/test/easy/test_171_excel_sheet_column_number.rb b/test/easy/test_171_excel_sheet_column_number.rb index fac3aa70..f5901b8c 100644 --- a/test/easy/test_171_excel_sheet_column_number.rb +++ b/test/easy/test_171_excel_sheet_column_number.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ExcelSheetColumnNumberTest < ::Minitest::Test - def test_default - assert_equal(1, title_to_number('A')) - assert_equal(28, title_to_number('AB')) - assert_equal(701, title_to_number('ZY')) - end + def test_default_one = assert_equal(1, title_to_number('A')) + + def test_default_two = assert_equal(28, title_to_number('AB')) + + def test_default_three = assert_equal(701, title_to_number('ZY')) end diff --git a/test/easy/test_190_reverse_bits.rb b/test/easy/test_190_reverse_bits.rb index 82c8e7f9..75dc7ffb 100644 --- a/test/easy/test_190_reverse_bits.rb +++ b/test/easy/test_190_reverse_bits.rb @@ -5,14 +5,7 @@ require 'minitest/autorun' class ReverseBitsTest < ::Minitest::Test - def test_default - assert_equal( - 964_176_192, - reverse_bits(43_261_596) - ) - assert_equal( - 3_221_225_471, - reverse_bits(4_294_967_293) - ) - end + def test_default_one = assert_equal(964_176_192, reverse_bits(43_261_596)) + + def test_default_two = assert_equal(3_221_225_471, reverse_bits(4_294_967_293)) end diff --git a/test/easy/test_191_number_of_1_bits.rb b/test/easy/test_191_number_of_1_bits.rb index 851ebf11..30ad71e9 100644 --- a/test/easy/test_191_number_of_1_bits.rb +++ b/test/easy/test_191_number_of_1_bits.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class NumberOf1BitsTest < ::Minitest::Test - def test_default - assert_equal(3, hamming_weight(11)) - assert_equal(1, hamming_weight(128)) - assert_equal(31, hamming_weight(4_294_967_293)) - end + def test_default_one = assert_equal(3, hamming_weight(11)) + + def test_default_two = assert_equal(1, hamming_weight(128)) + + def test_default_three = assert_equal(31, hamming_weight(4_294_967_293)) end diff --git a/test/easy/test_1_two_sum.rb b/test/easy/test_1_two_sum.rb index a5c5b2ea..54a5d6e9 100644 --- a/test/easy/test_1_two_sum.rb +++ b/test/easy/test_1_two_sum.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class TwoSumTest < ::Minitest::Test - def test_default - assert_equal([0, 1], two_sum([2, 7, 11, 15], 9)) - assert_equal([1, 2], two_sum([3, 2, 4], 6)) - assert_equal([0, 1], two_sum([3, 3], 6)) - end + def test_default_one = assert_equal([0, 1], two_sum([2, 7, 11, 15], 9)) + + def test_default_two = assert_equal([1, 2], two_sum([3, 2, 4], 6)) + + def test_default_three = assert_equal([0, 1], two_sum([3, 3], 6)) end diff --git a/test/easy/test_202_happy_number.rb b/test/easy/test_202_happy_number.rb index 7776b149..d7b89c99 100644 --- a/test/easy/test_202_happy_number.rb +++ b/test/easy/test_202_happy_number.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class HappyNumberTest < ::Minitest::Test - def test_default - assert(is_happy(19)) - assert(!is_happy(2)) - end + def test_default_one = assert(is_happy(19)) + + def test_default_two = assert(!is_happy(2)) end diff --git a/test/easy/test_203_remove_linked_list_elements.rb b/test/easy/test_203_remove_linked_list_elements.rb index 2eaebd62..5078ce6c 100644 --- a/test/easy/test_203_remove_linked_list_elements.rb +++ b/test/easy/test_203_remove_linked_list_elements.rb @@ -6,17 +6,25 @@ require 'minitest/autorun' class RemoveLinkedListElementsTest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( - ::ListNode.from_array([1, 2, 3, 4, 5]), + ::ListNode.from_array( + [1, 2, 3, 4, 5] + ), remove_elements( - ::ListNode.from_array([1, 2, 6, 3, 4, 5, 6]), + ::ListNode.from_array( + [1, 2, 6, 3, 4, 5, 6] + ), 6 ) ) ) - assert_nil(remove_elements(nil, 1)) + end + + def test_default_two = assert_nil(remove_elements(nil, 1)) + + def test_default_three assert_nil( remove_elements( ::ListNode.from_array( diff --git a/test/easy/test_205_isomorphic_strings.rb b/test/easy/test_205_isomorphic_strings.rb index 19f78f4f..5b282560 100644 --- a/test/easy/test_205_isomorphic_strings.rb +++ b/test/easy/test_205_isomorphic_strings.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class IsomorphicStringsTest < ::Minitest::Test - def test_default - assert(is_isomorphic('egg', 'add')) - assert(!is_isomorphic('foo', 'bar')) - assert(is_isomorphic('paper', 'title')) - end + def test_default_one = assert(is_isomorphic('egg', 'add')) + + def test_default_two = assert(!is_isomorphic('foo', 'bar')) + + def test_default_three = assert(is_isomorphic('paper', 'title')) end diff --git a/test/easy/test_206_reverse_linked_list.rb b/test/easy/test_206_reverse_linked_list.rb index aaad1eb1..5dad0112 100644 --- a/test/easy/test_206_reverse_linked_list.rb +++ b/test/easy/test_206_reverse_linked_list.rb @@ -6,21 +6,31 @@ require 'minitest/autorun' class ReverseLinkedListTest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( - ::ListNode.from_array([5, 4, 3, 2, 1]), + ::ListNode.from_array( + [5, 4, 3, 2, 1] + ), reverse_list( - ::ListNode.from_array([1, 2, 3, 4, 5]) + ::ListNode.from_array( + [1, 2, 3, 4, 5] + ) ) ) ) + end + + def test_default_two assert( ::ListNode.are_equals( ::ListNode.from_array([2, 1]), - reverse_list(::ListNode.from_array([1, 2])) + reverse_list( + ::ListNode.from_array([1, 2]) + ) ) ) - assert_nil(reverse_list(nil)) end + + def test_default_three = assert_nil(reverse_list(nil)) end diff --git a/test/easy/test_20_valid_parentheses.rb b/test/easy/test_20_valid_parentheses.rb index ccc1b28e..263533c9 100644 --- a/test/easy/test_20_valid_parentheses.rb +++ b/test/easy/test_20_valid_parentheses.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ValidParenthesesTest < ::Minitest::Test - def test_default - assert(is_valid('()')) - assert(is_valid('()[]{}')) - assert(!is_valid('(]')) - end + def test_default = assert(is_valid('()')) + + def test_default_two = assert(is_valid('()[]{}')) + + def test_default_three =assert(!is_valid('(]')) end diff --git a/test/easy/test_217_contains_duplicate.rb b/test/easy/test_217_contains_duplicate.rb index ead34342..2346f45f 100644 --- a/test/easy/test_217_contains_duplicate.rb +++ b/test/easy/test_217_contains_duplicate.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ContainsDuplicateTest < ::Minitest::Test - def test_default - assert(contains_duplicate([1, 2, 3, 1])) - assert(!contains_duplicate([1, 2, 3, 4])) - assert(contains_duplicate([1, 1, 1, 3, 3, 4, 3, 2, 4, 2])) - end + def test_default_one = assert(contains_duplicate([1, 2, 3, 1])) + + def test_default_two = assert(!contains_duplicate([1, 2, 3, 4])) + + def test_default_three = assert(contains_duplicate([1, 1, 1, 3, 3, 4, 3, 2, 4, 2])) end diff --git a/test/easy/test_219_contains_duplicate_ii.rb b/test/easy/test_219_contains_duplicate_ii.rb index ec81407b..9bbd0ccd 100644 --- a/test/easy/test_219_contains_duplicate_ii.rb +++ b/test/easy/test_219_contains_duplicate_ii.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ContainsDuplicateIITest < ::Minitest::Test - def test_default - assert(contains_nearby_duplicate([1, 2, 3, 1], 3)) - assert(contains_nearby_duplicate([1, 0, 1, 1], 1)) - assert(!contains_nearby_duplicate([1, 2, 3, 1, 2, 3], 2)) - end + def test_default_one = assert(contains_nearby_duplicate([1, 2, 3, 1], 3)) + + def test_default_two = assert(contains_nearby_duplicate([1, 0, 1, 1], 1)) + + def test_default_three = assert(!contains_nearby_duplicate([1, 2, 3, 1, 2, 3], 2)) end diff --git a/test/easy/test_21_merge_two_sorted_lists.rb b/test/easy/test_21_merge_two_sorted_lists.rb index 4c441611..22aa4f97 100644 --- a/test/easy/test_21_merge_two_sorted_lists.rb +++ b/test/easy/test_21_merge_two_sorted_lists.rb @@ -8,19 +8,27 @@ class MergeTwoSortedListsTest < ::Minitest::Test def test_default assert( ::ListNode.are_equals( - ::ListNode.from_array([1, 1, 2, 3, 4, 4]), + ::ListNode.from_array( + [1, 1, 2, 3, 4, 4] + ), merge_two_lists( ::ListNode.from_array([1, 2, 4]), ::ListNode.from_array([1, 3, 4]) ) ) ) + end + + def test_default_two assert( merge_two_lists( ::ListNode.from_array([]), ::ListNode.from_array([]) ).nil? ) + end + + def test_default_three assert( ::ListNode.are_equals( ::ListNode.from_array([0]), diff --git a/test/easy/test_225_implement_stack_using_queues.rb b/test/easy/test_225_implement_stack_using_queues.rb index e9fc7c89..6b9cc840 100644 --- a/test/easy/test_225_implement_stack_using_queues.rb +++ b/test/easy/test_225_implement_stack_using_queues.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class ImplementStackUsingQueuesTest < ::Minitest::Test - def test_default + def test_default_one my_stack = ::MyStack.new my_stack.push(1) my_stack.push(2) diff --git a/test/easy/test_226_invert_binary_tree.rb b/test/easy/test_226_invert_binary_tree.rb index 1087cefb..a61c0c78 100644 --- a/test/easy/test_226_invert_binary_tree.rb +++ b/test/easy/test_226_invert_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class InvertBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -39,6 +39,9 @@ def test_default ) ) ) + end + + def test_default_two assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -55,6 +58,7 @@ def test_default ) ) ) - assert_nil(invert_tree(nil)) end + + def test_default_three = assert_nil(invert_tree(nil)) end diff --git a/test/easy/test_228_summary_ranges.rb b/test/easy/test_228_summary_ranges.rb index 2b147119..a8643513 100644 --- a/test/easy/test_228_summary_ranges.rb +++ b/test/easy/test_228_summary_ranges.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class SummaryRangesTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( %w[0->2 4->5 7], summary_ranges( [0, 1, 2, 4, 5, 7] ) ) + end + + def test_default_two assert_equal( %w[0 2->4 6 8->9], summary_ranges( diff --git a/test/easy/test_231_power_of_two.rb b/test/easy/test_231_power_of_two.rb index 8feb8ea1..93c93ced 100644 --- a/test/easy/test_231_power_of_two.rb +++ b/test/easy/test_231_power_of_two.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class PowerOfTwoTest < ::Minitest::Test - def test_default - assert(is_power_of_two(1)) - assert(is_power_of_two(16)) - assert(!is_power_of_two(3)) - end + def test_default_one = assert(is_power_of_two(1)) + + def test_default_two = assert(is_power_of_two(16)) + + def test_default_three = assert(!is_power_of_two(3)) end diff --git a/test/easy/test_232_implement_queue_using_stacks.rb b/test/easy/test_232_implement_queue_using_stacks.rb index c8311465..acfb3649 100644 --- a/test/easy/test_232_implement_queue_using_stacks.rb +++ b/test/easy/test_232_implement_queue_using_stacks.rb @@ -5,10 +5,11 @@ require 'minitest/autorun' class ImplementQueueUsingStacksTest < ::Minitest::Test - def test_default + def test_default_one my_queue = ::MyQueue.new my_queue.push(1) my_queue.push(2) + assert_equal(1, my_queue.peek) assert_equal(1, my_queue.pop) assert(!my_queue.empty) diff --git a/test/easy/test_234_palindrome_linked_list.rb b/test/easy/test_234_palindrome_linked_list.rb index 4a4736aa..bab41d74 100644 --- a/test/easy/test_234_palindrome_linked_list.rb +++ b/test/easy/test_234_palindrome_linked_list.rb @@ -6,8 +6,7 @@ require 'minitest/autorun' class PalindromeLinkedListTest < ::Minitest::Test - def test_default - assert(is_palindrome_ll(::ListNode.from_array([1, 2, 2, 1]))) - assert(!is_palindrome_ll(::ListNode.from_array([1, 2]))) - end + def test_default_one = assert(is_palindrome_ll(::ListNode.from_array([1, 2, 2, 1]))) + + def test_default_two = assert(!is_palindrome_ll(::ListNode.from_array([1, 2]))) end diff --git a/test/easy/test_242_valid_anagram.rb b/test/easy/test_242_valid_anagram.rb index b8340635..93b0978c 100644 --- a/test/easy/test_242_valid_anagram.rb +++ b/test/easy/test_242_valid_anagram.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ValidAnagramTest < ::Minitest::Test - def test_default - assert(is_anagram('anagram', 'nagaram')) - assert(!is_anagram('rat', 'car')) - end + def test_default_one = assert(is_anagram('anagram', 'nagaram')) + + def test_default_two = assert(!is_anagram('rat', 'car')) end diff --git a/test/easy/test_257_binary_tree_paths.rb b/test/easy/test_257_binary_tree_paths.rb index 523250a8..e2152e70 100644 --- a/test/easy/test_257_binary_tree_paths.rb +++ b/test/easy/test_257_binary_tree_paths.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class BinaryTreePathsTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( %w[1->2->5 1->3], binary_tree_paths( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( ['1'], binary_tree_paths( diff --git a/test/easy/test_258_add_digits.rb b/test/easy/test_258_add_digits.rb index 1de76b6c..b2e38a12 100644 --- a/test/easy/test_258_add_digits.rb +++ b/test/easy/test_258_add_digits.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class AddDigitsTest < ::Minitest::Test - def test_default - assert_equal(2, add_digits(38)) - assert_equal(0, add_digits(0)) - end + def test_default_one = assert_equal(2, add_digits(38)) + + def test_default_two = assert_equal(0, add_digits(0)) end diff --git a/test/easy/test_26_remove_duplicates_from_sorted_array.rb b/test/easy/test_26_remove_duplicates_from_sorted_array.rb index 22571538..c23b1917 100644 --- a/test/easy/test_26_remove_duplicates_from_sorted_array.rb +++ b/test/easy/test_26_remove_duplicates_from_sorted_array.rb @@ -5,11 +5,13 @@ require 'minitest/autorun' class RemoveDuplicatesFromSortedArrayTest < ::Minitest::Test - def test_default + def test_default_one arr = [1, 1, 2] assert_equal(2, remove_duplicates(arr)) assert_equal([1, 2], arr.take(2)) + end + def test_default_two arr = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4] assert_equal(5, remove_duplicates(arr)) assert_equal([0, 1, 2, 3, 4], arr.take(5)) diff --git a/test/easy/test_27_remove_element.rb b/test/easy/test_27_remove_element.rb index 561e2396..836adae6 100644 --- a/test/easy/test_27_remove_element.rb +++ b/test/easy/test_27_remove_element.rb @@ -5,11 +5,13 @@ require 'minitest/autorun' class RemoveElementTest < ::Minitest::Test - def test_default + def test_default_one arr = [3, 2, 2, 3] assert_equal(2, remove_element(arr, 3)) assert_equal([2, 2], arr.take(2)) + end + def test_default_two arr = [0, 1, 2, 2, 3, 0, 4, 2] assert_equal(5, remove_element(arr, 2)) assert_equal([0, 1, 3, 0, 4], arr.take(5)) diff --git a/test/easy/test_28_find_the_index_of_the_first_occurrence_in_a_string.rb b/test/easy/test_28_find_the_index_of_the_first_occurrence_in_a_string.rb index 54d63e0a..eb5d71c0 100644 --- a/test/easy/test_28_find_the_index_of_the_first_occurrence_in_a_string.rb +++ b/test/easy/test_28_find_the_index_of_the_first_occurrence_in_a_string.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class FindTheIndexOfTheFirstOccurrenceInAStringTest < ::Minitest::Test - def test_default - assert(str_str('sadbutsad', 'sad').zero?) - assert_equal(-1, str_str('leetcode', 'leeto')) - end + def test_default_one = assert(str_str('sadbutsad', 'sad').zero?) + + def test_default_two = assert_equal(-1, str_str('leetcode', 'leeto')) end diff --git a/test/easy/test_35_search_insert_position.rb b/test/easy/test_35_search_insert_position.rb index 6da78ee2..eef64a63 100644 --- a/test/easy/test_35_search_insert_position.rb +++ b/test/easy/test_35_search_insert_position.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class SearchInsertPositionTest < ::Minitest::Test - def test_default - assert_equal(2, search_insert([1, 3, 5, 6], 5)) - assert_equal(1, search_insert([1, 3, 5, 6], 2)) - assert_equal(4, search_insert([1, 3, 5, 6], 7)) - end + def test_default_one = assert_equal(2, search_insert([1, 3, 5, 6], 5)) + + def test_default_two = assert_equal(1, search_insert([1, 3, 5, 6], 2)) + + def test_default_three = assert_equal(4, search_insert([1, 3, 5, 6], 7)) end diff --git a/test/easy/test_58_length_of_last_word.rb b/test/easy/test_58_length_of_last_word.rb index f302e75b..28f6b03b 100644 --- a/test/easy/test_58_length_of_last_word.rb +++ b/test/easy/test_58_length_of_last_word.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class LengthOfLastWordTest < ::Minitest::Test - def test_default - assert_equal(5, length_of_last_word('Hello World')) - assert_equal(4, length_of_last_word(' fly me to the moon ')) - assert_equal(6, length_of_last_word('luffy is still joyboy')) - end + def test_default_one = assert_equal(5, length_of_last_word('Hello World')) + + def test_default_two = assert_equal(4, length_of_last_word(' fly me to the moon ')) + + def test_default_three = assert_equal(6, length_of_last_word('luffy is still joyboy')) end diff --git a/test/easy/test_66_plus_one.rb b/test/easy/test_66_plus_one.rb index 5d9b8374..4bc3f9bb 100644 --- a/test/easy/test_66_plus_one.rb +++ b/test/easy/test_66_plus_one.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class PlusOneTest < ::Minitest::Test - def test_default - assert_equal([1, 2, 4], plus_one([1, 2, 3])) - assert_equal([4, 3, 2, 2], plus_one([4, 3, 2, 1])) - assert_equal([1, 0], plus_one([9])) - end + def test_default_one = assert_equal([1, 2, 4], plus_one([1, 2, 3])) + + def test_default_two = assert_equal([4, 3, 2, 2], plus_one([4, 3, 2, 1])) + + def test_default_three = assert_equal([1, 0], plus_one([9])) end diff --git a/test/easy/test_67_add_binary.rb b/test/easy/test_67_add_binary.rb index d2fcd917..001b2202 100644 --- a/test/easy/test_67_add_binary.rb +++ b/test/easy/test_67_add_binary.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class AddBinaryTest < ::Minitest::Test - def test_default - assert_equal('100', add_binary('11', '1')) - assert_equal('10101', add_binary('1010', '1011')) - end + def test_default_one = assert_equal('100', add_binary('11', '1')) + + def test_default_two = assert_equal('10101', add_binary('1010', '1011')) end diff --git a/test/easy/test_69_sqrtx.rb b/test/easy/test_69_sqrtx.rb index 885e3382..a3f8eb6a 100644 --- a/test/easy/test_69_sqrtx.rb +++ b/test/easy/test_69_sqrtx.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class SqrtXTest < ::Minitest::Test - def test_default - assert_equal(2, my_sqrt(4)) - assert_equal(2, my_sqrt(8)) - end + def test_default_one = assert_equal(2, my_sqrt(4)) + + def test_default_two = assert_equal(2, my_sqrt(8)) end diff --git a/test/easy/test_70_climbing_stairs.rb b/test/easy/test_70_climbing_stairs.rb index a3f05a0b..e093b85d 100644 --- a/test/easy/test_70_climbing_stairs.rb +++ b/test/easy/test_70_climbing_stairs.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ClimbingStairsTest < ::Minitest::Test - def test_default - assert_equal(2, climb_stairs(2)) - assert_equal(3, climb_stairs(3)) - end + def test_default_one = assert_equal(2, climb_stairs(2)) + + def test_default_two = assert_equal(3, climb_stairs(3)) end diff --git a/test/easy/test_83_remove_duplicates_from_sorted_list.rb b/test/easy/test_83_remove_duplicates_from_sorted_list.rb index ba9ce423..8c6fcdf6 100644 --- a/test/easy/test_83_remove_duplicates_from_sorted_list.rb +++ b/test/easy/test_83_remove_duplicates_from_sorted_list.rb @@ -6,17 +6,32 @@ require 'minitest/autorun' class RemoveDuplicatesFromSortedListTest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( - ::ListNode.from_array([1, 2]), - delete_duplicates(::ListNode.from_array([1, 1, 2])) + ::ListNode.from_array( + [1, 2] + ), + delete_duplicates( + ::ListNode.from_array( + [1, 1, 2] + ) + ) ) ) + end + + def test_default_two assert( ::ListNode.are_equals( - ::ListNode.from_array([1, 2, 3]), - delete_duplicates(::ListNode.from_array([1, 1, 2, 3, 3])) + ::ListNode.from_array( + [1, 2, 3] + ), + delete_duplicates( + ::ListNode.from_array( + [1, 1, 2, 3, 3] + ) + ) ) ) end diff --git a/test/easy/test_88_merge_sorted_array.rb b/test/easy/test_88_merge_sorted_array.rb index 5821ed1f..b85cce60 100644 --- a/test/easy/test_88_merge_sorted_array.rb +++ b/test/easy/test_88_merge_sorted_array.rb @@ -5,15 +5,19 @@ require 'minitest/autorun' class MergeSortedArrayTest < ::Minitest::Test - def test_default + def test_default_one arr = [1, 2, 3, 0, 0, 0] merge(arr, 3, [2, 5, 6], 3) assert_equal([1, 2, 2, 3, 5, 6], arr) + end + def test_default_two arr = [1] merge(arr, 1, [], 0) assert_equal([1], arr) + end + def test_default_three arr = [] merge(arr, 0, [1], 1) assert_equal([1], arr) diff --git a/test/easy/test_94_binary_tree_inorder_traversal.rb b/test/easy/test_94_binary_tree_inorder_traversal.rb index 84ef9600..4cdc0721 100644 --- a/test/easy/test_94_binary_tree_inorder_traversal.rb +++ b/test/easy/test_94_binary_tree_inorder_traversal.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class BinaryTreeInorderTraversalTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [1, 3, 2], inorder_traversal( @@ -20,10 +20,16 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( [], inorder_traversal(nil) ) + end + + def test_default_three assert_equal( [1], inorder_traversal( diff --git a/test/easy/test_9_palindrome_number.rb b/test/easy/test_9_palindrome_number.rb index 6ddaf58a..8973cc93 100644 --- a/test/easy/test_9_palindrome_number.rb +++ b/test/easy/test_9_palindrome_number.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class PalindromeNumberTest < ::Minitest::Test - def test_default - assert(is_palindrome(121)) - assert(!is_palindrome(-121)) - assert(!is_palindrome(10)) - end + def test_default_one = assert(is_palindrome(121)) + + def test_default_two = assert(!is_palindrome(-121)) + + def test_default_three = assert(!is_palindrome(10)) end From d26eef9f010e08927f831d86ab5269c5dcd71a1c Mon Sep 17 00:00:00 2001 From: fartem Date: Tue, 20 Aug 2024 10:21:47 +0300 Subject: [PATCH 2/9] 2024-08-20 v. 6.5.1: updated some tests --- test/easy/test_263_ugly_number.rb | 10 +++++----- test/easy/test_268_missing_number.rb | 10 +++++----- test/easy/test_278_first_bad_version.rb | 4 +++- test/easy/test_283_move_zeroes.rb | 4 +++- test/easy/test_290_word_pattern.rb | 14 ++++++-------- test/easy/test_292_nim_game.rb | 10 +++++----- .../test_303_range_sum_query_immutable.rb | 2 +- test/easy/test_326_power_of_three.rb | 10 +++++----- test/easy/test_338_counting_bits.rb | 7 +++---- test/easy/test_342_power_of_four.rb | 10 +++++----- test/easy/test_344_reverse_string.rb | 4 +++- .../test_345_reverse_vowels_of_a_string.rb | 13 +++---------- .../test_349_intersection_of_two_arrays.rb | 5 ++++- .../test_350_intersection_of_two_arrays_ii.rb | 5 ++++- test/easy/test_367_valid_perfect_square.rb | 7 +++---- .../test_374_guess_number_higher_or_lower.rb | 6 +++++- test/easy/test_383_ransom_note.rb | 10 +++++----- ..._387_first_unique_character_in_a_string.rb | 10 +++++----- test/easy/test_389_find_the_difference.rb | 10 ++++++++-- test/easy/test_392_is_subsequence.rb | 5 ++++- test/easy/test_404_sum_of_left_leaves.rb | 7 +++++-- ...est_405_convert_a_number_to_hexadecimal.rb | 7 +++---- test/easy/test_409_longest_palindrome.rb | 7 +++---- test/easy/test_412_fizz_buzz.rb | 14 +++++--------- test/easy/test_414_third_maximum_number.rb | 14 ++++++-------- test/easy/test_415_add_strings.rb | 10 +++++----- ...test_434_number_of_segments_in_a_string.rb | 7 +++---- test/easy/test_441_arranging_coins.rb | 7 +++---- ...ind_all_numbers_disappeared_in_an_array.rb | 5 ++++- test/easy/test_455_assign_cookies.rb | 5 ++++- .../test_459_repeated_substring_pattern.rb | 10 +++++----- test/easy/test_461_hamming_distance.rb | 7 +++---- test/easy/test_463_island_perimeter.rb | 8 +++++--- test/easy/test_476_number_complement.rb | 7 +++---- test/easy/test_482_license_key_formatting.rb | 5 ++++- test/easy/test_485_max_consecutive_ones.rb | 5 ++++- test/easy/test_492_construct_the_rectangle.rb | 19 +++++-------------- test/easy/test_496_next_greater_element_i.rb | 5 ++++- 38 files changed, 159 insertions(+), 146 deletions(-) diff --git a/test/easy/test_263_ugly_number.rb b/test/easy/test_263_ugly_number.rb index f5a076a0..f98922ff 100644 --- a/test/easy/test_263_ugly_number.rb +++ b/test/easy/test_263_ugly_number.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class UglyNumberTest < ::Minitest::Test - def test_default - assert(is_ugly(6)) - assert(is_ugly(1)) - assert(!is_ugly(14)) - end + def test_default_one = assert(is_ugly(6)) + + def test_default_two = assert(is_ugly(1)) + + def test_default_three = assert(!is_ugly(14)) end diff --git a/test/easy/test_268_missing_number.rb b/test/easy/test_268_missing_number.rb index fb384a51..9f6307e9 100644 --- a/test/easy/test_268_missing_number.rb +++ b/test/easy/test_268_missing_number.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MissingNumberTest < ::Minitest::Test - def test_default - assert_equal(2, missing_number([3, 0, 1])) - assert_equal(2, missing_number([0, 1])) - assert_equal(8, missing_number([9, 6, 4, 2, 3, 5, 7, 0, 1])) - end + def test_default_one = assert_equal(2, missing_number([3, 0, 1])) + + def test_default_two = assert_equal(2, missing_number([0, 1])) + + def test_default_three = assert_equal(8, missing_number([9, 6, 4, 2, 3, 5, 7, 0, 1])) end diff --git a/test/easy/test_278_first_bad_version.rb b/test/easy/test_278_first_bad_version.rb index c879fa25..ba554c8f 100644 --- a/test/easy/test_278_first_bad_version.rb +++ b/test/easy/test_278_first_bad_version.rb @@ -5,10 +5,12 @@ require 'minitest/autorun' class FirstBadVersionTest < ::Minitest::Test - def test_default + def test_default_one $b_version = 4 assert_equal(4, first_bad_version(5)) + end + def test_default_two $b_version = 1 assert_equal(1, first_bad_version(1)) end diff --git a/test/easy/test_283_move_zeroes.rb b/test/easy/test_283_move_zeroes.rb index 0a9a57fc..fe651b37 100644 --- a/test/easy/test_283_move_zeroes.rb +++ b/test/easy/test_283_move_zeroes.rb @@ -5,11 +5,13 @@ require 'minitest/autorun' class MoveZeroesTest < ::Minitest::Test - def test_default + def test_default_one input = [0, 1, 0, 3, 12] move_zeroes(input) assert_equal([1, 3, 12, 0, 0], input) + end + def test_default_two input = [0] move_zeroes(input) assert_equal([0], input) diff --git a/test/easy/test_290_word_pattern.rb b/test/easy/test_290_word_pattern.rb index fb1c9092..e3067035 100644 --- a/test/easy/test_290_word_pattern.rb +++ b/test/easy/test_290_word_pattern.rb @@ -5,13 +5,11 @@ require 'minitest/autorun' class WordPatternTest < ::Minitest::Test - def test_default - assert(word_pattern('abba', 'dog cat cat dog')) - assert(!word_pattern('abba', 'dog cat cat fish')) - assert(!word_pattern('aaaa', 'dog cat cat dog')) - end + def test_default_one = assert(word_pattern('abba', 'dog cat cat dog')) - def test_additional - assert(!word_pattern('abba', 'dog dog dog dog')) - end + def test_default_two = assert(!word_pattern('abba', 'dog cat cat fish')) + + def test_default_three = assert(!word_pattern('aaaa', 'dog cat cat dog')) + + def test_additional_one = assert(!word_pattern('abba', 'dog dog dog dog')) end diff --git a/test/easy/test_292_nim_game.rb b/test/easy/test_292_nim_game.rb index 393a8623..dead5bd1 100644 --- a/test/easy/test_292_nim_game.rb +++ b/test/easy/test_292_nim_game.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class NimGameTest < ::Minitest::Test - def test_default - assert(!can_win_nim(4)) - assert(can_win_nim(1)) - assert(can_win_nim(2)) - end + def test_default_one = assert(!can_win_nim(4)) + + def test_default_two = assert(can_win_nim(1)) + + def test_default_three = assert(can_win_nim(2)) end diff --git a/test/easy/test_303_range_sum_query_immutable.rb b/test/easy/test_303_range_sum_query_immutable.rb index 788aabda..1f57183b 100644 --- a/test/easy/test_303_range_sum_query_immutable.rb +++ b/test/easy/test_303_range_sum_query_immutable.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class RangeSumQueryImmutableTest < ::Minitest::Test - def test_default + def test_default_one num_array = ::NumArray.new([-2, 0, 3, -5, 2, -1]) assert_equal(1, num_array.sum_range(0, 2)) assert_equal(-1, num_array.sum_range(2, 5)) diff --git a/test/easy/test_326_power_of_three.rb b/test/easy/test_326_power_of_three.rb index 78bfc22e..523602df 100644 --- a/test/easy/test_326_power_of_three.rb +++ b/test/easy/test_326_power_of_three.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class PowerOfThreeTest < ::Minitest::Test - def test_default - assert(is_power_of_three(27)) - assert(!is_power_of_three(0)) - assert(!is_power_of_three(-1)) - end + def test_default_one = assert(is_power_of_three(27)) + + def test_default_two = assert(!is_power_of_three(0)) + + def test_default_three = assert(!is_power_of_three(-1)) end diff --git a/test/easy/test_338_counting_bits.rb b/test/easy/test_338_counting_bits.rb index c0efd0b2..86828a2d 100644 --- a/test/easy/test_338_counting_bits.rb +++ b/test/easy/test_338_counting_bits.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountingBitsTest < ::Minitest::Test - def test_default - assert_equal([0, 1, 1], count_bits(2)) - assert_equal([0, 1, 1, 2, 1, 2], count_bits(5)) - end + def test_default_one = assert_equal([0, 1, 1], count_bits(2)) + + def test_default_two = assert_equal([0, 1, 1, 2, 1, 2], count_bits(5)) end diff --git a/test/easy/test_342_power_of_four.rb b/test/easy/test_342_power_of_four.rb index 734d3585..a0d46edd 100644 --- a/test/easy/test_342_power_of_four.rb +++ b/test/easy/test_342_power_of_four.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class PowerOfFourTest < ::Minitest::Test - def test_default - assert(is_power_of_four(16)) - assert(!is_power_of_four(5)) - assert(is_power_of_four(1)) - end + def test_default_one = assert(is_power_of_four(16)) + + def test_default_two = assert(!is_power_of_four(5)) + + def test_default_three = assert(is_power_of_four(1)) end diff --git a/test/easy/test_344_reverse_string.rb b/test/easy/test_344_reverse_string.rb index 7c06f371..9aface89 100644 --- a/test/easy/test_344_reverse_string.rb +++ b/test/easy/test_344_reverse_string.rb @@ -5,11 +5,13 @@ require 'minitest/autorun' class ReverseStringTest < ::Minitest::Test - def test_default + def test_default_one arr = %w[h e l l o] reverse_string(arr) assert_equal(%w[o l l e h], arr) + end + def test_default_two arr = %w[H a n n a h] reverse_string(arr) assert_equal(%w[h a n n a H], arr) diff --git a/test/easy/test_345_reverse_vowels_of_a_string.rb b/test/easy/test_345_reverse_vowels_of_a_string.rb index 55a2e3fc..6a0c9b59 100644 --- a/test/easy/test_345_reverse_vowels_of_a_string.rb +++ b/test/easy/test_345_reverse_vowels_of_a_string.rb @@ -5,14 +5,7 @@ require 'minitest/autorun' class ReverseVowelsOfAStringTest < ::Minitest::Test - def test_default - assert_equal( - 'holle', - reverse_vowels('hello') - ) - assert_equal( - 'leotcede', - reverse_vowels('leetcode') - ) - end + def test_default_one = assert_equal('holle', reverse_vowels('hello')) + + def test_default_two = assert_equal('leotcede', reverse_vowels('leetcode')) end diff --git a/test/easy/test_349_intersection_of_two_arrays.rb b/test/easy/test_349_intersection_of_two_arrays.rb index e698d4e9..2b82b1ab 100644 --- a/test/easy/test_349_intersection_of_two_arrays.rb +++ b/test/easy/test_349_intersection_of_two_arrays.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class IntersectionOfTwoArraysTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [2], intersection( @@ -13,6 +13,9 @@ def test_default [2, 2] ) ) + end + + def test_default_two assert_equal( [4, 9], intersection( diff --git a/test/easy/test_350_intersection_of_two_arrays_ii.rb b/test/easy/test_350_intersection_of_two_arrays_ii.rb index 634aefbe..3cfa4eae 100644 --- a/test/easy/test_350_intersection_of_two_arrays_ii.rb +++ b/test/easy/test_350_intersection_of_two_arrays_ii.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class IntersectionOfTwoArraysIITest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [2, 2], intersect( @@ -13,6 +13,9 @@ def test_default [2, 2] ) ) + end + + def test_default_two assert_equal( [9, 4], intersect( diff --git a/test/easy/test_367_valid_perfect_square.rb b/test/easy/test_367_valid_perfect_square.rb index 75a4926e..6ead02d9 100644 --- a/test/easy/test_367_valid_perfect_square.rb +++ b/test/easy/test_367_valid_perfect_square.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ValidPerfectSquareTest < ::Minitest::Test - def test_default - assert(is_perfect_square(16)) - assert(!is_perfect_square(14)) - end + def test_default_one = assert(is_perfect_square(16)) + + def test_default_two = assert(!is_perfect_square(14)) end diff --git a/test/easy/test_374_guess_number_higher_or_lower.rb b/test/easy/test_374_guess_number_higher_or_lower.rb index 399e76a4..c5069374 100644 --- a/test/easy/test_374_guess_number_higher_or_lower.rb +++ b/test/easy/test_374_guess_number_higher_or_lower.rb @@ -5,13 +5,17 @@ require 'minitest/autorun' class GuessNumberHigherOrLowerTest < ::Minitest::Test - def test_default + def test_default_one $guess_num = 6 assert_equal(6, guess_number(10)) + end + def test_default_two $guess_num = 1 assert_equal(1, guess_number(1)) + end + def test_default_three $guess_num = 1 assert_equal(1, guess_number(2)) end diff --git a/test/easy/test_383_ransom_note.rb b/test/easy/test_383_ransom_note.rb index 6dbeb4c2..d5c40b28 100644 --- a/test/easy/test_383_ransom_note.rb +++ b/test/easy/test_383_ransom_note.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class RansomNoteTest < ::Minitest::Test - def test_default - assert(!can_construct('a', 'b')) - assert(!can_construct('aa', 'ab')) - assert(can_construct('aa', 'aab')) - end + def test_default_one = assert(!can_construct('a', 'b')) + + def test_default_two = assert(!can_construct('aa', 'ab')) + + def test_default_three = assert(can_construct('aa', 'aab')) end diff --git a/test/easy/test_387_first_unique_character_in_a_string.rb b/test/easy/test_387_first_unique_character_in_a_string.rb index 6c684a9b..6b426ec6 100644 --- a/test/easy/test_387_first_unique_character_in_a_string.rb +++ b/test/easy/test_387_first_unique_character_in_a_string.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FirstUniqueCharacterInAStringTest < ::Minitest::Test - def test_default - assert_equal(0, first_uniq_char('leetcode')) - assert_equal(2, first_uniq_char('loveleetcode')) - assert_equal(-1, first_uniq_char('aabb')) - end + def test_default_one = assert_equal(0, first_uniq_char('leetcode')) + + def test_default_two = assert_equal(2, first_uniq_char('loveleetcode')) + + def test_default_three = assert_equal(-1, first_uniq_char('aabb')) end diff --git a/test/easy/test_389_find_the_difference.rb b/test/easy/test_389_find_the_difference.rb index d09e04b4..0bd10b3a 100644 --- a/test/easy/test_389_find_the_difference.rb +++ b/test/easy/test_389_find_the_difference.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class FindTheDifferenceTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 'e', find_the_difference( @@ -13,9 +13,15 @@ def test_default 'abcde' ) ) + end + + def test_default_two assert_equal( 'y', - find_the_difference('', 'y') + find_the_difference( + '', + 'y' + ) ) end end diff --git a/test/easy/test_392_is_subsequence.rb b/test/easy/test_392_is_subsequence.rb index 3b0e7da0..58da5938 100644 --- a/test/easy/test_392_is_subsequence.rb +++ b/test/easy/test_392_is_subsequence.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class IsSubsequenceTest < ::Minitest::Test - def test_default + def test_default_one assert( is_subsequence( 'abc', 'ahbgdc' ) ) + end + + def test_default_two assert( !is_subsequence( 'axc', diff --git a/test/easy/test_404_sum_of_left_leaves.rb b/test/easy/test_404_sum_of_left_leaves.rb index 5fa75b9c..4bc83c22 100644 --- a/test/easy/test_404_sum_of_left_leaves.rb +++ b/test/easy/test_404_sum_of_left_leaves.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class SumOfLeftLeavesTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 24, sum_of_left_leaves( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 0, sum_of_left_leaves( @@ -29,7 +32,7 @@ def test_default ) end - def test_additional + def test_additional_one assert_equal( 4, sum_of_left_leaves( diff --git a/test/easy/test_405_convert_a_number_to_hexadecimal.rb b/test/easy/test_405_convert_a_number_to_hexadecimal.rb index f8f4827a..2f410cc9 100644 --- a/test/easy/test_405_convert_a_number_to_hexadecimal.rb +++ b/test/easy/test_405_convert_a_number_to_hexadecimal.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ConvertANumberToHexadecimalTest < ::Minitest::Test - def test_default - assert_equal('1a', to_hex(26)) - assert_equal('ffffffff', to_hex(-1)) - end + def test_default_one = assert_equal('1a', to_hex(26)) + + def test_default_two = assert_equal('ffffffff', to_hex(-1)) end diff --git a/test/easy/test_409_longest_palindrome.rb b/test/easy/test_409_longest_palindrome.rb index f8960a96..f99e7daf 100644 --- a/test/easy/test_409_longest_palindrome.rb +++ b/test/easy/test_409_longest_palindrome.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class LongestPalindromeTest < ::Minitest::Test - def test_default - assert_equal(7, longest_palindrome('abccccdd')) - assert_equal(1, longest_palindrome('a')) - end + def test_default_one = assert_equal(7, longest_palindrome('abccccdd')) + + def test_default_two = assert_equal(1, longest_palindrome('a')) end diff --git a/test/easy/test_412_fizz_buzz.rb b/test/easy/test_412_fizz_buzz.rb index ed595c49..3b1e30b8 100644 --- a/test/easy/test_412_fizz_buzz.rb +++ b/test/easy/test_412_fizz_buzz.rb @@ -5,15 +5,11 @@ require 'minitest/autorun' class FizzBuzzTest < ::Minitest::Test - def test_default - assert_equal( - %w[1 2 Fizz], - fizz_buzz(3) - ) - assert_equal( - %w[1 2 Fizz 4 Buzz], - fizz_buzz(5) - ) + def test_default_one = assert_equal(%w[1 2 Fizz], fizz_buzz(3)) + + def test_default_two = assert_equal(%w[1 2 Fizz 4 Buzz], fizz_buzz(5)) + + def test_default_three assert_equal( %w[1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz], fizz_buzz(15) diff --git a/test/easy/test_414_third_maximum_number.rb b/test/easy/test_414_third_maximum_number.rb index 8303e954..deb0ce36 100644 --- a/test/easy/test_414_third_maximum_number.rb +++ b/test/easy/test_414_third_maximum_number.rb @@ -5,13 +5,11 @@ require 'minitest/autorun' class ThirdMaximumNumberTest < ::Minitest::Test - def test_default - assert_equal(1, third_max([3, 2, 1])) - assert_equal(2, third_max([1, 2])) - assert_equal(1, third_max([2, 2, 3, 1])) - end + def test_default_one = assert_equal(1, third_max([3, 2, 1])) - def test_additional - assert_equal(2, third_max([1, 2, 2, 2])) - end + def test_default_two = assert_equal(2, third_max([1, 2])) + + def test_default_three = assert_equal(1, third_max([2, 2, 3, 1])) + + def test_additional_one = assert_equal(2, third_max([1, 2, 2, 2])) end diff --git a/test/easy/test_415_add_strings.rb b/test/easy/test_415_add_strings.rb index af3ae249..4869d8f3 100644 --- a/test/easy/test_415_add_strings.rb +++ b/test/easy/test_415_add_strings.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class AddStringsTest < ::Minitest::Test - def test_default - assert_equal('134', add_strings('11', '123')) - assert_equal('533', add_strings('456', '77')) - assert_equal('0', add_strings('0', '0')) - end + def test_default_one = assert_equal('134', add_strings('11', '123')) + + def test_default_two = assert_equal('533', add_strings('456', '77')) + + def test_default_three = assert_equal('0', add_strings('0', '0')) end diff --git a/test/easy/test_434_number_of_segments_in_a_string.rb b/test/easy/test_434_number_of_segments_in_a_string.rb index 2f850231..d23ac50d 100644 --- a/test/easy/test_434_number_of_segments_in_a_string.rb +++ b/test/easy/test_434_number_of_segments_in_a_string.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class NumberOfSegmentsInAStringTest < ::Minitest::Test - def test_default - assert_equal(5, count_segments('Hello, my name is John')) - assert_equal(1, count_segments('Hello')) - end + def test_default_one = assert_equal(5, count_segments('Hello, my name is John')) + + def test_default_two = assert_equal(1, count_segments('Hello')) end diff --git a/test/easy/test_441_arranging_coins.rb b/test/easy/test_441_arranging_coins.rb index fa00cbf6..920790f0 100644 --- a/test/easy/test_441_arranging_coins.rb +++ b/test/easy/test_441_arranging_coins.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ArrangingCoinsTest < ::Minitest::Test - def test_default - assert_equal(2, arrange_coins(5)) - assert_equal(3, arrange_coins(8)) - end + def test_default_one = assert_equal(2, arrange_coins(5)) + + def test_default_two = assert_equal(3, arrange_coins(8)) end diff --git a/test/easy/test_448_find_all_numbers_disappeared_in_an_array.rb b/test/easy/test_448_find_all_numbers_disappeared_in_an_array.rb index 2c419f90..0b9089d0 100644 --- a/test/easy/test_448_find_all_numbers_disappeared_in_an_array.rb +++ b/test/easy/test_448_find_all_numbers_disappeared_in_an_array.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class FindAllNumbersDisappearedInAnArrayTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [5, 6], find_disappeared_numbers( [4, 3, 2, 7, 8, 2, 3, 1] ) ) + end + + def test_default_two assert_equal( [2], find_disappeared_numbers([1, 1]) diff --git a/test/easy/test_455_assign_cookies.rb b/test/easy/test_455_assign_cookies.rb index 1c6e59e3..a38b7e7f 100644 --- a/test/easy/test_455_assign_cookies.rb +++ b/test/easy/test_455_assign_cookies.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class AssignCookiesTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 1, find_content_children( @@ -13,6 +13,9 @@ def test_default [1, 1] ) ) + end + + def test_default_two assert_equal( 2, find_content_children( diff --git a/test/easy/test_459_repeated_substring_pattern.rb b/test/easy/test_459_repeated_substring_pattern.rb index 26eb27cc..15132d83 100644 --- a/test/easy/test_459_repeated_substring_pattern.rb +++ b/test/easy/test_459_repeated_substring_pattern.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class RepeatedSubstringPatternTest < ::Minitest::Test - def test_default - assert(repeated_substring_pattern('abab')) - assert(!repeated_substring_pattern('aba')) - assert(repeated_substring_pattern('abcabcabcabc')) - end + def test_default_one = assert(repeated_substring_pattern('abab')) + + def test_default_two = assert(!repeated_substring_pattern('aba')) + + def test_default_three = assert(repeated_substring_pattern('abcabcabcabc')) end diff --git a/test/easy/test_461_hamming_distance.rb b/test/easy/test_461_hamming_distance.rb index 3b092b26..5a91780a 100644 --- a/test/easy/test_461_hamming_distance.rb +++ b/test/easy/test_461_hamming_distance.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class HammingDistanceTest < ::Minitest::Test - def test_default - assert_equal(2, hamming_distance(1, 4)) - assert_equal(1, hamming_distance(3, 1)) - end + def test_default_one = assert_equal(2, hamming_distance(1, 4)) + + def test_default_two = assert_equal(1, hamming_distance(3, 1)) end diff --git a/test/easy/test_463_island_perimeter.rb b/test/easy/test_463_island_perimeter.rb index b14e21f2..290545f0 100644 --- a/test/easy/test_463_island_perimeter.rb +++ b/test/easy/test_463_island_perimeter.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class IslandPerimeterTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 16, island_perimeter( @@ -17,7 +17,9 @@ def test_default ] ) ) - assert_equal(4, island_perimeter([[1]])) - assert_equal(4, island_perimeter([[1, 0]])) end + + def test_default_two = assert_equal(4, island_perimeter([[1]])) + + def test_default_three = assert_equal(4, island_perimeter([[1, 0]])) end diff --git a/test/easy/test_476_number_complement.rb b/test/easy/test_476_number_complement.rb index 14820f0d..111f8b2a 100644 --- a/test/easy/test_476_number_complement.rb +++ b/test/easy/test_476_number_complement.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class NumberComplementTest < ::Minitest::Test - def test_default - assert_equal(2, find_complement(5)) - assert_equal(0, find_complement(1)) - end + def test_default_one = assert_equal(2, find_complement(5)) + + def test_default_two = assert_equal(0, find_complement(1)) end diff --git a/test/easy/test_482_license_key_formatting.rb b/test/easy/test_482_license_key_formatting.rb index c7c907e6..a3fe40e9 100644 --- a/test/easy/test_482_license_key_formatting.rb +++ b/test/easy/test_482_license_key_formatting.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class LicenseKeyFormattingTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( '5F3Z-2E9W', license_key_formatting( @@ -13,6 +13,9 @@ def test_default 4 ) ) + end + + def test_default_two assert_equal( '2-5G-3J', license_key_formatting( diff --git a/test/easy/test_485_max_consecutive_ones.rb b/test/easy/test_485_max_consecutive_ones.rb index 8e6407db..eb4f2840 100644 --- a/test/easy/test_485_max_consecutive_ones.rb +++ b/test/easy/test_485_max_consecutive_ones.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class MaxConsecutiveOnesTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 3, find_max_consecutive_ones( [1, 1, 0, 1, 1, 1] ) ) + end + + def test_default_two assert_equal( 2, find_max_consecutive_ones( diff --git a/test/easy/test_492_construct_the_rectangle.rb b/test/easy/test_492_construct_the_rectangle.rb index 2d82643d..bbf52b54 100644 --- a/test/easy/test_492_construct_the_rectangle.rb +++ b/test/easy/test_492_construct_the_rectangle.rb @@ -5,18 +5,9 @@ require 'minitest/autorun' class ConstructTheRectangleTest < ::Minitest::Test - def test_default - assert_equal( - [2, 2], - construct_rectangle(4) - ) - assert_equal( - [37, 1], - construct_rectangle(37) - ) - assert_equal( - [427, 286], - construct_rectangle(122_122) - ) - end + def test_default_one = assert_equal([2, 2], construct_rectangle(4)) + + def test_default_two = assert_equal([37, 1], construct_rectangle(37)) + + def test_default_three = assert_equal([427, 286], construct_rectangle(122_122)) end diff --git a/test/easy/test_496_next_greater_element_i.rb b/test/easy/test_496_next_greater_element_i.rb index 3a4688d8..dfaa49ad 100644 --- a/test/easy/test_496_next_greater_element_i.rb +++ b/test/easy/test_496_next_greater_element_i.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class NextGreaterElementITest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [-1, 3, -1], next_greater_element( @@ -13,6 +13,9 @@ def test_default [1, 3, 4, 2] ) ) + end + + def test_default_two assert_equal( [3, -1], next_greater_element( From e9dc6c719af914113719b61c8646aff9928e85cd Mon Sep 17 00:00:00 2001 From: fartem Date: Tue, 20 Aug 2024 10:35:40 +0300 Subject: [PATCH 3/9] 2024-08-20 v. 6.5.1: updated some tests --- test/easy/test_500_keyboard_row.rb | 9 +++-- ...est_501_find_mode_in_binary_search_tree.rb | 9 +++-- test/easy/test_504_base_7.rb | 7 ++-- test/easy/test_506_relative_ranks.rb | 21 +++++++++-- test/easy/test_507_perfect_number.rb | 7 ++-- test/easy/test_509_fibonacci_number.rb | 10 +++--- test/easy/test_520_detect_capital.rb | 11 +++--- ...test_521_longest_uncommon_subsequence_i.rb | 14 ++++---- ..._530_minimum_absolute_difference_in_bst.rb | 5 ++- test/easy/test_543_diameter_of_binary_tree.rb | 5 ++- .../test_551_student_attendance_record_i.rb | 7 ++-- .../test_557_reverse_words_in_a_string_iii.rb | 5 ++- .../test_559_maximum_depth_of_n_ary_tree.rb | 5 ++- test/easy/test_561_array_partition.rb | 5 ++- test/easy/test_563_binary_tree_tilt.rb | 8 ++++- test/easy/test_566_reshape_the_matrix.rb | 5 ++- test/easy/test_572_subtree_of_another_tree.rb | 5 ++- .../test_589_n_ary_tree_preorder_traversal.rb | 5 ++- ...test_590_n_ary_tree_postorder_traversal.rb | 5 ++- ...test_594_longest_harmonious_subsequence.rb | 10 +++--- ...test_599_minimum_index_sum_of_two_lists.rb | 35 ++++++++++++++++--- ...t_606_construct_string_from_binary_tree.rb | 5 ++- 22 files changed, 135 insertions(+), 63 deletions(-) diff --git a/test/easy/test_500_keyboard_row.rb b/test/easy/test_500_keyboard_row.rb index c0f561fd..b543a098 100644 --- a/test/easy/test_500_keyboard_row.rb +++ b/test/easy/test_500_keyboard_row.rb @@ -5,15 +5,14 @@ require 'minitest/autorun' class KeyboardRowTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( %w[Alaska Dad], find_words(%w[Hello Alaska Dad Peace]) ) - assert_equal([], find_words(['omk'])) end - def test_additional - assert_equal(['MMM'], find_words(['MMM'])) - end + def test_default_two = assert_equal([], find_words(['omk'])) + + def test_additional_one = assert_equal(['MMM'], find_words(['MMM'])) end diff --git a/test/easy/test_501_find_mode_in_binary_search_tree.rb b/test/easy/test_501_find_mode_in_binary_search_tree.rb index c94e6912..5b84558b 100644 --- a/test/easy/test_501_find_mode_in_binary_search_tree.rb +++ b/test/easy/test_501_find_mode_in_binary_search_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class FindModeInBinarySearchTreeTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [2], find_mode( @@ -21,9 +21,14 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( [0], - find_mode(::TreeNode.new(0)) + find_mode( + ::TreeNode.new(0) + ) ) end end diff --git a/test/easy/test_504_base_7.rb b/test/easy/test_504_base_7.rb index c91ceeb0..bbc790e8 100644 --- a/test/easy/test_504_base_7.rb +++ b/test/easy/test_504_base_7.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class Base7Test < ::Minitest::Test - def test_default - assert_equal('202', convert_to_base7(100)) - assert_equal('-10', convert_to_base7(-7)) - end + def test_default_one = assert_equal('202', convert_to_base7(100)) + + def test_default_two = assert_equal('-10', convert_to_base7(-7)) end diff --git a/test/easy/test_506_relative_ranks.rb b/test/easy/test_506_relative_ranks.rb index 76d1f381..69d24236 100644 --- a/test/easy/test_506_relative_ranks.rb +++ b/test/easy/test_506_relative_ranks.rb @@ -5,15 +5,30 @@ require 'minitest/autorun' class RelativeRanksTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - ['Gold Medal', 'Silver Medal', 'Bronze Medal', '4', '5'], + [ + 'Gold Medal', + 'Silver Medal', + 'Bronze Medal', + '4', + '5' + ], find_relative_ranks( [5, 4, 3, 2, 1] ) ) + end + + def test_default_two assert_equal( - ['Gold Medal', '5', 'Bronze Medal', 'Silver Medal', '4'], + [ + 'Gold Medal', + '5', + 'Bronze Medal', + 'Silver Medal', + '4' + ], find_relative_ranks( [10, 3, 8, 9, 4] ) diff --git a/test/easy/test_507_perfect_number.rb b/test/easy/test_507_perfect_number.rb index 62b4df93..3b3a0b94 100644 --- a/test/easy/test_507_perfect_number.rb +++ b/test/easy/test_507_perfect_number.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class PerfectNumberTest < ::Minitest::Test - def test_default - assert(check_perfect_number(28)) - assert(!check_perfect_number(7)) - end + def test_default_one = assert(check_perfect_number(28)) + + def test_default_two = assert(!check_perfect_number(7)) end diff --git a/test/easy/test_509_fibonacci_number.rb b/test/easy/test_509_fibonacci_number.rb index f877d97d..48936f67 100644 --- a/test/easy/test_509_fibonacci_number.rb +++ b/test/easy/test_509_fibonacci_number.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FibonacciNumberTest < ::Minitest::Test - def test_default - assert_equal(1, fib(2)) - assert_equal(2, fib(3)) - assert_equal(3, fib(4)) - end + def test_default_one = assert_equal(1, fib(2)) + + def test_default_two = assert_equal(2, fib(3)) + + def test_default_three =assert_equal(3, fib(4)) end diff --git a/test/easy/test_520_detect_capital.rb b/test/easy/test_520_detect_capital.rb index c0aec1fa..b8ae06ce 100644 --- a/test/easy/test_520_detect_capital.rb +++ b/test/easy/test_520_detect_capital.rb @@ -5,12 +5,9 @@ require 'minitest/autorun' class DetectCapitalTest < ::Minitest::Test - def test_default - assert(detect_capital_use('USA')) - assert(!detect_capital_use('FlaG')) - end + def test_default_one = assert(detect_capital_use('USA')) - def test_additional - assert(detect_capital_use('word')) - end + def test_default_two = assert(!detect_capital_use('FlaG')) + + def test_additional_one = assert(detect_capital_use('word')) end diff --git a/test/easy/test_521_longest_uncommon_subsequence_i.rb b/test/easy/test_521_longest_uncommon_subsequence_i.rb index 48dcdaab..0057bbf3 100644 --- a/test/easy/test_521_longest_uncommon_subsequence_i.rb +++ b/test/easy/test_521_longest_uncommon_subsequence_i.rb @@ -5,13 +5,11 @@ require 'minitest/autorun' class LongestUncommonSubsequenceITest < ::Minitest::Test - def test_default - # assert_equal(3, find_lu_slength('aba', 'cdc')) - # assert_equal(3, find_lu_slength('aaa', 'bbb')) - # assert_equal(-1, find_lu_slength('aaa', 'aaa')) - end + def test_default_one = assert_equal(3, find_lu_slength('aba', 'cdc')) - def test_additional - assert_equal(3, find_lu_slength('abc', 'bca')) - end + def test_default_two = assert_equal(3, find_lu_slength('aaa', 'bbb')) + + def test_default_three = assert_equal(-1, find_lu_slength('aaa', 'aaa')) + + def test_additional_one = assert_equal(3, find_lu_slength('abc', 'bca')) end diff --git a/test/easy/test_530_minimum_absolute_difference_in_bst.rb b/test/easy/test_530_minimum_absolute_difference_in_bst.rb index 4be8ca5b..7d31376b 100644 --- a/test/easy/test_530_minimum_absolute_difference_in_bst.rb +++ b/test/easy/test_530_minimum_absolute_difference_in_bst.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class MinimumAbsoluteDifferenceInBSTTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 1, get_minimum_difference( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 1, get_minimum_difference( diff --git a/test/easy/test_543_diameter_of_binary_tree.rb b/test/easy/test_543_diameter_of_binary_tree.rb index d26108bb..22035947 100644 --- a/test/easy/test_543_diameter_of_binary_tree.rb +++ b/test/easy/test_543_diameter_of_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class DiameterOfBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 3, diameter_of_binary_tree( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 1, diameter_of_binary_tree( diff --git a/test/easy/test_551_student_attendance_record_i.rb b/test/easy/test_551_student_attendance_record_i.rb index e0154e33..0aba78e5 100644 --- a/test/easy/test_551_student_attendance_record_i.rb +++ b/test/easy/test_551_student_attendance_record_i.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class StudentAttendanceRecordITest < ::Minitest::Test - def test_default - assert(check_record('PPALLP')) - assert(!check_record('PPALLL')) - end + def test_default_one = assert(check_record('PPALLP')) + + def test_default_two = assert(!check_record('PPALLL')) end diff --git a/test/easy/test_557_reverse_words_in_a_string_iii.rb b/test/easy/test_557_reverse_words_in_a_string_iii.rb index ae8e8b40..85901d31 100644 --- a/test/easy/test_557_reverse_words_in_a_string_iii.rb +++ b/test/easy/test_557_reverse_words_in_a_string_iii.rb @@ -5,11 +5,14 @@ require 'minitest/autorun' class ReverseWordsInAStringIIITest < ::Minitest::Test - def test_default + def test_default_one assert_equal( "s'teL ekat edoCteeL tsetnoc", reverse_words("Let's take LeetCode contest") ) + end + + def test_default_two assert_equal( 'doG gniD', reverse_words('God Ding') diff --git a/test/easy/test_559_maximum_depth_of_n_ary_tree.rb b/test/easy/test_559_maximum_depth_of_n_ary_tree.rb index 0086aaa7..36ce6614 100644 --- a/test/easy/test_559_maximum_depth_of_n_ary_tree.rb +++ b/test/easy/test_559_maximum_depth_of_n_ary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class MaximumDepthOfNAryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 3, max_depth_of_n_ary_tree( @@ -26,6 +26,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 5, max_depth_of_n_ary_tree( diff --git a/test/easy/test_561_array_partition.rb b/test/easy/test_561_array_partition.rb index eef45f96..088a0882 100644 --- a/test/easy/test_561_array_partition.rb +++ b/test/easy/test_561_array_partition.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class ArrayPartitionTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 4, array_pair_sum( [1, 4, 3, 2] ) ) + end + + def test_default_two assert_equal( 9, array_pair_sum( diff --git a/test/easy/test_563_binary_tree_tilt.rb b/test/easy/test_563_binary_tree_tilt.rb index 9c77d3ed..cf6c182a 100644 --- a/test/easy/test_563_binary_tree_tilt.rb +++ b/test/easy/test_563_binary_tree_tilt.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class BinaryTreeTiltTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 1, find_tilt( @@ -17,6 +17,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 15, find_tilt( @@ -35,6 +38,9 @@ def test_default ) ) ) + end + + def test_default_three assert_equal( 9, find_tilt( diff --git a/test/easy/test_566_reshape_the_matrix.rb b/test/easy/test_566_reshape_the_matrix.rb index ba7cf54c..bc6e26c9 100644 --- a/test/easy/test_566_reshape_the_matrix.rb +++ b/test/easy/test_566_reshape_the_matrix.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class ReshapeTheMatrixTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [[1, 2, 3, 4]], matrix_reshape( @@ -14,6 +14,9 @@ def test_default 4 ) ) + end + + def test_default_two assert_equal( [[1, 2], [3, 4]], matrix_reshape( diff --git a/test/easy/test_572_subtree_of_another_tree.rb b/test/easy/test_572_subtree_of_another_tree.rb index 0fd2ea62..15e0ded4 100644 --- a/test/easy/test_572_subtree_of_another_tree.rb +++ b/test/easy/test_572_subtree_of_another_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class SubtreeOfAnotherTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( is_subtree( ::TreeNode.new( @@ -25,6 +25,9 @@ def test_default ) ) ) + end + + def test_default_two assert( !is_subtree( ::TreeNode.new( diff --git a/test/easy/test_589_n_ary_tree_preorder_traversal.rb b/test/easy/test_589_n_ary_tree_preorder_traversal.rb index d3b309cc..29232625 100644 --- a/test/easy/test_589_n_ary_tree_preorder_traversal.rb +++ b/test/easy/test_589_n_ary_tree_preorder_traversal.rb @@ -8,7 +8,7 @@ require 'minitest/autorun' class NAryTreePreorderTraversalTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [1, 3, 5, 6, 2, 4], preorder( @@ -28,6 +28,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( [1, 2, 3, 6, 7, 11, 14, 4, 8, 12, 5, 9, 13, 10], preorder( diff --git a/test/easy/test_590_n_ary_tree_postorder_traversal.rb b/test/easy/test_590_n_ary_tree_postorder_traversal.rb index fec26bac..58639934 100644 --- a/test/easy/test_590_n_ary_tree_postorder_traversal.rb +++ b/test/easy/test_590_n_ary_tree_postorder_traversal.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class NAryTreePostorderTraversalTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [5, 6, 3, 2, 4, 1], postorder( @@ -26,6 +26,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( [2, 6, 14, 11, 7, 3, 12, 8, 4, 13, 9, 10, 5, 1], postorder( diff --git a/test/easy/test_594_longest_harmonious_subsequence.rb b/test/easy/test_594_longest_harmonious_subsequence.rb index 76d632e0..5bfa1ba1 100644 --- a/test/easy/test_594_longest_harmonious_subsequence.rb +++ b/test/easy/test_594_longest_harmonious_subsequence.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class LongestHarmoniousSubsequenceTest < ::Minitest::Test - def test_default - assert_equal(5, find_lhs([1, 3, 2, 2, 5, 2, 3, 7])) - assert_equal(2, find_lhs([1, 2, 3, 4])) - assert_equal(0, find_lhs([1, 1, 1, 1])) - end + def test_default_one = assert_equal(5, find_lhs([1, 3, 2, 2, 5, 2, 3, 7])) + + def test_default_two = assert_equal(2, find_lhs([1, 2, 3, 4])) + + def test_default_three = assert_equal(0, find_lhs([1, 1, 1, 1])) end diff --git a/test/easy/test_599_minimum_index_sum_of_two_lists.rb b/test/easy/test_599_minimum_index_sum_of_two_lists.rb index b1089405..681f6257 100644 --- a/test/easy/test_599_minimum_index_sum_of_two_lists.rb +++ b/test/easy/test_599_minimum_index_sum_of_two_lists.rb @@ -5,21 +5,46 @@ require 'minitest/autorun' class MinimumIndexSumOfTwoListsTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( ['Shogun'], find_restaurant( - ['Shogun', 'Tapioca Express', 'Burger King', 'KFC'], - ['Piatti', 'The Grill at Torrey Pines', 'Hungry Hunter Steakhouse', 'Shogun'] + [ + 'Shogun', + 'Tapioca Express', + 'Burger King', + 'KFC' + ], + [ + 'Piatti', + 'The Grill at Torrey Pines', + 'Hungry Hunter Steakhouse', + 'Shogun' + ] ) ) + end + + def test_default_two assert_equal( ['Shogun'], find_restaurant( - ['Shogun', 'Tapioca Express', 'Burger King', 'KFC'], - ['KFC', 'Shogun', 'Burger King'] + [ + 'Shogun', + 'Tapioca Express', + 'Burger King', + 'KFC' + ], + [ + 'KFC', + 'Shogun', + 'Burger King' + ] ) ) + end + + def test_default_three assert_equal( %w[sad happy], find_restaurant( diff --git a/test/easy/test_606_construct_string_from_binary_tree.rb b/test/easy/test_606_construct_string_from_binary_tree.rb index b1ecc719..2e81654e 100644 --- a/test/easy/test_606_construct_string_from_binary_tree.rb +++ b/test/easy/test_606_construct_string_from_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class ConstructStringFromBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( '1(2(4))(3)', tree2str( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( '1(2()(4))(3)', tree2str( From 1f2294e9cdb08531fb10a7d3d5cdc513b1aeb8ac Mon Sep 17 00:00:00 2001 From: fartem Date: Tue, 20 Aug 2024 12:18:40 +0300 Subject: [PATCH 4/9] 2024-08-20 v. 6.5.1: updated some tests --- test/easy/test_1002_find_common_characters.rb | 7 +- ...maximize_sum_of_array_after_k_negations.rb | 10 +- ...test_1009_complement_of_base_10_integer.rb | 10 +- .../test_1018_binary_prefix_divisible_by_5.rb | 7 +- .../test_1021_remove_outermost_parentheses.rb | 10 +- ...1022_sum_of_root_to_leaf_binary_numbers.rb | 5 +- test/easy/test_1025_divisor_game.rb | 7 +- test/easy/test_1046_last_stone_weight.rb | 7 +- ...emove_all_adjacent_duplicates_in_string.rb | 7 +- test/easy/test_1051_height_checker.rb | 10 +- ...1071_greatest_common_divisor_of_strings.rb | 10 +- .../test_1078_occurrences_after_bigram.rb | 5 +- test/easy/test_1089_duplicate_zeros.rb | 6 +- .../test_1103_distribute_candies_to_people.rb | 7 +- .../easy/test_1108_defanging_an_ip_address.rb | 9 +- test/easy/test_1137_n_th_tribonacci_number.rb | 7 +- test/easy/test_1154_day_of_the_year.rb | 7 +- ..._words_that_can_be_formed_by_characters.rb | 23 ++++- .../test_1184_distance_between_bus_stops.rb | 10 +- test/easy/test_1185_day_of_the_week.rb | 10 +- .../test_1189_maximum_number_of_balloons.rb | 10 +- .../test_1200_minimum_absolute_difference.rb | 20 +++- .../test_1207_unique_number_of_occurrences.rb | 10 +- ...cost_to_move_chips_to_the_same_position.rb | 10 +- ...1221_split_a_string_in_balanced_strings.rb | 10 +- ...est_1232_check_if_it_is_a_straight_line.rb | 31 +++++- ..._1252_cells_with_odd_values_in_a_matrix.rb | 7 +- ...t_1266_minimum_time_visiting_all_points.rb | 19 +++- ..._1275_find_winner_on_a_tic_tac_toe_game.rb | 52 +++++++++- ...product_and_sum_of_digits_of_an_integer.rb | 7 +- ..._appearing_more_than_25_in_sorted_array.rb | 12 ++- ...nary_number_in_a_linked_list_to_integer.rb | 21 ++++- ...find_numbers_with_even_number_of_digits.rb | 7 +- ...nts_with_greatest_element_on_right_side.rb | 12 ++- ...4_find_n_unique_integers_sum_up_to_zero.rb | 10 +- ...string_from_alphabet_to_integer_mapping.rb | 7 +- ...1313_decompress_run_length_encoded_list.rb | 7 +- ...eger_to_the_sum_of_two_no_zero_integers.rb | 7 +- test/easy/test_1323_maximum_69_number.rb | 10 +- ...st_1332_remove_palindromic_subsequences.rb | 10 +- test/easy/test_617_merge_two_binary_trees.rb | 5 +- ...st_628_maximum_product_of_three_numbers.rb | 10 +- ...st_637_average_of_levels_in_binary_tree.rb | 5 +- .../test_643_maximum_average_subarray_i.rb | 8 +- test/easy/test_645_set_mismatch.rb | 7 +- .../test_653_two_sum_iv_input_is_a_bst.rb | 5 +- test/easy/test_657_robot_return_to_origin.rb | 11 +-- ...71_second_minimum_node_in_a_binary_tree.rb | 5 +- ...ngest_continuous_increasing_subsequence.rb | 5 +- test/easy/test_680_valid_palindrome_ii.rb | 10 +- test/easy/test_682_baseball_game.rb | 10 +- ...693_binary_number_with_alternating_bits.rb | 10 +- ...test_700_search_in_a_binary_search_tree.rb | 5 +- ...est_703_kth_largest_element_in_a_stream.rb | 2 +- test/easy/test_704_binary_search.rb | 7 +- test/easy/test_705_design_hashset.rb | 2 +- test/easy/test_706_design_hashmap.rb | 2 +- test/easy/test_709_to_lower_case.rb | 10 +- .../test_717_1_bit_and_2_bit_characters.rb | 7 +- test/easy/test_724_find_pivot_index.rb | 10 +- test/easy/test_728_self_dividing_numbers.rb | 5 +- test/easy/test_733_flood_fill.rb | 5 +- ...ind_smallest_letter_greater_than_target.rb | 10 +- .../easy/test_746_min_cost_climbing_stairs.rb | 5 +- ...largest_number_at_least_twice_of_others.rb | 7 +- ...er_of_set_bits_in_binary_representation.rb | 7 +- test/easy/test_766_toeplitz_matrix.rb | 24 ++++- test/easy/test_771_jewels_and_stones.rb | 7 +- ..._783_minimum_distance_between_bst_nodes.rb | 5 +- test/easy/test_796_rotate_string.rb | 7 +- test/easy/test_804_unique_morse_code_words.rb | 7 +- ...est_806_number_of_lines_to_write_string.rb | 5 +- test/easy/test_812_largest_triangle_area.rb | 5 +- test/easy/test_819_most_common_word.rb | 14 ++- ...st_821_shortest_distance_to_a_character.rb | 10 +- .../test_830_positions_of_large_groups.rb | 8 +- test/easy/test_832_flipping_an_image.rb | 35 ++++++- .../easy/test_844_backspace_string_compare.rb | 10 +- test/easy/test_859_buddy_strings.rb | 14 ++- test/easy/test_860_lemonade_change.rb | 15 +-- test/easy/test_867_transpose_matrix.rb | 5 +- test/easy/test_868_binary_gap.rb | 10 +- test/easy/test_872_leaf_similar_trees.rb | 5 +- .../test_876_middle_of_the_linked_list.rb | 25 ++++- ...t_884_uncommon_words_from_two_sentences.rb | 5 +- test/easy/test_896_monotonic_array.rb | 10 +- .../test_897_increasing_order_search_tree.rb | 5 +- test/easy/test_905_sort_array_by_parity.rb | 17 +++- test/easy/test_908_smallest_range_i.rb | 10 +- test/easy/test_917_reverse_only_letters.rb | 29 +++++- test/easy/test_922_sort_array_by_parity_ii.rb | 19 +++- test/easy/test_925_long_pressed_name.rb | 16 ++-- test/easy/test_929_unique_email_addresses.rb | 5 +- test/easy/test_933_number_of_recent_calls.rb | 3 +- test/easy/test_938_range_sum_of_bst.rb | 5 +- test/easy/test_941_valid_mountain_array.rb | 10 +- test/easy/test_942_di_string_match.rb | 10 +- .../test_944_delete_columns_to_make_sorted.rb | 10 +- .../test_953_verifying_an_alien_dictionary.rb | 29 +++++- ...961_n_repeated_element_in_size_2n_array.rb | 14 ++- test/easy/test_965_univalued_binary_tree.rb | 5 +- .../test_976_largest_perimeter_triangle.rb | 7 +- .../test_977_squares_of_a_sorted_array.rb | 19 +++- .../test_989_add_to_array_form_of_integer.rb | 94 ++++++++++++++++--- test/easy/test_993_cousins_in_binary_tree.rb | 8 +- test/easy/test_997_find_the_town_judge.rb | 10 +- 106 files changed, 794 insertions(+), 385 deletions(-) diff --git a/test/easy/test_1002_find_common_characters.rb b/test/easy/test_1002_find_common_characters.rb index 54e9122b..73cd1efb 100644 --- a/test/easy/test_1002_find_common_characters.rb +++ b/test/easy/test_1002_find_common_characters.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class FindCommonCharactersTest < ::Minitest::Test - def test_default - assert_equal(%w[e l l], common_chars(%w[bella label roller])) - assert_equal(%w[c o], common_chars(%w[cool lock cook])) - end + def test_default_one = assert_equal(%w[e l l], common_chars(%w[bella label roller])) + + def test_default_two = assert_equal(%w[c o], common_chars(%w[cool lock cook])) end diff --git a/test/easy/test_1005_maximize_sum_of_array_after_k_negations.rb b/test/easy/test_1005_maximize_sum_of_array_after_k_negations.rb index 8637e794..a6ae1625 100644 --- a/test/easy/test_1005_maximize_sum_of_array_after_k_negations.rb +++ b/test/easy/test_1005_maximize_sum_of_array_after_k_negations.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximizeSumOfArrayAfterKNegationsTest < ::Minitest::Test - def test_default - assert_equal(5, largest_sum_after_k_negations([4, 2, 3], 1)) - assert_equal(6, largest_sum_after_k_negations([3, -1, 0, 2], 3)) - assert_equal(13, largest_sum_after_k_negations([2, -3, -1, 5, -4], 2)) - end + def test_default_one = assert_equal(5, largest_sum_after_k_negations([4, 2, 3], 1)) + + def test_default_two = assert_equal(6, largest_sum_after_k_negations([3, -1, 0, 2], 3)) + + def test_default_three = assert_equal(13, largest_sum_after_k_negations([2, -3, -1, 5, -4], 2)) end diff --git a/test/easy/test_1009_complement_of_base_10_integer.rb b/test/easy/test_1009_complement_of_base_10_integer.rb index 17669c42..2fe95ae2 100644 --- a/test/easy/test_1009_complement_of_base_10_integer.rb +++ b/test/easy/test_1009_complement_of_base_10_integer.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ComplementOfBase10IntegerTest < ::Minitest::Test - def test_default - assert_equal(2, bitwise_complement(5)) - assert_equal(0, bitwise_complement(7)) - assert_equal(5, bitwise_complement(10)) - end + def test_default_one = assert_equal(2, bitwise_complement(5)) + + def test_default_two = assert_equal(0, bitwise_complement(7)) + + def test_default_three = assert_equal(5, bitwise_complement(10)) end diff --git a/test/easy/test_1018_binary_prefix_divisible_by_5.rb b/test/easy/test_1018_binary_prefix_divisible_by_5.rb index 3f660598..c4513ec6 100644 --- a/test/easy/test_1018_binary_prefix_divisible_by_5.rb +++ b/test/easy/test_1018_binary_prefix_divisible_by_5.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class BinaryPrefixDivisibleBy5Test < ::Minitest::Test - def test_default - assert_equal([true, false, false], prefixes_div_by5([0, 1, 1])) - assert_equal([false, false, false], prefixes_div_by5([1, 1, 1])) - end + def test_default_one = assert_equal([true, false, false], prefixes_div_by5([0, 1, 1])) + + def test_default_two = assert_equal([false, false, false], prefixes_div_by5([1, 1, 1])) end diff --git a/test/easy/test_1021_remove_outermost_parentheses.rb b/test/easy/test_1021_remove_outermost_parentheses.rb index da002f62..62c4284c 100644 --- a/test/easy/test_1021_remove_outermost_parentheses.rb +++ b/test/easy/test_1021_remove_outermost_parentheses.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class RemoveOutermostParenthesesTest < ::Minitest::Test - def test_default - assert_equal('()()()', remove_outer_parentheses('(()())(())')) - assert_equal('()()()()(())', remove_outer_parentheses('(()())(())(()(()))')) - assert_equal('', remove_outer_parentheses('()()')) - end + def test_default_one = assert_equal('()()()', remove_outer_parentheses('(()())(())')) + + def test_default_two = assert_equal('()()()()(())', remove_outer_parentheses('(()())(())(()(()))')) + + def test_default_three = assert_equal('', remove_outer_parentheses('()()')) end diff --git a/test/easy/test_1022_sum_of_root_to_leaf_binary_numbers.rb b/test/easy/test_1022_sum_of_root_to_leaf_binary_numbers.rb index 3da97c60..f5f4e61c 100644 --- a/test/easy/test_1022_sum_of_root_to_leaf_binary_numbers.rb +++ b/test/easy/test_1022_sum_of_root_to_leaf_binary_numbers.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class SumOfRootToLeafBinaryNumbersTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 22, sum_root_to_leaf( @@ -25,6 +25,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 0, sum_root_to_leaf( diff --git a/test/easy/test_1025_divisor_game.rb b/test/easy/test_1025_divisor_game.rb index ebed29e1..e313d63a 100644 --- a/test/easy/test_1025_divisor_game.rb +++ b/test/easy/test_1025_divisor_game.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DivisorGameTest < ::Minitest::Test - def test_default - assert(divisor_game(2)) - assert(!divisor_game(3)) - end + def test_default_one = assert(divisor_game(2)) + + def test_default_two = assert(!divisor_game(3)) end diff --git a/test/easy/test_1046_last_stone_weight.rb b/test/easy/test_1046_last_stone_weight.rb index 94111cad..4c6606c7 100644 --- a/test/easy/test_1046_last_stone_weight.rb +++ b/test/easy/test_1046_last_stone_weight.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class LastStoneWeightTest < ::Minitest::Test - def test_default - assert_equal(1, last_stone_weight([2, 7, 4, 1, 8, 1])) - assert_equal(1, last_stone_weight([1])) - end + def test_default_one = assert_equal(1, last_stone_weight([2, 7, 4, 1, 8, 1])) + + def test_default_two = assert_equal(1, last_stone_weight([1])) end diff --git a/test/easy/test_1047_remove_all_adjacent_duplicates_in_string.rb b/test/easy/test_1047_remove_all_adjacent_duplicates_in_string.rb index 0f9676a1..d7c18b33 100644 --- a/test/easy/test_1047_remove_all_adjacent_duplicates_in_string.rb +++ b/test/easy/test_1047_remove_all_adjacent_duplicates_in_string.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class RemoveAllAdjacentDuplicatesInStringTest < ::Minitest::Test - def test_default - assert_equal('ca', remove_duplicates_all('abbaca')) - assert_equal('ay', remove_duplicates_all('azxxzy')) - end + def test_default_one = assert_equal('ca', remove_duplicates_all('abbaca')) + + def test_default_two = assert_equal('ay', remove_duplicates_all('azxxzy')) end diff --git a/test/easy/test_1051_height_checker.rb b/test/easy/test_1051_height_checker.rb index c2fc4fa1..b00e66b3 100644 --- a/test/easy/test_1051_height_checker.rb +++ b/test/easy/test_1051_height_checker.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class HeightCheckerTest < ::Minitest::Test - def test_default - assert_equal(3, height_checker([1, 1, 4, 2, 1, 3])) - assert_equal(5, height_checker([5, 1, 2, 3, 4])) - assert_equal(0, height_checker([1, 2, 3, 4, 5])) - end + def test_default_one = assert_equal(3, height_checker([1, 1, 4, 2, 1, 3])) + + def test_default_two = assert_equal(5, height_checker([5, 1, 2, 3, 4])) + + def test_default_three = assert_equal(0, height_checker([1, 2, 3, 4, 5])) end diff --git a/test/easy/test_1071_greatest_common_divisor_of_strings.rb b/test/easy/test_1071_greatest_common_divisor_of_strings.rb index c0d30e6e..5b58b3c2 100644 --- a/test/easy/test_1071_greatest_common_divisor_of_strings.rb +++ b/test/easy/test_1071_greatest_common_divisor_of_strings.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class GreatestCommonDivisorOfStringsTest < ::Minitest::Test - def test_default - assert_equal('ABC', gcd_of_strings('ABCABC', 'ABC')) - assert_equal('AB', gcd_of_strings('ABABAB', 'ABAB')) - assert_equal('', gcd_of_strings('LEET', 'CODE')) - end + def test_default_one = assert_equal('ABC', gcd_of_strings('ABCABC', 'ABC')) + + def test_default_two = assert_equal('AB', gcd_of_strings('ABABAB', 'ABAB')) + + def test_default_three = assert_equal('', gcd_of_strings('LEET', 'CODE')) end diff --git a/test/easy/test_1078_occurrences_after_bigram.rb b/test/easy/test_1078_occurrences_after_bigram.rb index dd99d872..0cba7cb2 100644 --- a/test/easy/test_1078_occurrences_after_bigram.rb +++ b/test/easy/test_1078_occurrences_after_bigram.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class OccurrencesAfterBigramTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( %w[girl student], find_occurrences( @@ -14,6 +14,9 @@ def test_default 'good' ) ) + end + + def test_default_two assert_equal( %w[we rock], find_occurrences( diff --git a/test/easy/test_1089_duplicate_zeros.rb b/test/easy/test_1089_duplicate_zeros.rb index f9d5de18..53e3a7fa 100644 --- a/test/easy/test_1089_duplicate_zeros.rb +++ b/test/easy/test_1089_duplicate_zeros.rb @@ -5,17 +5,19 @@ require 'minitest/autorun' class DuplicateZerosTest < ::Minitest::Test - def test_default + def test_default_one arr = [1, 0, 2, 3, 0, 4, 5, 0] duplicate_zeros(arr) assert_equal([1, 0, 0, 2, 3, 0, 0, 4], arr) + end + def test_default_two arr = [1, 2, 3] duplicate_zeros(arr) assert_equal([1, 2, 3], arr) end - def test_additional + def test_additional_one arr = [8, 4, 5, 0, 0, 0, 0, 7] duplicate_zeros(arr) assert_equal([8, 4, 5, 0, 0, 0, 0, 0], arr) diff --git a/test/easy/test_1103_distribute_candies_to_people.rb b/test/easy/test_1103_distribute_candies_to_people.rb index 015b6d59..f35aeaea 100644 --- a/test/easy/test_1103_distribute_candies_to_people.rb +++ b/test/easy/test_1103_distribute_candies_to_people.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DistributeCandiesToPeopleTest < ::Minitest::Test - def test_default - assert_equal([1, 2, 3, 1], distribute_candies(7, 4)) - assert_equal([5, 2, 3], distribute_candies(10, 3)) - end + def test_default_one = assert_equal([1, 2, 3, 1], distribute_candies(7, 4)) + + def test_default_two = assert_equal([5, 2, 3], distribute_candies(10, 3)) end diff --git a/test/easy/test_1108_defanging_an_ip_address.rb b/test/easy/test_1108_defanging_an_ip_address.rb index 60060cca..1d642788 100644 --- a/test/easy/test_1108_defanging_an_ip_address.rb +++ b/test/easy/test_1108_defanging_an_ip_address.rb @@ -5,10 +5,13 @@ require 'minitest/autorun' class DefangingAnIPAddressTest < ::Minitest::Test - def test_default - # rubocop:disable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses + # rubocop:disable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses + def test_default_one 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')) - # rubocop:enable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses end + # rubocop:enable Style/DisableCopsWithinSourceCodeDirective, Style/IpAddresses end diff --git a/test/easy/test_1137_n_th_tribonacci_number.rb b/test/easy/test_1137_n_th_tribonacci_number.rb index 1f57bb0f..436d7704 100644 --- a/test/easy/test_1137_n_th_tribonacci_number.rb +++ b/test/easy/test_1137_n_th_tribonacci_number.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class NThTribonacciNumberTest < ::Minitest::Test - def test_default - assert_equal(4, tribonacci(4)) - assert_equal(1_389_537, tribonacci(25)) - end + def test_default_one = assert_equal(4, tribonacci(4)) + + def test_default_two = assert_equal(1_389_537, tribonacci(25)) end diff --git a/test/easy/test_1154_day_of_the_year.rb b/test/easy/test_1154_day_of_the_year.rb index b072111f..58f08455 100644 --- a/test/easy/test_1154_day_of_the_year.rb +++ b/test/easy/test_1154_day_of_the_year.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DayOfTheYearTest < ::Minitest::Test - def test_default - assert_equal(9, day_of_year('2019-01-09')) - assert_equal(41, day_of_year('2019-02-10')) - end + def test_default_one = assert_equal(9, day_of_year('2019-01-09')) + + def test_default_two = assert_equal(41, day_of_year('2019-02-10')) end diff --git a/test/easy/test_1160_find_words_that_can_be_formed_by_characters.rb b/test/easy/test_1160_find_words_that_can_be_formed_by_characters.rb index ec7fb2ac..d10af87e 100644 --- a/test/easy/test_1160_find_words_that_can_be_formed_by_characters.rb +++ b/test/easy/test_1160_find_words_that_can_be_formed_by_characters.rb @@ -5,12 +5,27 @@ require 'minitest/autorun' class FindWordsThatCanBeFormedByCharactersTest < ::Minitest::Test - def test_default - assert_equal(6, count_characters(%w[cat bt hat tree], 'atach')) - assert_equal(10, count_characters(%w[hello world leetcode], 'welldonehoneyr')) + def test_default_one + assert_equal( + 6, + count_characters( + %w[cat bt hat tree], + 'atach' + ) + ) + end + + def test_default_two + assert_equal( + 10, + count_characters( + %w[hello world leetcode], + 'welldonehoneyr' + ) + ) end - def test_additional + def test_additional_one assert_equal( 0, count_characters( diff --git a/test/easy/test_1184_distance_between_bus_stops.rb b/test/easy/test_1184_distance_between_bus_stops.rb index d57788e1..197ededb 100644 --- a/test/easy/test_1184_distance_between_bus_stops.rb +++ b/test/easy/test_1184_distance_between_bus_stops.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class DistanceBetweenBusStopsTest < ::Minitest::Test - def test_default - assert_equal(1, distance_between_bus_stops([1, 2, 3, 4], 0, 1)) - assert_equal(3, distance_between_bus_stops([1, 2, 3, 4], 0, 2)) - assert_equal(4, distance_between_bus_stops([1, 2, 3, 4], 0, 3)) - end + def test_default_one = assert_equal(1, distance_between_bus_stops([1, 2, 3, 4], 0, 1)) + + def test_default_two = assert_equal(3, distance_between_bus_stops([1, 2, 3, 4], 0, 2)) + + def test_default_three = assert_equal(4, distance_between_bus_stops([1, 2, 3, 4], 0, 3)) end diff --git a/test/easy/test_1185_day_of_the_week.rb b/test/easy/test_1185_day_of_the_week.rb index 576f86ca..6e696e35 100644 --- a/test/easy/test_1185_day_of_the_week.rb +++ b/test/easy/test_1185_day_of_the_week.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class DayOfTheWeekTest < ::Minitest::Test - def test_default - assert_equal('Saturday', day_of_the_week(31, 8, 2019)) - assert_equal('Sunday', day_of_the_week(18, 7, 1999)) - assert_equal('Sunday', day_of_the_week(15, 8, 1993)) - end + def test_default_one = assert_equal('Saturday', day_of_the_week(31, 8, 2019)) + + def test_default_two = assert_equal('Sunday', day_of_the_week(18, 7, 1999)) + + def test_default_three = assert_equal('Sunday', day_of_the_week(15, 8, 1993)) end diff --git a/test/easy/test_1189_maximum_number_of_balloons.rb b/test/easy/test_1189_maximum_number_of_balloons.rb index 75a5a8ab..eaaccf24 100644 --- a/test/easy/test_1189_maximum_number_of_balloons.rb +++ b/test/easy/test_1189_maximum_number_of_balloons.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumNumberOfBalloonsTest < ::Minitest::Test - def test_default - assert_equal(1, max_number_of_balloons('nlaebolko')) - assert_equal(2, max_number_of_balloons('loonbalxballpoon')) - assert_equal(0, max_number_of_balloons('leetcode')) - end + def test_default_one = assert_equal(1, max_number_of_balloons('nlaebolko')) + + def test_default_two = assert_equal(2, max_number_of_balloons('loonbalxballpoon')) + + def test_default_three = assert_equal(0, max_number_of_balloons('leetcode')) end diff --git a/test/easy/test_1200_minimum_absolute_difference.rb b/test/easy/test_1200_minimum_absolute_difference.rb index 5c3a115b..8f4bd01c 100644 --- a/test/easy/test_1200_minimum_absolute_difference.rb +++ b/test/easy/test_1200_minimum_absolute_difference.rb @@ -5,18 +5,30 @@ require 'minitest/autorun' class MinimumAbsoluteDifferenceTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [[1, 2], [2, 3], [3, 4]], - minimum_abs_difference([4, 2, 1, 3]) + minimum_abs_difference( + [4, 2, 1, 3] + ) ) + end + + def test_default_two assert_equal( [[1, 3]], - minimum_abs_difference([1, 3, 6, 10, 15]) + minimum_abs_difference( + [1, 3, 6, 10, 15] + ) ) + end + + def test_default_three assert_equal( [[-14, -10], [19, 23], [23, 27]], - minimum_abs_difference([3, 8, -10, 23, 19, -4, -14, 27]) + minimum_abs_difference( + [3, 8, -10, 23, 19, -4, -14, 27] + ) ) end end diff --git a/test/easy/test_1207_unique_number_of_occurrences.rb b/test/easy/test_1207_unique_number_of_occurrences.rb index 7c7849c7..8219a0f5 100644 --- a/test/easy/test_1207_unique_number_of_occurrences.rb +++ b/test/easy/test_1207_unique_number_of_occurrences.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class UniqueNumberOfOccurrencesTest < ::Minitest::Test - def test_default - assert(unique_occurrences([1, 2, 2, 1, 1, 3])) - assert(!unique_occurrences([1, 2])) - assert(unique_occurrences([-3, 0, 1, -3, 1, 1, 1, -3, 10, 0])) - end + def test_default_one = assert(unique_occurrences([1, 2, 2, 1, 1, 3])) + + def test_default_two = assert(!unique_occurrences([1, 2])) + + def test_default_three = assert(unique_occurrences([-3, 0, 1, -3, 1, 1, 1, -3, 10, 0])) end diff --git a/test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb b/test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb index ffe3903d..bbf2cd61 100644 --- a/test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb +++ b/test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MinimumCostToMoveChipsToTheSamePositionTest < ::Minitest::Test - def test_default - assert_equal(1, min_cost_to_move_chips([1, 2, 3])) - assert_equal(2, min_cost_to_move_chips([2, 2, 2, 3, 3])) - assert_equal(1, min_cost_to_move_chips([1, 1, 1_000_000_000])) - end + def test_default_one = assert_equal(1, min_cost_to_move_chips([1, 2, 3])) + + def test_default_two = assert_equal(2, min_cost_to_move_chips([2, 2, 2, 3, 3])) + + def test_default_three = assert_equal(1, min_cost_to_move_chips([1, 1, 1_000_000_000])) end diff --git a/test/easy/test_1221_split_a_string_in_balanced_strings.rb b/test/easy/test_1221_split_a_string_in_balanced_strings.rb index 111e555b..d9eceecd 100644 --- a/test/easy/test_1221_split_a_string_in_balanced_strings.rb +++ b/test/easy/test_1221_split_a_string_in_balanced_strings.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class SplitAStringInBalancedStringsTest < ::Minitest::Test - def test_default - assert_equal(4, balanced_string_split('RLRRLLRLRL')) - assert_equal(2, balanced_string_split('RLRRRLLRLL')) - assert_equal(1, balanced_string_split('LLLLRRRR')) - end + def test_default_one = assert_equal(4, balanced_string_split('RLRRLLRLRL')) + + def test_default_two = assert_equal(2, balanced_string_split('RLRRRLLRLL')) + + def test_default_three = assert_equal(1, balanced_string_split('LLLLRRRR')) end diff --git a/test/easy/test_1232_check_if_it_is_a_straight_line.rb b/test/easy/test_1232_check_if_it_is_a_straight_line.rb index 84287fe7..3de0136a 100644 --- a/test/easy/test_1232_check_if_it_is_a_straight_line.rb +++ b/test/easy/test_1232_check_if_it_is_a_straight_line.rb @@ -5,8 +5,33 @@ require 'minitest/autorun' class CheckIfItIsAStraightLineTest < ::Minitest::Test - def test_default - assert(check_straight_line([[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]])) - assert(!check_straight_line([[1, 1], [2, 2], [3, 4], [4, 5], [5, 6], [7, 7]])) + def test_default_one + assert( + check_straight_line( + [ + [1, 2], + [2, 3], + [3, 4], + [4, 5], + [5, 6], + [6, 7] + ] + ) + ) + end + + def test_default_two + assert( + !check_straight_line( + [ + [1, 1], + [2, 2], + [3, 4], + [4, 5], + [5, 6], + [7, 7] + ] + ) + ) end end diff --git a/test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb b/test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb index 5166653d..35a43faf 100644 --- a/test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb +++ b/test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CellsWithOddValuesInAMatrixTest < ::Minitest::Test - def test_default - assert_equal(6, odd_cells(2, 3, [[0, 1], [1, 1]])) - assert_equal(0, odd_cells(2, 2, [[1, 1], [0, 0]])) - end + def test_default_one = assert_equal(6, odd_cells(2, 3, [[0, 1], [1, 1]])) + + def test_default_two = assert_equal(0, odd_cells(2, 2, [[1, 1], [0, 0]])) end diff --git a/test/easy/test_1266_minimum_time_visiting_all_points.rb b/test/easy/test_1266_minimum_time_visiting_all_points.rb index 4e5c7d8d..fb94407e 100644 --- a/test/easy/test_1266_minimum_time_visiting_all_points.rb +++ b/test/easy/test_1266_minimum_time_visiting_all_points.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class MinimumTimeVisitingAllPointsTest < ::Minitest::Test - def test_default - assert_equal(7, min_time_to_visit_all_points([[1, 1], [3, 4], [-1, 0]])) - assert_equal(5, min_time_to_visit_all_points([[3, 2], [-2, 2]])) + def test_default_one + assert_equal( + 7, + min_time_to_visit_all_points( + [[1, 1], [3, 4], [-1, 0]] + ) + ) + end + + def test_default_two + assert_equal( + 5, + min_time_to_visit_all_points( + [[3, 2], [-2, 2]] + ) + ) end end diff --git a/test/easy/test_1275_find_winner_on_a_tic_tac_toe_game.rb b/test/easy/test_1275_find_winner_on_a_tic_tac_toe_game.rb index 153c1f85..d15b6987 100644 --- a/test/easy/test_1275_find_winner_on_a_tic_tac_toe_game.rb +++ b/test/easy/test_1275_find_winner_on_a_tic_tac_toe_game.rb @@ -5,9 +5,53 @@ require 'minitest/autorun' class FindWinnerOnATicTacToeGameTest < ::Minitest::Test - def test_default - assert_equal('A', tictactoe([[0, 0], [2, 0], [1, 1], [2, 1], [2, 2]])) - assert_equal('B', tictactoe([[0, 0], [1, 1], [0, 1], [0, 2], [1, 0], [2, 0]])) - assert_equal('Draw', tictactoe([[0, 0], [1, 1], [2, 0], [1, 0], [1, 2], [2, 1], [0, 1], [0, 2], [2, 2]])) + def test_default_one + assert_equal( + 'A', + tictactoe( + [ + [0, 0], + [2, 0], + [1, 1], + [2, 1], + [2, 2] + ] + ) + ) + end + + def test_default_two + assert_equal( + 'B', + tictactoe( + [ + [0, 0], + [1, 1], + [0, 1], + [0, 2], + [1, 0], + [2, 0] + ] + ) + ) + end + + def test_default_three + assert_equal( + 'Draw', + tictactoe( + [ + [0, 0], + [1, 1], + [2, 0], + [1, 0], + [1, 2], + [2, 1], + [0, 1], + [0, 2], + [2, 2] + ] + ) + ) end end diff --git a/test/easy/test_1281_subtract_the_product_and_sum_of_digits_of_an_integer.rb b/test/easy/test_1281_subtract_the_product_and_sum_of_digits_of_an_integer.rb index 9649d433..8b89da98 100644 --- a/test/easy/test_1281_subtract_the_product_and_sum_of_digits_of_an_integer.rb +++ b/test/easy/test_1281_subtract_the_product_and_sum_of_digits_of_an_integer.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class SubtractTheProductAndSumOfDigitsOfAnIntegerTest < ::Minitest::Test - def test_default - assert_equal(15, subtract_product_and_sum(234)) - assert_equal(21, subtract_product_and_sum(4421)) - end + def test_default_one = assert_equal(15, subtract_product_and_sum(234)) + + def test_default_two = assert_equal(21, subtract_product_and_sum(4421)) end diff --git a/test/easy/test_1287_element_appearing_more_than_25_in_sorted_array.rb b/test/easy/test_1287_element_appearing_more_than_25_in_sorted_array.rb index ba62c534..d1278673 100644 --- a/test/easy/test_1287_element_appearing_more_than_25_in_sorted_array.rb +++ b/test/easy/test_1287_element_appearing_more_than_25_in_sorted_array.rb @@ -5,8 +5,14 @@ require 'minitest/autorun' class ElementAppearingMoreThan25InSortedArrayTest < ::Minitest::Test - def test_default - assert_equal(6, find_special_integer([1, 2, 2, 6, 6, 6, 6, 7, 10])) - assert_equal(1, find_special_integer([1, 1])) + def test_default_one + assert_equal( + 6, + find_special_integer( + [1, 2, 2, 6, 6, 6, 6, 7, 10] + ) + ) end + + def test_default_two = assert_equal(1, find_special_integer([1, 1])) end diff --git a/test/easy/test_1290_convert_binary_number_in_a_linked_list_to_integer.rb b/test/easy/test_1290_convert_binary_number_in_a_linked_list_to_integer.rb index ba1d472f..cfa59fa8 100644 --- a/test/easy/test_1290_convert_binary_number_in_a_linked_list_to_integer.rb +++ b/test/easy/test_1290_convert_binary_number_in_a_linked_list_to_integer.rb @@ -6,8 +6,23 @@ require 'minitest/autorun' class ConvertBinaryNumberInALinkedListToIntegerTest < ::Minitest::Test - def test_default - assert_equal(5, get_decimal_value(::ListNode.from_array([1, 0, 1]))) - assert_equal(0, get_decimal_value(::ListNode.from_array([0]))) + def test_default_one + assert_equal( + 5, + get_decimal_value( + ::ListNode.from_array( + [1, 0, 1] + ) + ) + ) + end + + def test_default_two + assert_equal( + 0, + get_decimal_value( + ::ListNode.from_array([0]) + ) + ) end end diff --git a/test/easy/test_1295_find_numbers_with_even_number_of_digits.rb b/test/easy/test_1295_find_numbers_with_even_number_of_digits.rb index e3b710f2..33b0675d 100644 --- a/test/easy/test_1295_find_numbers_with_even_number_of_digits.rb +++ b/test/easy/test_1295_find_numbers_with_even_number_of_digits.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class FindNumbersWithEvenNumberOfDigitTest < ::Minitest::Test - def test_default - assert_equal(2, find_numbers([12, 345, 2, 6, 7896])) - assert_equal(1, find_numbers([555, 901, 482, 1771])) - end + def test_default_one = assert_equal(2, find_numbers([12, 345, 2, 6, 7896])) + + def test_default_two = assert_equal(1, find_numbers([555, 901, 482, 1771])) end diff --git a/test/easy/test_1299_replace_elements_with_greatest_element_on_right_side.rb b/test/easy/test_1299_replace_elements_with_greatest_element_on_right_side.rb index c1d91451..2d126831 100644 --- a/test/easy/test_1299_replace_elements_with_greatest_element_on_right_side.rb +++ b/test/easy/test_1299_replace_elements_with_greatest_element_on_right_side.rb @@ -5,8 +5,14 @@ require 'minitest/autorun' class ReplaceElementsWithGreatestElementOnRightSideTest < ::Minitest::Test - def test_default - assert_equal([18, 6, 6, 6, 1, -1], replace_elements([17, 18, 5, 4, 6, 1])) - assert_equal([-1], replace_elements([400])) + def test_default_one + assert_equal( + [18, 6, 6, 6, 1, -1], + replace_elements( + [17, 18, 5, 4, 6, 1] + ) + ) end + + def test_default_two = assert_equal([-1], replace_elements([400])) end diff --git a/test/easy/test_1304_find_n_unique_integers_sum_up_to_zero.rb b/test/easy/test_1304_find_n_unique_integers_sum_up_to_zero.rb index f0613456..dce7f862 100644 --- a/test/easy/test_1304_find_n_unique_integers_sum_up_to_zero.rb +++ b/test/easy/test_1304_find_n_unique_integers_sum_up_to_zero.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FindNUniqueIntegersSumUpToZeroTest < ::Minitest::Test - def test_default - assert_equal([-2, -1, 0, 1, 2], sum_zero(5)) - assert_equal([-1, 0, 1], sum_zero(3)) - assert_equal([0], sum_zero(1)) - end + def test_default_one = assert_equal([-2, -1, 0, 1, 2], sum_zero(5)) + + def test_default_two = assert_equal([-1, 0, 1], sum_zero(3)) + + def test_default_three = assert_equal([0], sum_zero(1)) end diff --git a/test/easy/test_1309_decrypt_string_from_alphabet_to_integer_mapping.rb b/test/easy/test_1309_decrypt_string_from_alphabet_to_integer_mapping.rb index 7549ec09..39e089a9 100644 --- a/test/easy/test_1309_decrypt_string_from_alphabet_to_integer_mapping.rb +++ b/test/easy/test_1309_decrypt_string_from_alphabet_to_integer_mapping.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DecryptStringFromAlphabetToIntegerMappingTest < ::Minitest::Test - def test_default - assert_equal('jkab', freq_alphabets('10#11#12')) - assert_equal('acz', freq_alphabets('1326#')) - end + def test_default_one = assert_equal('jkab', freq_alphabets('10#11#12')) + + def test_default_two = assert_equal('acz', freq_alphabets('1326#')) end diff --git a/test/easy/test_1313_decompress_run_length_encoded_list.rb b/test/easy/test_1313_decompress_run_length_encoded_list.rb index de6b40d0..ad501173 100644 --- a/test/easy/test_1313_decompress_run_length_encoded_list.rb +++ b/test/easy/test_1313_decompress_run_length_encoded_list.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DecompressRunLengthEncodedListTest < ::Minitest::Test - def test_default - assert_equal([2, 4, 4, 4], decompress_rl_elist([1, 2, 3, 4])) - assert_equal([1, 3, 3], decompress_rl_elist([1, 1, 2, 3])) - end + def test_default_one = assert_equal([2, 4, 4, 4], decompress_rl_elist([1, 2, 3, 4])) + + def test_default_two = assert_equal([1, 3, 3], decompress_rl_elist([1, 1, 2, 3])) end diff --git a/test/easy/test_1317_convert_integer_to_the_sum_of_two_no_zero_integers.rb b/test/easy/test_1317_convert_integer_to_the_sum_of_two_no_zero_integers.rb index 93393ccb..b653da0a 100644 --- a/test/easy/test_1317_convert_integer_to_the_sum_of_two_no_zero_integers.rb +++ b/test/easy/test_1317_convert_integer_to_the_sum_of_two_no_zero_integers.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ConvertIntegerToTheSumOfTwoNoZerosIntegersTest < ::Minitest::Test - def test_default - assert_equal([1, 1], get_no_zero_integers(2)) - assert_equal([2, 9], get_no_zero_integers(11)) - end + def test_default_one = assert_equal([1, 1], get_no_zero_integers(2)) + + def test_default_two = assert_equal([2, 9], get_no_zero_integers(11)) end diff --git a/test/easy/test_1323_maximum_69_number.rb b/test/easy/test_1323_maximum_69_number.rb index 16ba9e8e..d83f0e7f 100644 --- a/test/easy/test_1323_maximum_69_number.rb +++ b/test/easy/test_1323_maximum_69_number.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class Maximum69NumberTest < ::Minitest::Test - def test_default - assert_equal(9969, maximum69_number(9669)) - assert_equal(9999, maximum69_number(9996)) - assert_equal(9999, maximum69_number(9999)) - end + def test_default_one = assert_equal(9969, maximum69_number(9669)) + + def test_default_two = assert_equal(9999, maximum69_number(9996)) + + def test_default_three = assert_equal(9999, maximum69_number(9999)) end diff --git a/test/easy/test_1332_remove_palindromic_subsequences.rb b/test/easy/test_1332_remove_palindromic_subsequences.rb index 20d50c02..f8498543 100644 --- a/test/easy/test_1332_remove_palindromic_subsequences.rb +++ b/test/easy/test_1332_remove_palindromic_subsequences.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class RemovePalindromicSubsequencesTest < ::Minitest::Test - def test_default - assert_equal(1, remove_palindrome_sub('ababa')) - assert_equal(2, remove_palindrome_sub('abb')) - assert_equal(2, remove_palindrome_sub('baabb')) - end + def test_default_one = assert_equal(1, remove_palindrome_sub('ababa')) + + def test_default_two = assert_equal(2, remove_palindrome_sub('abb')) + + def test_default_three = assert_equal(2, remove_palindrome_sub('baabb')) end diff --git a/test/easy/test_617_merge_two_binary_trees.rb b/test/easy/test_617_merge_two_binary_trees.rb index ebce1eaa..f6b68da6 100644 --- a/test/easy/test_617_merge_two_binary_trees.rb +++ b/test/easy/test_617_merge_two_binary_trees.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class MergeTwoBinaryTreesTest < ::Minitest::Test - def test_default + def test_default_one assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -48,6 +48,9 @@ def test_default ) ) ) + end + + def test_default_two assert( ::TreeNode.are_equals( ::TreeNode.new( diff --git a/test/easy/test_628_maximum_product_of_three_numbers.rb b/test/easy/test_628_maximum_product_of_three_numbers.rb index 2f67493b..679a6f1b 100644 --- a/test/easy/test_628_maximum_product_of_three_numbers.rb +++ b/test/easy/test_628_maximum_product_of_three_numbers.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumProductOfThreeNumbersTest < ::Minitest::Test - def test_default - assert_equal(6, maximum_product([1, 2, 3])) - assert_equal(24, maximum_product([1, 2, 3, 4])) - assert_equal(-6, maximum_product([-1, -2, -3])) - end + def test_default_one = assert_equal(6, maximum_product([1, 2, 3])) + + def test_default_two = assert_equal(24, maximum_product([1, 2, 3, 4])) + + def test_default_three = assert_equal(-6, maximum_product([-1, -2, -3])) end diff --git a/test/easy/test_637_average_of_levels_in_binary_tree.rb b/test/easy/test_637_average_of_levels_in_binary_tree.rb index 4a7ed0a5..f112a678 100644 --- a/test/easy/test_637_average_of_levels_in_binary_tree.rb +++ b/test/easy/test_637_average_of_levels_in_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class AverageOfLevelsInBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [3.00000, 14.50000, 11.00000], average_of_levels( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( [3.00000, 14.50000, 11.00000], average_of_levels( diff --git a/test/easy/test_643_maximum_average_subarray_i.rb b/test/easy/test_643_maximum_average_subarray_i.rb index 97a1e6a6..5b60e944 100644 --- a/test/easy/test_643_maximum_average_subarray_i.rb +++ b/test/easy/test_643_maximum_average_subarray_i.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class MaximumAverageSubarrayITest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 12.75000, find_max_average( @@ -13,9 +13,7 @@ def test_default 4 ) ) - assert_equal( - 5.00000, - find_max_average([5], 1) - ) end + + def test_default_two = assert_equal(5.00000, find_max_average([5], 1)) end diff --git a/test/easy/test_645_set_mismatch.rb b/test/easy/test_645_set_mismatch.rb index 80caeba7..bd66b9f3 100644 --- a/test/easy/test_645_set_mismatch.rb +++ b/test/easy/test_645_set_mismatch.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class SetMismatchTest < ::Minitest::Test - def test_default - assert_equal([2, 3], find_error_nums([1, 2, 2, 4])) - assert_equal([1, 2], find_error_nums([1, 1])) - end + def test_default_one = assert_equal([2, 3], find_error_nums([1, 2, 2, 4])) + + def test_default_two = assert_equal([1, 2], find_error_nums([1, 1])) end diff --git a/test/easy/test_653_two_sum_iv_input_is_a_bst.rb b/test/easy/test_653_two_sum_iv_input_is_a_bst.rb index 5573f423..cdbedb8b 100644 --- a/test/easy/test_653_two_sum_iv_input_is_a_bst.rb +++ b/test/easy/test_653_two_sum_iv_input_is_a_bst.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class TwoSumIVInputIsABSTTest < ::Minitest::Test - def test_default + def test_default_one assert( find_target( ::TreeNode.new( @@ -25,6 +25,9 @@ def test_default 9 ) ) + end + + def test_default_two assert( !find_target( ::TreeNode.new( diff --git a/test/easy/test_657_robot_return_to_origin.rb b/test/easy/test_657_robot_return_to_origin.rb index 5cb222fd..ddbd57b0 100644 --- a/test/easy/test_657_robot_return_to_origin.rb +++ b/test/easy/test_657_robot_return_to_origin.rb @@ -5,12 +5,9 @@ require 'minitest/autorun' class RobotReturnToOriginTest < ::Minitest::Test - def test_default - assert(judge_circle('UD')) - assert(!judge_circle('LL')) - end + def test_default_one = assert(judge_circle('UD')) - def test_additional - assert(judge_circle('RL')) - end + def test_default_two = assert(!judge_circle('LL')) + + def test_additional_one = assert(judge_circle('RL')) end diff --git a/test/easy/test_671_second_minimum_node_in_a_binary_tree.rb b/test/easy/test_671_second_minimum_node_in_a_binary_tree.rb index 846e9fbd..e1b949ba 100644 --- a/test/easy/test_671_second_minimum_node_in_a_binary_tree.rb +++ b/test/easy/test_671_second_minimum_node_in_a_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class SecondMinimumNodeInABinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 5, find_second_minimum_value( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( -1, find_second_minimum_value( diff --git a/test/easy/test_674_longest_continuous_increasing_subsequence.rb b/test/easy/test_674_longest_continuous_increasing_subsequence.rb index de0add24..ae766bdb 100644 --- a/test/easy/test_674_longest_continuous_increasing_subsequence.rb +++ b/test/easy/test_674_longest_continuous_increasing_subsequence.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class LongestContinuousIncreasingSubsequenceTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 3, find_length_of_lcis( [1, 3, 5, 4, 7] ) ) + end + + def test_default_two assert_equal( 1, find_length_of_lcis( diff --git a/test/easy/test_680_valid_palindrome_ii.rb b/test/easy/test_680_valid_palindrome_ii.rb index 31507cdd..2543db92 100644 --- a/test/easy/test_680_valid_palindrome_ii.rb +++ b/test/easy/test_680_valid_palindrome_ii.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ValidPalindromeIITest < ::Minitest::Test - def test_default - assert(valid_palindrome_ii('aba')) - assert(valid_palindrome_ii('abca')) - assert(!valid_palindrome_ii('abc')) - end + def test_default_one = assert(valid_palindrome_ii('aba')) + + def test_default_two = assert(valid_palindrome_ii('abca')) + + def test_default_three = assert(!valid_palindrome_ii('abc')) end diff --git a/test/easy/test_682_baseball_game.rb b/test/easy/test_682_baseball_game.rb index 026fc800..cadfa57a 100644 --- a/test/easy/test_682_baseball_game.rb +++ b/test/easy/test_682_baseball_game.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class BaseballGameTest < ::Minitest::Test - def test_default - assert_equal(30, cal_points(%w[5 2 C D +])) - assert_equal(27, cal_points(%w[5 -2 4 C D 9 + +])) - assert_equal(0, cal_points(%w[1 C])) - end + def test_default_one = assert_equal(30, cal_points(%w[5 2 C D +])) + + def test_default_two = assert_equal(27, cal_points(%w[5 -2 4 C D 9 + +])) + + def test_default_three = assert_equal(0, cal_points(%w[1 C])) end diff --git a/test/easy/test_693_binary_number_with_alternating_bits.rb b/test/easy/test_693_binary_number_with_alternating_bits.rb index 63c39d6d..00436318 100644 --- a/test/easy/test_693_binary_number_with_alternating_bits.rb +++ b/test/easy/test_693_binary_number_with_alternating_bits.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class BinaryNumberWithAlternatingBitsTest < ::Minitest::Test - def test_default - assert(has_alternating_bits(5)) - assert(!has_alternating_bits(7)) - assert(!has_alternating_bits(11)) - end + def test_default_one = assert(has_alternating_bits(5)) + + def test_default_two = assert(!has_alternating_bits(7)) + + def test_default_three = assert(!has_alternating_bits(11)) end diff --git a/test/easy/test_700_search_in_a_binary_search_tree.rb b/test/easy/test_700_search_in_a_binary_search_tree.rb index ab7b58fd..203bb044 100644 --- a/test/easy/test_700_search_in_a_binary_search_tree.rb +++ b/test/easy/test_700_search_in_a_binary_search_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class SearchInABinarySearchTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -28,6 +28,9 @@ def test_default ) ) ) + end + + def test_default_two assert_nil( search_bst( ::TreeNode.new( diff --git a/test/easy/test_703_kth_largest_element_in_a_stream.rb b/test/easy/test_703_kth_largest_element_in_a_stream.rb index 61627311..1ffbf172 100644 --- a/test/easy/test_703_kth_largest_element_in_a_stream.rb +++ b/test/easy/test_703_kth_largest_element_in_a_stream.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class KthLargestElementInAStreamTest < ::Minitest::Test - def test_default + def test_default_one kth_largest = ::KthLargest.new(3, [4, 5, 8, 2]) assert_equal(4, kth_largest.add(3)) diff --git a/test/easy/test_704_binary_search.rb b/test/easy/test_704_binary_search.rb index 0f8abede..3b1a9c42 100644 --- a/test/easy/test_704_binary_search.rb +++ b/test/easy/test_704_binary_search.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class BinarySearchTest < ::Minitest::Test - def test_default - assert_equal(4, search([-1, 0, 3, 5, 9, 12], 9)) - assert_equal(-1, search([-1, 0, 3, 5, 9, 12], 2)) - end + def test_default_one = assert_equal(4, search([-1, 0, 3, 5, 9, 12], 9)) + + def test_default_two = assert_equal(-1, search([-1, 0, 3, 5, 9, 12], 2)) end diff --git a/test/easy/test_705_design_hashset.rb b/test/easy/test_705_design_hashset.rb index dbc6a830..f81cc038 100644 --- a/test/easy/test_705_design_hashset.rb +++ b/test/easy/test_705_design_hashset.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class DesignHashSetTest < ::Minitest::Test - def test_default + def test_default_one my_hashset = ::MyHashSet.new my_hashset.add(1) my_hashset.add(2) diff --git a/test/easy/test_706_design_hashmap.rb b/test/easy/test_706_design_hashmap.rb index 92ffdfc3..3355db4e 100644 --- a/test/easy/test_706_design_hashmap.rb +++ b/test/easy/test_706_design_hashmap.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class DesignHashMapTest < ::Minitest::Test - def test_default + def test_default_one my_hashmap = ::MyHashMap.new my_hashmap.put(1, 1) my_hashmap.put(2, 2) diff --git a/test/easy/test_709_to_lower_case.rb b/test/easy/test_709_to_lower_case.rb index 2353c02b..61390bbc 100644 --- a/test/easy/test_709_to_lower_case.rb +++ b/test/easy/test_709_to_lower_case.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ToLowerCaseTest < ::Minitest::Test - def test_default - assert_equal('hello', to_lower_case('Hello')) - assert_equal('here', to_lower_case('here')) - assert_equal('lovely', to_lower_case('LOVELY')) - end + def test_default_one = assert_equal('hello', to_lower_case('Hello')) + + def test_default_two = assert_equal('here', to_lower_case('here')) + + def test_default_three = assert_equal('lovely', to_lower_case('LOVELY')) end diff --git a/test/easy/test_717_1_bit_and_2_bit_characters.rb b/test/easy/test_717_1_bit_and_2_bit_characters.rb index 72b25571..7fad1d31 100644 --- a/test/easy/test_717_1_bit_and_2_bit_characters.rb +++ b/test/easy/test_717_1_bit_and_2_bit_characters.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class OneBitTwoBitCharactersTest < ::Minitest::Test - def test_default - assert(is_one_bit_character([1, 0, 0])) - assert(!is_one_bit_character([1, 1, 1, 0])) - end + def test_default_one = assert(is_one_bit_character([1, 0, 0])) + + def test_default_two = assert(!is_one_bit_character([1, 1, 1, 0])) end diff --git a/test/easy/test_724_find_pivot_index.rb b/test/easy/test_724_find_pivot_index.rb index 1cc30d92..83948419 100644 --- a/test/easy/test_724_find_pivot_index.rb +++ b/test/easy/test_724_find_pivot_index.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FindPivotIndexTest < ::Minitest::Test - def test_default - assert_equal(3, pivot_index([1, 7, 3, 6, 5, 6])) - assert_equal(-1, pivot_index([1, 2, 3])) - assert_equal(0, pivot_index([2, 1, -1])) - end + def test_default_one = assert_equal(3, pivot_index([1, 7, 3, 6, 5, 6])) + + def test_default_two = assert_equal(-1, pivot_index([1, 2, 3])) + + def test_default_three = assert_equal(0, pivot_index([2, 1, -1])) end diff --git a/test/easy/test_728_self_dividing_numbers.rb b/test/easy/test_728_self_dividing_numbers.rb index 83d59cd1..97fe0c12 100644 --- a/test/easy/test_728_self_dividing_numbers.rb +++ b/test/easy/test_728_self_dividing_numbers.rb @@ -5,11 +5,14 @@ require 'minitest/autorun' class SelfDividingNumbersTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22], self_dividing_numbers(1, 22) ) + end + + def test_default_two assert_equal( [48, 55, 66, 77], self_dividing_numbers(47, 85) diff --git a/test/easy/test_733_flood_fill.rb b/test/easy/test_733_flood_fill.rb index 36e49dde..de7bc8e6 100644 --- a/test/easy/test_733_flood_fill.rb +++ b/test/easy/test_733_flood_fill.rb @@ -5,11 +5,14 @@ require 'minitest/autorun' class FloodFillTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [[2, 2, 2], [2, 2, 0], [2, 0, 1]], flood_fill([[1, 1, 1], [1, 1, 0], [1, 0, 1]], 1, 1, 2) ) + end + + def test_default_two assert_equal( [[0, 0, 0], [0, 0, 0]], flood_fill([[0, 0, 0], [0, 0, 0]], 0, 0, 0) diff --git a/test/easy/test_744_find_smallest_letter_greater_than_target.rb b/test/easy/test_744_find_smallest_letter_greater_than_target.rb index 25b20bb7..4daa0297 100644 --- a/test/easy/test_744_find_smallest_letter_greater_than_target.rb +++ b/test/easy/test_744_find_smallest_letter_greater_than_target.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FindSmallestLetterGreaterThanTargetTest < ::Minitest::Test - def test_default - assert_equal('c', next_greatest_letter(%w[c f j], 'a')) - assert_equal('f', next_greatest_letter(%w[c f j], 'c')) - assert_equal('x', next_greatest_letter(%w[x x y y], 'z')) - end + def test_default_one = assert_equal('c', next_greatest_letter(%w[c f j], 'a')) + + def test_default_two = assert_equal('f', next_greatest_letter(%w[c f j], 'c')) + + def test_default_three = assert_equal('x', next_greatest_letter(%w[x x y y], 'z')) end diff --git a/test/easy/test_746_min_cost_climbing_stairs.rb b/test/easy/test_746_min_cost_climbing_stairs.rb index 69950ec9..28a322ab 100644 --- a/test/easy/test_746_min_cost_climbing_stairs.rb +++ b/test/easy/test_746_min_cost_climbing_stairs.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class MinCostClimbingStairsTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 15, min_cost_climbing_stairs( [10, 15, 20] ) ) + end + + def test_default_two assert_equal( 6, min_cost_climbing_stairs( diff --git a/test/easy/test_747_largest_number_at_least_twice_of_others.rb b/test/easy/test_747_largest_number_at_least_twice_of_others.rb index bca27809..590abcca 100644 --- a/test/easy/test_747_largest_number_at_least_twice_of_others.rb +++ b/test/easy/test_747_largest_number_at_least_twice_of_others.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class LargestNumberAtLeastTwiceOfOthersTest < ::Minitest::Test - def test_default - assert_equal(1, dominant_index([3, 6, 1, 0])) - assert_equal(-1, dominant_index([1, 2, 3, 4])) - end + def test_default_one = assert_equal(1, dominant_index([3, 6, 1, 0])) + + def test_default_two = assert_equal(-1, dominant_index([1, 2, 3, 4])) end diff --git a/test/easy/test_762_prime_number_of_set_bits_in_binary_representation.rb b/test/easy/test_762_prime_number_of_set_bits_in_binary_representation.rb index a1d742eb..180600d7 100644 --- a/test/easy/test_762_prime_number_of_set_bits_in_binary_representation.rb +++ b/test/easy/test_762_prime_number_of_set_bits_in_binary_representation.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class PrimeNumberOfSetBitsInBinaryRepresentationTest < ::Minitest::Test - def test_default - assert_equal(4, count_prime_set_bits(6, 10)) - assert_equal(5, count_prime_set_bits(10, 15)) - end + def test_default_one = assert_equal(4, count_prime_set_bits(6, 10)) + + def test_default_two = assert_equal(5, count_prime_set_bits(10, 15)) end diff --git a/test/easy/test_766_toeplitz_matrix.rb b/test/easy/test_766_toeplitz_matrix.rb index 105cd694..6b5c0e81 100644 --- a/test/easy/test_766_toeplitz_matrix.rb +++ b/test/easy/test_766_toeplitz_matrix.rb @@ -5,8 +5,26 @@ require 'minitest/autorun' class ToeplitzMatrixTest < ::Minitest::Test - def test_default - assert(is_toeplitz_matrix([[1, 2, 3, 4], [5, 1, 2, 3], [9, 5, 1, 2]])) - assert(!is_toeplitz_matrix([[1, 2], [2, 2]])) + def test_default_one + assert( + is_toeplitz_matrix( + [ + [1, 2, 3, 4], + [5, 1, 2, 3], + [9, 5, 1, 2] + ] + ) + ) + end + + def test_default_two + assert( + !is_toeplitz_matrix( + [ + [1, 2], + [2, 2] + ] + ) + ) end end diff --git a/test/easy/test_771_jewels_and_stones.rb b/test/easy/test_771_jewels_and_stones.rb index ba82cdd6..be1c6951 100644 --- a/test/easy/test_771_jewels_and_stones.rb +++ b/test/easy/test_771_jewels_and_stones.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class JewelsAndStonesTest < ::Minitest::Test - def test_default - assert_equal(3, num_jewels_in_stones('aA', 'aAAbbbb')) - assert_equal(0, num_jewels_in_stones('z', 'ZZ')) - end + def test_default_one = assert_equal(3, num_jewels_in_stones('aA', 'aAAbbbb')) + + def test_default_two = assert_equal(0, num_jewels_in_stones('z', 'ZZ')) end diff --git a/test/easy/test_783_minimum_distance_between_bst_nodes.rb b/test/easy/test_783_minimum_distance_between_bst_nodes.rb index f777636f..b82da6f3 100644 --- a/test/easy/test_783_minimum_distance_between_bst_nodes.rb +++ b/test/easy/test_783_minimum_distance_between_bst_nodes.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class MinimumDistanceBetweenBSTNodesTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 1, min_diff_in_bst( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 1, min_diff_in_bst( diff --git a/test/easy/test_796_rotate_string.rb b/test/easy/test_796_rotate_string.rb index a73ad9b3..e81a4b82 100644 --- a/test/easy/test_796_rotate_string.rb +++ b/test/easy/test_796_rotate_string.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class RotateStringTest < ::Minitest::Test - def test_default - assert(rotate_string('abcde', 'cdeab')) - assert(!rotate_string('abcde', 'abced')) - end + def test_default_one = assert(rotate_string('abcde', 'cdeab')) + + def test_default_two = assert(!rotate_string('abcde', 'abced')) end diff --git a/test/easy/test_804_unique_morse_code_words.rb b/test/easy/test_804_unique_morse_code_words.rb index 652b249e..a10543c1 100644 --- a/test/easy/test_804_unique_morse_code_words.rb +++ b/test/easy/test_804_unique_morse_code_words.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class UniqueMorseCodeWordsTest < ::Minitest::Test - def test_default - assert_equal(2, unique_morse_representations(%w[gin zen gig msg])) - assert_equal(1, unique_morse_representations(['a'])) - end + def test_default_one = assert_equal(2, unique_morse_representations(%w[gin zen gig msg])) + + def test_default_two = assert_equal(1, unique_morse_representations(['a'])) end diff --git a/test/easy/test_806_number_of_lines_to_write_string.rb b/test/easy/test_806_number_of_lines_to_write_string.rb index 0cc7257b..61e89d26 100644 --- a/test/easy/test_806_number_of_lines_to_write_string.rb +++ b/test/easy/test_806_number_of_lines_to_write_string.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class NumberOfLinesToWriteStringTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [3, 60], number_of_lines( @@ -13,6 +13,9 @@ def test_default 'abcdefghijklmnopqrstuvwxyz' ) ) + end + + def test_default_two assert_equal( [2, 4], number_of_lines( diff --git a/test/easy/test_812_largest_triangle_area.rb b/test/easy/test_812_largest_triangle_area.rb index 94ebee0d..b1517e35 100644 --- a/test/easy/test_812_largest_triangle_area.rb +++ b/test/easy/test_812_largest_triangle_area.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class LargestTriangleAreaTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 2.00000, largest_triangle_area( [[0, 0], [0, 1], [1, 0], [0, 2], [2, 0]] ) ) + end + + def test_default_two assert_equal( 0.50000, largest_triangle_area( diff --git a/test/easy/test_819_most_common_word.rb b/test/easy/test_819_most_common_word.rb index e70280bd..cdbe85a8 100644 --- a/test/easy/test_819_most_common_word.rb +++ b/test/easy/test_819_most_common_word.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class MostCommonWordTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 'ball', most_common_word( @@ -13,10 +13,16 @@ def test_default ['hit'] ) ) - assert_equal('a', most_common_word('a.', [])) end - def test_additional - assert_equal('ball', most_common_word('Bob. hIt, baLl', %w[bob hit])) + def test_default_two = assert_equal('a', most_common_word('a.', [])) + + def test_additional_one + assert_equal( + 'ball', + most_common_word( + 'Bob. hIt, baLl', %w[bob hit] + ) + ) end end diff --git a/test/easy/test_821_shortest_distance_to_a_character.rb b/test/easy/test_821_shortest_distance_to_a_character.rb index b7a06b11..ea293d96 100644 --- a/test/easy/test_821_shortest_distance_to_a_character.rb +++ b/test/easy/test_821_shortest_distance_to_a_character.rb @@ -5,11 +5,17 @@ require 'minitest/autorun' class ShortestDistanceToACharacterTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0], shortest_to_char('loveleetcode', 'e') ) - assert_equal([3, 2, 1, 0], shortest_to_char('aaab', 'b')) + end + + def test_default_two + assert_equal( + [3, 2, 1, 0], + shortest_to_char('aaab', 'b') + ) end end diff --git a/test/easy/test_830_positions_of_large_groups.rb b/test/easy/test_830_positions_of_large_groups.rb index 330c1401..420c192d 100644 --- a/test/easy/test_830_positions_of_large_groups.rb +++ b/test/easy/test_830_positions_of_large_groups.rb @@ -5,9 +5,11 @@ require 'minitest/autorun' class PositionsOfLargeGroupsTest < ::Minitest::Test - def test_default - assert_equal([[3, 6]], large_group_positions('abbxxxxzzy')) - assert_equal([], large_group_positions('abc')) + def test_default_one = assert_equal([[3, 6]], large_group_positions('abbxxxxzzy')) + + def test_default_two = assert_equal([], large_group_positions('abc')) + + def test_default_three assert_equal( [[3, 5], [6, 9], [12, 14]], large_group_positions('abcdddeeeeaabbbcd') diff --git a/test/easy/test_832_flipping_an_image.rb b/test/easy/test_832_flipping_an_image.rb index 855a8be9..ec06db64 100644 --- a/test/easy/test_832_flipping_an_image.rb +++ b/test/easy/test_832_flipping_an_image.rb @@ -5,14 +5,39 @@ require 'minitest/autorun' class FlippingAnImageTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [[1, 0, 0], [0, 1, 0], [1, 1, 1]], - flip_and_invert_image([[1, 1, 0], [1, 0, 1], [0, 0, 0]]) + [ + [1, 0, 0], + [0, 1, 0], + [1, 1, 1] + ], + flip_and_invert_image( + [ + [1, 1, 0], + [1, 0, 1], + [0, 0, 0] + ] + ) ) + end + + def test_default_two assert_equal( - [[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 0, 1], [1, 0, 1, 0]], - flip_and_invert_image([[1, 1, 0, 0], [1, 0, 0, 1], [0, 1, 1, 1], [1, 0, 1, 0]]) + [ + [1, 1, 0, 0], + [0, 1, 1, 0], + [0, 0, 0, 1], + [1, 0, 1, 0] + ], + flip_and_invert_image( + [ + [1, 1, 0, 0], + [1, 0, 0, 1], + [0, 1, 1, 1], + [1, 0, 1, 0] + ] + ) ) end end diff --git a/test/easy/test_844_backspace_string_compare.rb b/test/easy/test_844_backspace_string_compare.rb index d455b612..16be1350 100644 --- a/test/easy/test_844_backspace_string_compare.rb +++ b/test/easy/test_844_backspace_string_compare.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class BackspaceStringCompareTest < ::Minitest::Test - def test_default - assert(backspace_compare('ab#c', 'ad#c')) - assert(backspace_compare('ab##', 'c#d#')) - assert(!backspace_compare('a#c', 'b')) - end + def test_default_one = assert(backspace_compare('ab#c', 'ad#c')) + + def test_default_two = assert(backspace_compare('ab##', 'c#d#')) + + def test_default_three = assert(!backspace_compare('a#c', 'b')) end diff --git a/test/easy/test_859_buddy_strings.rb b/test/easy/test_859_buddy_strings.rb index d772ccfa..b648c672 100644 --- a/test/easy/test_859_buddy_strings.rb +++ b/test/easy/test_859_buddy_strings.rb @@ -5,13 +5,11 @@ require 'minitest/autorun' class BuddyStringsTest < ::Minitest::Test - def test_default - assert(buddy_strings('ab', 'ba')) - assert(!buddy_strings('ab', 'ab')) - assert(buddy_strings('aa', 'aa')) - end + def test_default_one = assert(buddy_strings('ab', 'ba')) - def test_additional - assert(!buddy_strings('abcd', 'badc')) - end + def test_default_two = assert(!buddy_strings('ab', 'ab')) + + def test_default_three = assert(buddy_strings('aa', 'aa')) + + def test_additional_one = assert(!buddy_strings('abcd', 'badc')) end diff --git a/test/easy/test_860_lemonade_change.rb b/test/easy/test_860_lemonade_change.rb index 3973bcd2..e9e3d3f7 100644 --- a/test/easy/test_860_lemonade_change.rb +++ b/test/easy/test_860_lemonade_change.rb @@ -5,12 +5,15 @@ require 'minitest/autorun' class LemonadeChangeTest < ::Minitest::Test - def test_default - assert(lemonade_change([5, 5, 5, 10, 20])) - assert(!lemonade_change([5, 5, 10, 10, 20])) - end + def test_default_one = assert(lemonade_change([5, 5, 5, 10, 20])) + + def test_default_two = assert(!lemonade_change([5, 5, 10, 10, 20])) - def test_additional - assert(lemonade_change([5, 5, 10, 20, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 5, 5, 20, 5, 20, 5])) + def test_additional_one + assert( + lemonade_change( + [5, 5, 10, 20, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 5, 5, 20, 5, 20, 5] + ) + ) end end diff --git a/test/easy/test_867_transpose_matrix.rb b/test/easy/test_867_transpose_matrix.rb index dc599e02..f4cfaa3b 100644 --- a/test/easy/test_867_transpose_matrix.rb +++ b/test/easy/test_867_transpose_matrix.rb @@ -5,11 +5,14 @@ require 'minitest/autorun' class TransposeMatrixTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [[1, 4, 7], [2, 5, 8], [3, 6, 9]], transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) ) + end + + def test_default_two assert_equal( [[1, 4], [2, 5], [3, 6]], transpose([[1, 2, 3], [4, 5, 6]]) diff --git a/test/easy/test_868_binary_gap.rb b/test/easy/test_868_binary_gap.rb index 2b93be5d..4b2d44d8 100644 --- a/test/easy/test_868_binary_gap.rb +++ b/test/easy/test_868_binary_gap.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class BinaryGapTest < ::Minitest::Test - def test_default - assert_equal(2, binary_gap(22)) - assert_equal(0, binary_gap(8)) - assert_equal(2, binary_gap(5)) - end + def test_default_one = assert_equal(2, binary_gap(22)) + + def test_default_two = assert_equal(0, binary_gap(8)) + + def test_default_three = assert_equal(2, binary_gap(5)) end diff --git a/test/easy/test_872_leaf_similar_trees.rb b/test/easy/test_872_leaf_similar_trees.rb index 3b6bc0c5..7f8740f0 100644 --- a/test/easy/test_872_leaf_similar_trees.rb +++ b/test/easy/test_872_leaf_similar_trees.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class LeafSimilarTreesTest < ::Minitest::Test - def test_default + def test_default_one assert( leaf_similar( ::TreeNode.new( @@ -45,6 +45,9 @@ def test_default ) ) ) + end + + def test_default_two assert( !leaf_similar( ::TreeNode.new( diff --git a/test/easy/test_876_middle_of_the_linked_list.rb b/test/easy/test_876_middle_of_the_linked_list.rb index a34747e3..28a64ac2 100644 --- a/test/easy/test_876_middle_of_the_linked_list.rb +++ b/test/easy/test_876_middle_of_the_linked_list.rb @@ -6,17 +6,32 @@ require 'minitest/autorun' class MiddleOfTheLinkedListTest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( - ::ListNode.from_array([3, 4, 5]), - middle_node(::ListNode.from_array([1, 2, 3, 4, 5])) + ::ListNode.from_array( + [3, 4, 5] + ), + middle_node( + ::ListNode.from_array( + [1, 2, 3, 4, 5] + ) + ) ) ) + end + + def test_default_two assert( ::ListNode.are_equals( - ::ListNode.from_array([4, 5, 6]), - middle_node(::ListNode.from_array([1, 2, 3, 4, 5, 6])) + ::ListNode.from_array( + [4, 5, 6] + ), + middle_node( + ::ListNode.from_array( + [1, 2, 3, 4, 5, 6] + ) + ) ) ) end diff --git a/test/easy/test_884_uncommon_words_from_two_sentences.rb b/test/easy/test_884_uncommon_words_from_two_sentences.rb index 2b2f8dce..8095593c 100644 --- a/test/easy/test_884_uncommon_words_from_two_sentences.rb +++ b/test/easy/test_884_uncommon_words_from_two_sentences.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class UncommonWordsFromTwoSentencesTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( %w[sweet sour], uncommon_from_sentences( @@ -13,6 +13,9 @@ def test_default 'this apple is sour' ) ) + end + + def test_default_two assert_equal( %w[banana], uncommon_from_sentences( diff --git a/test/easy/test_896_monotonic_array.rb b/test/easy/test_896_monotonic_array.rb index 55ad62c4..540e04b9 100644 --- a/test/easy/test_896_monotonic_array.rb +++ b/test/easy/test_896_monotonic_array.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MonotonicArrayTest < ::Minitest::Test - def test_default - assert(is_monotonic([1, 2, 2, 3])) - assert(is_monotonic([6, 5, 4, 4])) - assert(!is_monotonic([1, 3, 2])) - end + def test_default_one = assert(is_monotonic([1, 2, 2, 3])) + + def test_default_two = assert(is_monotonic([6, 5, 4, 4])) + + def test_default_three = assert(!is_monotonic([1, 3, 2])) end diff --git a/test/easy/test_897_increasing_order_search_tree.rb b/test/easy/test_897_increasing_order_search_tree.rb index fc05b79c..96975b33 100644 --- a/test/easy/test_897_increasing_order_search_tree.rb +++ b/test/easy/test_897_increasing_order_search_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class IncreasingOrderSearchTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -67,6 +67,9 @@ def test_default ) ) ) + end + + def test_default_two assert( ::TreeNode.are_equals( ::TreeNode.new( diff --git a/test/easy/test_905_sort_array_by_parity.rb b/test/easy/test_905_sort_array_by_parity.rb index 3f706d12..0f2deae9 100644 --- a/test/easy/test_905_sort_array_by_parity.rb +++ b/test/easy/test_905_sort_array_by_parity.rb @@ -5,8 +5,19 @@ require 'minitest/autorun' class SortArrayByParityTest < ::Minitest::Test - def test_default - assert_equal([2, 4, 3, 1], sort_array_by_parity([3, 1, 2, 4])) - assert_equal([0], sort_array_by_parity([0])) + def test_default_one + assert_equal( + [2, 4, 3, 1], + sort_array_by_parity( + [3, 1, 2, 4] + ) + ) + end + + def test_default_two + assert_equal( + [0], + sort_array_by_parity([0]) + ) end end diff --git a/test/easy/test_908_smallest_range_i.rb b/test/easy/test_908_smallest_range_i.rb index c4bdd7f1..fa4d8ebf 100644 --- a/test/easy/test_908_smallest_range_i.rb +++ b/test/easy/test_908_smallest_range_i.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class SmallestRangeTest < ::Minitest::Test - def test_default - assert_equal(0, smallest_range_i([1], 0)) - assert_equal(6, smallest_range_i([0, 10], 2)) - assert_equal(0, smallest_range_i([1, 3, 6], 3)) - end + def test_default_one = assert_equal(0, smallest_range_i([1], 0)) + + def test_default_two = assert_equal(6, smallest_range_i([0, 10], 2)) + + def test_default_three = assert_equal(0, smallest_range_i([1, 3, 6], 3)) end diff --git a/test/easy/test_917_reverse_only_letters.rb b/test/easy/test_917_reverse_only_letters.rb index b2d34c9a..4f6525fe 100644 --- a/test/easy/test_917_reverse_only_letters.rb +++ b/test/easy/test_917_reverse_only_letters.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class ReverseOnlyLettersTest < ::Minitest::Test - def test_default - assert_equal('dc-ba', reverse_only_letters('ab-cd')) - assert_equal('j-Ih-gfE-dCba', reverse_only_letters('a-bC-dEf-ghIj')) - assert_equal('Test1ng-Leet=code-Q!', reverse_only_letters('Qedo1ct-eeLg=ntse-T!')) + def test_default_one + assert_equal( + 'dc-ba', + reverse_only_letters( + 'ab-cd' + ) + ) + end + + def test_default_two + assert_equal( + 'j-Ih-gfE-dCba', + reverse_only_letters( + 'a-bC-dEf-ghIj' + ) + ) + end + + def test_default_three + assert_equal( + 'Test1ng-Leet=code-Q!', + reverse_only_letters( + 'Qedo1ct-eeLg=ntse-T!' + ) + ) end end diff --git a/test/easy/test_922_sort_array_by_parity_ii.rb b/test/easy/test_922_sort_array_by_parity_ii.rb index 11a60dfb..c2ec33a6 100644 --- a/test/easy/test_922_sort_array_by_parity_ii.rb +++ b/test/easy/test_922_sort_array_by_parity_ii.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class SortArrayByParityIITest < ::Minitest::Test - def test_default - assert_equal([2, 7, 4, 5], sort_array_by_parity_ii([4, 2, 5, 7])) - assert_equal([2, 3], sort_array_by_parity_ii([2, 3])) + def test_default_one + assert_equal( + [2, 7, 4, 5], + sort_array_by_parity_ii( + [4, 2, 5, 7] + ) + ) + end + + def test_default_two + assert_equal( + [2, 3], + sort_array_by_parity_ii( + [2, 3] + ) + ) end end diff --git a/test/easy/test_925_long_pressed_name.rb b/test/easy/test_925_long_pressed_name.rb index e57e442d..05a2d2c0 100644 --- a/test/easy/test_925_long_pressed_name.rb +++ b/test/easy/test_925_long_pressed_name.rb @@ -5,12 +5,16 @@ require 'minitest/autorun' class LongPressedNameTest < ::Minitest::Test - def test_default - assert(is_long_pressed_name('alex', 'aaleex')) - assert(!is_long_pressed_name('saeed', 'ssaaedd')) - end + def test_default_one = assert(is_long_pressed_name('alex', 'aaleex')) + + def test_default_two = assert(!is_long_pressed_name('saeed', 'ssaaedd')) - def test_additional - assert(!is_long_pressed_name('alex', 'aaleexxxxaaa')) + def test_additional_one + assert( + !is_long_pressed_name( + 'alex', + 'aaleexxxxaaa' + ) + ) end end diff --git a/test/easy/test_929_unique_email_addresses.rb b/test/easy/test_929_unique_email_addresses.rb index 1710aabf..d142e24e 100644 --- a/test/easy/test_929_unique_email_addresses.rb +++ b/test/easy/test_929_unique_email_addresses.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class UniqueEmailAddressesTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 2, num_unique_emails( %w[test.email+alex@leetcode.com test.e.mail+bob.cathy@leetcode.com testemail+david@lee.tcode.com] ) ) + end + + def test_default_two assert_equal( 3, num_unique_emails( diff --git a/test/easy/test_933_number_of_recent_calls.rb b/test/easy/test_933_number_of_recent_calls.rb index f59eeac5..8d5f30cb 100644 --- a/test/easy/test_933_number_of_recent_calls.rb +++ b/test/easy/test_933_number_of_recent_calls.rb @@ -5,8 +5,9 @@ require 'minitest/autorun' class NumberOfRecentCallsTest < ::Minitest::Test - def test_default + def test_default_one recent_counter = ::RecentCounter.new + assert_equal(1, recent_counter.ping(1)) assert_equal(2, recent_counter.ping(100)) assert_equal(3, recent_counter.ping(3001)) diff --git a/test/easy/test_938_range_sum_of_bst.rb b/test/easy/test_938_range_sum_of_bst.rb index ee20949a..baed2550 100644 --- a/test/easy/test_938_range_sum_of_bst.rb +++ b/test/easy/test_938_range_sum_of_bst.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class RangeSumOfBSTTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 32, range_sum_bst( @@ -27,6 +27,9 @@ def test_default 15 ) ) + end + + def test_default_two assert_equal( 23, range_sum_bst( diff --git a/test/easy/test_941_valid_mountain_array.rb b/test/easy/test_941_valid_mountain_array.rb index 60ec75c5..7ac19069 100644 --- a/test/easy/test_941_valid_mountain_array.rb +++ b/test/easy/test_941_valid_mountain_array.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ValidMountainArrayTest < ::Minitest::Test - def test_default - assert(!valid_mountain_array([2, 1])) - assert(!valid_mountain_array([3, 5, 5])) - assert(valid_mountain_array([0, 3, 2, 1])) - end + def test_default_one = assert(!valid_mountain_array([2, 1])) + + def test_default_two = assert(!valid_mountain_array([3, 5, 5])) + + def test_default_three = assert(valid_mountain_array([0, 3, 2, 1])) end diff --git a/test/easy/test_942_di_string_match.rb b/test/easy/test_942_di_string_match.rb index 5def9276..cf21b9e3 100644 --- a/test/easy/test_942_di_string_match.rb +++ b/test/easy/test_942_di_string_match.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class DIStringMatchTest < ::Minitest::Test - def test_default - assert_equal([0, 4, 1, 3, 2], di_string_match('IDID')) - assert_equal([0, 1, 2, 3], di_string_match('III')) - assert_equal([3, 2, 0, 1], di_string_match('DDI')) - end + def test_default_one = assert_equal([0, 4, 1, 3, 2], di_string_match('IDID')) + + def test_default_two = assert_equal([0, 1, 2, 3], di_string_match('III')) + + def test_default_three = assert_equal([3, 2, 0, 1], di_string_match('DDI')) end diff --git a/test/easy/test_944_delete_columns_to_make_sorted.rb b/test/easy/test_944_delete_columns_to_make_sorted.rb index aa3119ca..675aa980 100644 --- a/test/easy/test_944_delete_columns_to_make_sorted.rb +++ b/test/easy/test_944_delete_columns_to_make_sorted.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class DeleteColumnsToMakeSortedTest < ::Minitest::Test - def test_default - assert_equal(1, min_deletion_size(%w[cba daf ghi])) - assert_equal(0, min_deletion_size(%w[a b])) - assert_equal(3, min_deletion_size(%w[zyx wvu tsr])) - end + def test_default_one = assert_equal(1, min_deletion_size(%w[cba daf ghi])) + + def test_default_two = assert_equal(0, min_deletion_size(%w[a b])) + + def test_default_three = assert_equal(3, min_deletion_size(%w[zyx wvu tsr])) end diff --git a/test/easy/test_953_verifying_an_alien_dictionary.rb b/test/easy/test_953_verifying_an_alien_dictionary.rb index 28181e93..f8c5b7a0 100644 --- a/test/easy/test_953_verifying_an_alien_dictionary.rb +++ b/test/easy/test_953_verifying_an_alien_dictionary.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class VerifyingAnAlienDictionaryTest < ::Minitest::Test - def test_default - assert(is_alien_sorted(%w[hello leetcode], 'hlabcdefgijkmnopqrstuvwxyz')) - assert(!is_alien_sorted(%w[word world row], 'worldabcefghijkmnpqstuvxyz')) - assert(!is_alien_sorted(%w[apple app], 'abcdefghijklmnopqrstuvwxyz')) + def test_default_one + assert( + is_alien_sorted( + %w[hello leetcode], + 'hlabcdefgijkmnopqrstuvwxyz' + ) + ) + end + + def test_default_two + assert( + !is_alien_sorted( + %w[word world row], + 'worldabcefghijkmnpqstuvxyz' + ) + ) + end + + def test_default_three + assert( + !is_alien_sorted( + %w[apple app], + 'abcdefghijklmnopqrstuvwxyz' + ) + ) end end diff --git a/test/easy/test_961_n_repeated_element_in_size_2n_array.rb b/test/easy/test_961_n_repeated_element_in_size_2n_array.rb index 335de3b9..a6c9076b 100644 --- a/test/easy/test_961_n_repeated_element_in_size_2n_array.rb +++ b/test/easy/test_961_n_repeated_element_in_size_2n_array.rb @@ -5,13 +5,11 @@ require 'minitest/autorun' class NRepeatedElementInSize2NArrayTest < ::Minitest::Test - def test_default - assert_equal(3, repeated_n_times([1, 2, 3, 3])) - assert_equal(2, repeated_n_times([2, 1, 2, 5, 3, 2])) - assert_equal(5, repeated_n_times([5, 1, 5, 2, 5, 3, 5, 4])) - end + def test_default_one = assert_equal(3, repeated_n_times([1, 2, 3, 3])) - def test_additional - assert_equal(0, repeated_n_times([1, 2])) - end + def test_default_two = assert_equal(2, repeated_n_times([2, 1, 2, 5, 3, 2])) + + def test_default_three = assert_equal(5, repeated_n_times([5, 1, 5, 2, 5, 3, 5, 4])) + + def test_additional_one = assert_equal(0, repeated_n_times([1, 2])) end diff --git a/test/easy/test_965_univalued_binary_tree.rb b/test/easy/test_965_univalued_binary_tree.rb index 51f335bf..f3374e2c 100644 --- a/test/easy/test_965_univalued_binary_tree.rb +++ b/test/easy/test_965_univalued_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class UnivaluedBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( is_unival_tree( ::TreeNode.new( @@ -24,6 +24,9 @@ def test_default ) ) ) + end + + def test_default_two assert( !is_unival_tree( ::TreeNode.new( diff --git a/test/easy/test_976_largest_perimeter_triangle.rb b/test/easy/test_976_largest_perimeter_triangle.rb index 7cb86270..90b77b5a 100644 --- a/test/easy/test_976_largest_perimeter_triangle.rb +++ b/test/easy/test_976_largest_perimeter_triangle.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class LargestPerimeterTriangleTest < ::Minitest::Test - def test_default - assert_equal(5, largest_perimeter([2, 1, 2])) - assert_equal(0, largest_perimeter([1, 2, 1, 10])) - end + def test_default_one = assert_equal(5, largest_perimeter([2, 1, 2])) + + def test_default_two = assert_equal(0, largest_perimeter([1, 2, 1, 10])) end diff --git a/test/easy/test_977_squares_of_a_sorted_array.rb b/test/easy/test_977_squares_of_a_sorted_array.rb index 7ad73bae..d20cd0a5 100644 --- a/test/easy/test_977_squares_of_a_sorted_array.rb +++ b/test/easy/test_977_squares_of_a_sorted_array.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class SquaresOfASortedArrayTest < ::Minitest::Test - def test_default - assert_equal([0, 1, 9, 16, 100], sorted_squares([-4, -1, 0, 3, 10])) - assert_equal([4, 9, 9, 49, 121], sorted_squares([-7, -3, 2, 3, 11])) + def test_default_one + assert_equal( + [0, 1, 9, 16, 100], + sorted_squares( + [-4, -1, 0, 3, 10] + ) + ) + end + + def test_default_two + assert_equal( + [4, 9, 9, 49, 121], + sorted_squares( + [-7, -3, 2, 3, 11] + ) + ) end end diff --git a/test/easy/test_989_add_to_array_form_of_integer.rb b/test/easy/test_989_add_to_array_form_of_integer.rb index 0e1d7aaa..29893520 100644 --- a/test/easy/test_989_add_to_array_form_of_integer.rb +++ b/test/easy/test_989_add_to_array_form_of_integer.rb @@ -5,21 +5,93 @@ require 'minitest/autorun' class AddToArrayFormOfIntegerTest < ::Minitest::Test - def test_default - assert_equal([1, 2, 3, 4], add_to_array_form([1, 2, 0, 0], 34)) - assert_equal([4, 5, 5], add_to_array_form([2, 7, 4], 181)) - assert_equal([1, 0, 2, 1], add_to_array_form([2, 1, 5], 806)) + def test_default_one + assert_equal( + [1, 2, 3, 4], + add_to_array_form( + [1, 2, 0, 0], + 34 + ) + ) + end + + def test_default_two + assert_equal( + [4, 5, 5], + add_to_array_form( + [2, 7, 4], + 181 + ) + ) + end + + def test_default_three + assert_equal( + [1, 0, 2, 1], + add_to_array_form( + [2, 1, 5], + 806 + ) + ) + end + + def test_additional_one + assert_equal( + [2, 3], + add_to_array_form( + [0], + 23 + ) + ) + end + + def test_additional_two + assert_equal( + [8, 1, 5], + add_to_array_form( + [6], + 809 + ) + ) + end + + def test_additional_three + assert_equal( + [1, 0, 0, 0, 0], + add_to_array_form( + [1, 2, 3, 4], + 8766 + ) + ) + end + + def test_additional_five + assert_equal( + [1, 0, 0, 0], + add_to_array_form( + [7], + 993 + ) + ) + end + + def test_additional_six + assert_equal( + [6, 6, 2], + add_to_array_form( + [6, 5, 6], + 6 + ) + ) end - def test_additional - assert_equal([2, 3], add_to_array_form([0], 23)) - assert_equal([8, 1, 5], add_to_array_form([6], 809)) - assert_equal([1, 0, 0, 0, 0], add_to_array_form([1, 2, 3, 4], 8766)) - assert_equal([1, 0, 0, 0], add_to_array_form([7], 993)) - assert_equal([6, 6, 2], add_to_array_form([6, 5, 6], 6)) + def test_additional_seven assert_equal( [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - add_to_array_form([9, 9, 9, 9, 9, 9, 9, 9, 9, 9], 1) + add_to_array_form( + [9, 9, 9, 9, 9, 9, 9, 9, 9, 9], + 1 + ) ) end end diff --git a/test/easy/test_993_cousins_in_binary_tree.rb b/test/easy/test_993_cousins_in_binary_tree.rb index 059422d4..78c81ea8 100644 --- a/test/easy/test_993_cousins_in_binary_tree.rb +++ b/test/easy/test_993_cousins_in_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class CousinsInBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( !is_cousins( ::TreeNode.new( @@ -21,6 +21,9 @@ def test_default 3 ) ) + end + + def test_default_two assert( is_cousins( ::TreeNode.new( @@ -40,6 +43,9 @@ def test_default 4 ) ) + end + + def test_default_three assert( !is_cousins( ::TreeNode.new( diff --git a/test/easy/test_997_find_the_town_judge.rb b/test/easy/test_997_find_the_town_judge.rb index 1f55854e..f8f5a5bd 100644 --- a/test/easy/test_997_find_the_town_judge.rb +++ b/test/easy/test_997_find_the_town_judge.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FindTheTownJudgeTest < ::Minitest::Test - def test_default - assert_equal(2, find_judge(2, [[1, 2]])) - assert_equal(3, find_judge(3, [[1, 3], [2, 3]])) - assert_equal(-1, find_judge(3, [[1, 3], [2, 3], [3, 1]])) - end + def test_default_one = assert_equal(2, find_judge(2, [[1, 2]])) + + def test_default_two = assert_equal(3, find_judge(3, [[1, 3], [2, 3]])) + + def test_default_three = assert_equal(-1, find_judge(3, [[1, 3], [2, 3], [3, 1]])) end From 086a6e7da6f71c587a385693c6abf696b5a8f467 Mon Sep 17 00:00:00 2001 From: fartem Date: Tue, 20 Aug 2024 12:34:15 +0300 Subject: [PATCH 5/9] 2024-08-20 v. 6.5.1: updated some tests --- ..._appearing_more_than_25_in_sorted_array.rb | 9 ++++- ...nary_number_in_a_linked_list_to_integer.rb | 4 ++- ...nts_with_greatest_element_on_right_side.rb | 9 ++++- ...est_1337_the_k_weakest_rows_in_a_matrix.rb | 5 ++- ...ber_of_steps_to_reduce_a_number_to_zero.rb | 10 +++--- ...st_1346_check_if_n_and_its_double_exist.rb | 7 ++-- ...unt_negative_numbers_in_a_sorted_matrix.rb | 15 ++++++-- ...6_sort_integers_by_the_number_of_1_bits.rb | 5 ++- ...t_1360_number_of_days_between_two_dates.rb | 7 ++-- ...ers_are_smaller_than_the_current_number.rb | 29 ++++++++++++--- .../test_1370_increasing_decreasing_string.rb | 7 ++-- ...ng_with_characters_that_have_odd_counts.rb | 10 +++--- ...d_the_distance_value_between_two_arrays.rb | 35 ++++++++++++++++--- ..._create_target_array_in_the_given_order.rb | 32 ++++++++++++++--- test/easy/test_1399_count_largest_group.rb | 7 ++-- ...mum_subsequence_in_non_increasing_order.rb | 7 ++-- .../test_1408_string_matching_in_an_array.rb | 10 +++--- ..._value_to_get_positive_step_by_step_sum.rb | 10 +++--- test/easy/test_1417_reformat_the_string.rb | 10 +++--- ..._maximum_score_after_splitting_a_string.rb | 10 +++--- 20 files changed, 169 insertions(+), 69 deletions(-) diff --git a/test/easy/test_1287_element_appearing_more_than_25_in_sorted_array.rb b/test/easy/test_1287_element_appearing_more_than_25_in_sorted_array.rb index d1278673..fb3e80b8 100644 --- a/test/easy/test_1287_element_appearing_more_than_25_in_sorted_array.rb +++ b/test/easy/test_1287_element_appearing_more_than_25_in_sorted_array.rb @@ -14,5 +14,12 @@ def test_default_one ) end - def test_default_two = assert_equal(1, find_special_integer([1, 1])) + def test_default_two + assert_equal( + 1, + find_special_integer( + [1, 1] + ) + ) + end end diff --git a/test/easy/test_1290_convert_binary_number_in_a_linked_list_to_integer.rb b/test/easy/test_1290_convert_binary_number_in_a_linked_list_to_integer.rb index cfa59fa8..349dbf40 100644 --- a/test/easy/test_1290_convert_binary_number_in_a_linked_list_to_integer.rb +++ b/test/easy/test_1290_convert_binary_number_in_a_linked_list_to_integer.rb @@ -21,7 +21,9 @@ def test_default_two assert_equal( 0, get_decimal_value( - ::ListNode.from_array([0]) + ::ListNode.from_array( + [0] + ) ) ) end diff --git a/test/easy/test_1299_replace_elements_with_greatest_element_on_right_side.rb b/test/easy/test_1299_replace_elements_with_greatest_element_on_right_side.rb index 2d126831..39d1dd89 100644 --- a/test/easy/test_1299_replace_elements_with_greatest_element_on_right_side.rb +++ b/test/easy/test_1299_replace_elements_with_greatest_element_on_right_side.rb @@ -14,5 +14,12 @@ def test_default_one ) end - def test_default_two = assert_equal([-1], replace_elements([400])) + def test_default_two + assert_equal( + [-1], + replace_elements( + [400] + ) + ) + end end diff --git a/test/easy/test_1337_the_k_weakest_rows_in_a_matrix.rb b/test/easy/test_1337_the_k_weakest_rows_in_a_matrix.rb index af8fed6c..3606fee7 100644 --- a/test/easy/test_1337_the_k_weakest_rows_in_a_matrix.rb +++ b/test/easy/test_1337_the_k_weakest_rows_in_a_matrix.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class TheKWeakestRowsInAMatrixTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [2, 0, 3], k_weakest_rows( @@ -19,6 +19,9 @@ def test_default 3 ) ) + end + + def test_default_two assert_equal( [0, 2], k_weakest_rows( diff --git a/test/easy/test_1342_number_of_steps_to_reduce_a_number_to_zero.rb b/test/easy/test_1342_number_of_steps_to_reduce_a_number_to_zero.rb index d53899ad..13067792 100644 --- a/test/easy/test_1342_number_of_steps_to_reduce_a_number_to_zero.rb +++ b/test/easy/test_1342_number_of_steps_to_reduce_a_number_to_zero.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class NumberOfStepsToReduceANumberToZeroTest < ::Minitest::Test - def test_default - assert_equal(6, number_of_steps(14)) - assert_equal(4, number_of_steps(8)) - assert_equal(12, number_of_steps(123)) - end + def test_default_one = assert_equal(6, number_of_steps(14)) + + def test_default_two = assert_equal(4, number_of_steps(8)) + + def test_default_three = assert_equal(12, number_of_steps(123)) end diff --git a/test/easy/test_1346_check_if_n_and_its_double_exist.rb b/test/easy/test_1346_check_if_n_and_its_double_exist.rb index 439240f0..cc85c8cb 100644 --- a/test/easy/test_1346_check_if_n_and_its_double_exist.rb +++ b/test/easy/test_1346_check_if_n_and_its_double_exist.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CheckIfNAndItsDoubleExistTest < ::Minitest::Test - def test_default - assert(check_if_exist([10, 2, 5, 3])) - assert(!check_if_exist([3, 1, 7, 11])) - end + def test_default_one = assert(check_if_exist([10, 2, 5, 3])) + + def test_default_two = assert(!check_if_exist([3, 1, 7, 11])) end diff --git a/test/easy/test_1351_count_negative_numbers_in_a_sorted_matrix.rb b/test/easy/test_1351_count_negative_numbers_in_a_sorted_matrix.rb index 4d2bffd2..47e5e44c 100644 --- a/test/easy/test_1351_count_negative_numbers_in_a_sorted_matrix.rb +++ b/test/easy/test_1351_count_negative_numbers_in_a_sorted_matrix.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class CountNegativeNumbersInASortedMatrixTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 8, count_negatives( @@ -17,6 +17,17 @@ def test_default ] ) ) - assert_equal(0, count_negatives([[3, 2], [1, 0]])) + end + + def test_default_two + assert_equal( + 0, + count_negatives( + [ + [3, 2], + [1, 0] + ] + ) + ) end end diff --git a/test/easy/test_1356_sort_integers_by_the_number_of_1_bits.rb b/test/easy/test_1356_sort_integers_by_the_number_of_1_bits.rb index 915ba38b..3fd72327 100644 --- a/test/easy/test_1356_sort_integers_by_the_number_of_1_bits.rb +++ b/test/easy/test_1356_sort_integers_by_the_number_of_1_bits.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class SortIntegerByTheNumberOf1BitsTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [0, 1, 2, 4, 8, 3, 5, 6, 7], sort_by_bits( [0, 1, 2, 3, 4, 5, 6, 7, 8] ) ) + end + + def test_default_two assert_equal( [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024], sort_by_bits( diff --git a/test/easy/test_1360_number_of_days_between_two_dates.rb b/test/easy/test_1360_number_of_days_between_two_dates.rb index 4d149e12..7938b750 100644 --- a/test/easy/test_1360_number_of_days_between_two_dates.rb +++ b/test/easy/test_1360_number_of_days_between_two_dates.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class NumberOfDaysBetweenTwoDatesTest < ::Minitest::Test - def test_default - assert_equal(1, days_between_dates('2019-06-29', '2019-06-30')) - assert_equal(15, days_between_dates('2020-01-15', '2019-12-31')) - end + def test_default_one = assert_equal(1, days_between_dates('2019-06-29', '2019-06-30')) + + def test_default_two = assert_equal(15, days_between_dates('2020-01-15', '2019-12-31')) end diff --git a/test/easy/test_1365_how_many_numbers_are_smaller_than_the_current_number.rb b/test/easy/test_1365_how_many_numbers_are_smaller_than_the_current_number.rb index 919470fa..1881c106 100644 --- a/test/easy/test_1365_how_many_numbers_are_smaller_than_the_current_number.rb +++ b/test/easy/test_1365_how_many_numbers_are_smaller_than_the_current_number.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class HowManyNumbersAreSmallerThanTheCurrentNumberTest < ::Minitest::Test - def test_default - assert_equal([4, 0, 1, 1, 3], smaller_numbers_than_current([8, 1, 2, 2, 3])) - assert_equal([2, 1, 0, 3], smaller_numbers_than_current([6, 5, 4, 8])) - assert_equal([0, 0, 0, 0], smaller_numbers_than_current([7, 7, 7, 7])) + def test_default_one + assert_equal( + [4, 0, 1, 1, 3], + smaller_numbers_than_current( + [8, 1, 2, 2, 3] + ) + ) + end + + def test_default_two + assert_equal( + [2, 1, 0, 3], + smaller_numbers_than_current( + [6, 5, 4, 8] + ) + ) + end + + def test_default_three + assert_equal( + [0, 0, 0, 0], + smaller_numbers_than_current( + [7, 7, 7, 7] + ) + ) end end diff --git a/test/easy/test_1370_increasing_decreasing_string.rb b/test/easy/test_1370_increasing_decreasing_string.rb index 21da3548..87ef7f81 100644 --- a/test/easy/test_1370_increasing_decreasing_string.rb +++ b/test/easy/test_1370_increasing_decreasing_string.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class IncreasingDecreasingStringTest < ::Minitest::Test - def test_default - assert_equal('abccbaabccba', sort_string('aaaabbbbcccc')) - assert_equal('art', sort_string('rat')) - end + def test_default_one = assert_equal('abccbaabccba', sort_string('aaaabbbbcccc')) + + def test_default_two = assert_equal('art', sort_string('rat')) end diff --git a/test/easy/test_1374_generate_a_string_with_characters_that_have_odd_counts.rb b/test/easy/test_1374_generate_a_string_with_characters_that_have_odd_counts.rb index 75f30863..69150f32 100644 --- a/test/easy/test_1374_generate_a_string_with_characters_that_have_odd_counts.rb +++ b/test/easy/test_1374_generate_a_string_with_characters_that_have_odd_counts.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class GenerateAStringWithCharactersThatHaveOddCountsTest < ::Minitest::Test - def test_default - assert_equal('aaab', generate_the_string(4)) - assert_equal('ab', generate_the_string(2)) - assert_equal('aaaaaaa', generate_the_string(7)) - end + def test_default_one = assert_equal('aaab', generate_the_string(4)) + + def test_default_two = assert_equal('ab', generate_the_string(2)) + + def test_default_three = assert_equal('aaaaaaa', generate_the_string(7)) end diff --git a/test/easy/test_1385_find_the_distance_value_between_two_arrays.rb b/test/easy/test_1385_find_the_distance_value_between_two_arrays.rb index 5331561f..fe6b196a 100644 --- a/test/easy/test_1385_find_the_distance_value_between_two_arrays.rb +++ b/test/easy/test_1385_find_the_distance_value_between_two_arrays.rb @@ -5,9 +5,36 @@ require 'minitest/autorun' class FindTheDistanceValueBetweenTwoArraysTest < ::Minitest::Test - def test_default - assert_equal(2, find_the_distance_value([4, 5, 8], [10, 9, 1, 8], 2)) - assert_equal(2, find_the_distance_value([1, 4, 2, 3], [-4, -3, 6, 10, 20, 30], 3)) - assert_equal(1, find_the_distance_value([2, 1, 100, 3], [-5, -2, 10, -3, 7], 6)) + def test_default_one + assert_equal( + 2, + find_the_distance_value( + [4, 5, 8], + [10, 9, 1, 8], + 2 + ) + ) + end + + def test_default_two + assert_equal( + 2, + find_the_distance_value( + [1, 4, 2, 3], + [-4, -3, 6, 10, 20, 30], + 3 + ) + ) + end + + def test_default_three + assert_equal( + 1, + find_the_distance_value( + [2, 1, 100, 3], + [-5, -2, 10, -3, 7], + 6 + ) + ) end end diff --git a/test/easy/test_1389_create_target_array_in_the_given_order.rb b/test/easy/test_1389_create_target_array_in_the_given_order.rb index 69de549f..d7b872d7 100644 --- a/test/easy/test_1389_create_target_array_in_the_given_order.rb +++ b/test/easy/test_1389_create_target_array_in_the_given_order.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class CreateTargetArrayInTheGivenOrderTest < ::Minitest::Test - def test_default - assert_equal([0, 4, 1, 3, 2], create_target_array([0, 1, 2, 3, 4], [0, 1, 2, 2, 1])) - assert_equal([0, 1, 2, 3, 4], create_target_array([1, 2, 3, 4, 0], [0, 1, 2, 3, 0])) - assert_equal([1], create_target_array([1], [0])) + def test_default_one + assert_equal( + [0, 4, 1, 3, 2], + create_target_array( + [0, 1, 2, 3, 4], + [0, 1, 2, 2, 1] + ) + ) + end + + def test_default_two + assert_equal( + [0, 1, 2, 3, 4], + create_target_array( + [1, 2, 3, 4, 0], + [0, 1, 2, 3, 0] + ) + ) + end + + def test_default_three + assert_equal( + [1], + create_target_array( + [1], + [0] + ) + ) end end diff --git a/test/easy/test_1399_count_largest_group.rb b/test/easy/test_1399_count_largest_group.rb index e6d33480..9906e893 100644 --- a/test/easy/test_1399_count_largest_group.rb +++ b/test/easy/test_1399_count_largest_group.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountLargestGroupTest < ::Minitest::Test - def test_default - assert_equal(4, count_largest_group(13)) - assert_equal(2, count_largest_group(2)) - end + def test_default_one = assert_equal(4, count_largest_group(13)) + + def test_default_two = assert_equal(2, count_largest_group(2)) end diff --git a/test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb b/test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb index 6dd7447f..a352b42c 100644 --- a/test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb +++ b/test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class MinimumSubsequenceInNonIncreasingOrderTest < ::Minitest::Test - def test_default - assert_equal([10, 9], min_subsequence([4, 3, 10, 9, 8])) - assert_equal([7, 7, 6], min_subsequence([4, 4, 7, 6, 7])) - end + def test_default_one = assert_equal([10, 9], min_subsequence([4, 3, 10, 9, 8])) + + def test_default_two = assert_equal([7, 7, 6], min_subsequence([4, 4, 7, 6, 7])) end diff --git a/test/easy/test_1408_string_matching_in_an_array.rb b/test/easy/test_1408_string_matching_in_an_array.rb index 97219881..0799dbaa 100644 --- a/test/easy/test_1408_string_matching_in_an_array.rb +++ b/test/easy/test_1408_string_matching_in_an_array.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class StringMatchingInAnArrayTest < ::Minitest::Test - def test_default - assert_equal(%w[as hero], string_matching(%w[mass as hero superhero])) - assert_equal(%w[et code], string_matching(%w[leetcode et code])) - assert_equal([], string_matching(%w[blue green bu])) - end + def test_default_one = assert_equal(%w[as hero], string_matching(%w[mass as hero superhero])) + + def test_default_two = assert_equal(%w[et code], string_matching(%w[leetcode et code])) + + def test_default_three = assert_equal([], string_matching(%w[blue green bu])) end diff --git a/test/easy/test_1413_minimum_value_to_get_positive_step_by_step_sum.rb b/test/easy/test_1413_minimum_value_to_get_positive_step_by_step_sum.rb index b488afb3..2d7afafd 100644 --- a/test/easy/test_1413_minimum_value_to_get_positive_step_by_step_sum.rb +++ b/test/easy/test_1413_minimum_value_to_get_positive_step_by_step_sum.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MinimumValueToGetPositiveStepByStepSumTest < ::Minitest::Test - def test_default - assert_equal(5, min_start_value([-3, 2, -3, 4, 2])) - assert_equal(1, min_start_value([1, 2])) - assert_equal(5, min_start_value([1, -2, -3])) - end + def test_default_one = assert_equal(5, min_start_value([-3, 2, -3, 4, 2])) + + def test_default_two = assert_equal(1, min_start_value([1, 2])) + + def test_default_three = assert_equal(5, min_start_value([1, -2, -3])) end diff --git a/test/easy/test_1417_reformat_the_string.rb b/test/easy/test_1417_reformat_the_string.rb index ddb538af..1b3bf68d 100644 --- a/test/easy/test_1417_reformat_the_string.rb +++ b/test/easy/test_1417_reformat_the_string.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ReformatTheStringTest < ::Minitest::Test - def test_default - assert_equal('a0b1c2', reformat('a0b1c2')) - assert_equal('', reformat('leetcode')) - assert_equal('', reformat('1229857369')) - end + def test_default_one = assert_equal('a0b1c2', reformat('a0b1c2')) + + def test_default_two = assert_equal('', reformat('leetcode')) + + def test_default_three = assert_equal('', reformat('1229857369')) end diff --git a/test/easy/test_1422_maximum_score_after_splitting_a_string.rb b/test/easy/test_1422_maximum_score_after_splitting_a_string.rb index e57f6fdb..b9a111ea 100644 --- a/test/easy/test_1422_maximum_score_after_splitting_a_string.rb +++ b/test/easy/test_1422_maximum_score_after_splitting_a_string.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumScoreAfterSplittingAStringTest < ::Minitest::Test - def test_default - assert_equal(5, max_score('011101')) - assert_equal(5, max_score('00111')) - assert_equal(3, max_score('1111')) - end + def test_default_one = assert_equal(5, max_score('011101')) + + def test_default_two = assert_equal(5, max_score('00111')) + + def test_default_three = assert_equal(3, max_score('1111')) end From 5657945d6a2bb0db85d40f4c92ab3dec3d53434d Mon Sep 17 00:00:00 2001 From: fartem Date: Tue, 20 Aug 2024 13:12:17 +0300 Subject: [PATCH 6/9] 2024-08-20 v. 6.5.1: updated some tests --- ...ids_with_the_greatest_number_of_candies.rb | 32 ++++++++++++++++--- test/easy/test_1436_destination_city.rb | 30 ++++++++++++++--- ...ll_1s_are_at_least_length_k_places_away.rb | 7 ++-- test/easy/test_1446_consecutive_characters.rb | 7 ++-- ...students_doing_homework_at_a_given_time.rb | 7 ++-- ...s_as_a_prefix_of_any_word_in_a_sentence.rb | 32 ++++++++++++++++--- ...two_arrays_equal_by_reversing_subarrays.rb | 10 +++--- ...mum_product_of_two_elements_in_an_array.rb | 10 +++--- test/easy/test_1470_shuffle_the_array.rb | 32 ++++++++++++++++--- ...rices_with_a_special_discount_in_a_shop.rb | 29 ++++++++++++++--- .../easy/test_1480_running_sum_of_1d_array.rb | 29 ++++++++++++++--- .../test_1486_xor_operation_in_an_array.rb | 7 ++-- ...xcluding_the_minimum_and_maximum_salary.rb | 19 +++++++++-- test/easy/test_1496_path_crossing.rb | 7 ++-- ...ke_arithmetic_progression_from_sequence.rb | 7 ++-- test/easy/test_1507_reformat_date.rb | 10 +++--- test/easy/test_1512_number_of_good_pairs.rb | 10 +++--- test/easy/test_1518_water_bottles.rb | 7 ++-- ..._count_odd_numbers_in_an_interval_range.rb | 7 ++-- test/easy/test_1528_shuffle_string.rb | 21 ++++++++++-- test/easy/test_1534_count_good_triplets.rb | 7 ++-- .../test_1539_kth_missing_positive_number.rb | 7 ++-- test/easy/test_1544_make_the_string_great.rb | 10 +++--- test/easy/test_1550_three_consecutive_odds.rb | 7 ++-- test/easy/test_1556_thousand_separator.rb | 7 ++-- ...rn_of_length_m_repeated_k_or_more_times.rb | 10 +++--- test/easy/test_1572_matrix_diagonal_sum.rb | 31 +++++++++++++++--- ..._avoid_consecutive_repeating_characters.rb | 11 +++---- ...82_special_positions_in_a_binary_matrix.rb | 27 ++++++++++++++-- ...st_1588_sum_of_all_odd_length_subarrays.rb | 10 +++--- ...est_1592_rearrange_spaces_between_words.rb | 19 +++++++++-- test/easy/test_1598_crawler_log_folder.rb | 10 +++--- test/easy/test_1603_design_parking_system.rb | 6 ++-- ...with_x_elements_greater_than_or_equal_x.rb | 10 +++--- ...aximum_nesting_depth_of_the_parentheses.rb | 19 +++++++++-- ...n_of_array_after_removing_some_elements.rb | 8 ++++- ..._substring_between_two_equal_characters.rb | 10 +++--- test/easy/test_1629_slowest_key.rb | 7 ++-- ...1636_sort_array_by_increasing_frequency.rb | 29 ++++++++++++++--- ...est_1646_get_maximum_in_generated_array.rb | 10 +++--- test/easy/test_1652_defuse_the_bomb.rb | 10 +++--- ...eck_if_two_string_arrays_are_equivalent.rb | 10 +++--- .../test_1668_maximum_repeating_substring.rb | 10 +++--- .../easy/test_1672_richest_customer_wealth.rb | 10 +++--- .../test_1678_goal_parser_interpretation.rb | 10 +++--- ..._count_the_number_of_consistent_strings.rb | 10 +++--- ...est_1688_count_of_matches_in_tournament.rb | 7 ++-- test/easy/test_1694_reformat_phone_number.rb | 10 +++--- ..._number_of_students_unable_to_eat_lunch.rb | 21 ++++++++++-- ...04_determine_if_string_halves_are_alike.rb | 7 ++-- .../test_1710_maximum_units_on_a_truck.rb | 30 +++++++++++++++-- ...t_1716_calculate_money_in_leetcode_bank.rb | 10 +++--- test/easy/test_1720_decode_xored_array.rb | 7 ++-- ...angles_that_can_form_the_largest_square.rb | 29 +++++++++++++++-- .../test_1732_find_the_highest_altitude.rb | 7 ++-- ..._latest_time_by_replacing_hidden_digits.rb | 17 +++++----- test/easy/test_1748_sum_of_unique_elements.rb | 10 +++--- ...52_check_if_array_is_sorted_and_rotated.rb | 10 +++--- .../test_1768_merge_strings_alternately.rb | 10 +++--- .../test_1773_count_items_matching_a_rule.rb | 7 ++-- ...int_that_has_the_same_x_or_y_coordinate.rb | 23 ++++++++++--- ..._string_has_at_most_one_segment_of_ones.rb | 7 ++-- 62 files changed, 584 insertions(+), 263 deletions(-) diff --git a/test/easy/test_1431_kids_with_the_greatest_number_of_candies.rb b/test/easy/test_1431_kids_with_the_greatest_number_of_candies.rb index 192d64de..9a3d9c40 100644 --- a/test/easy/test_1431_kids_with_the_greatest_number_of_candies.rb +++ b/test/easy/test_1431_kids_with_the_greatest_number_of_candies.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class KidsWithTheGreatestNumberOfCandiesTest < ::Minitest::Test - def test_default - assert_equal([true, true, true, false, true], kids_with_candies([2, 3, 5, 1, 3], 3)) - assert_equal([true, false, false, false, false], kids_with_candies([4, 2, 1, 1, 2], 1)) - assert_equal([true, false, true], kids_with_candies([12, 1, 12], 10)) + def test_default_one + assert_equal( + [true, true, true, false, true], + kids_with_candies( + [2, 3, 5, 1, 3], + 3 + ) + ) + end + + def test_default_two + assert_equal( + [true, false, false, false, false], + kids_with_candies( + [4, 2, 1, 1, 2], + 1 + ) + ) + end + + def test_default_three + assert_equal( + [true, false, true], + kids_with_candies( + [12, 1, 12], + 10 + ) + ) end end diff --git a/test/easy/test_1436_destination_city.rb b/test/easy/test_1436_destination_city.rb index 71e919f6..c78548ba 100644 --- a/test/easy/test_1436_destination_city.rb +++ b/test/easy/test_1436_destination_city.rb @@ -5,12 +5,34 @@ require 'minitest/autorun' class DestinationCityTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 'Sao Paulo', - dest_city([['London', 'New York'], ['New York', 'Lima'], ['Lima', 'Sao Paulo']]) + dest_city( + [ + ['London', 'New York'], + ['New York', 'Lima'], + ['Lima', 'Sao Paulo'] + ] + ) + ) + end + + def test_default_two + assert_equal( + 'A', + dest_city( + [%w[B C], %w[D B], %w[C A]] + ) + ) + end + + def test_default_three + assert_equal( + 'Z', + dest_city( + [%w[A Z]] + ) ) - assert_equal('A', dest_city([%w[B C], %w[D B], %w[C A]])) - assert_equal('Z', dest_city([%w[A Z]])) end end diff --git a/test/easy/test_1437_check_if_all_1s_are_at_least_length_k_places_away.rb b/test/easy/test_1437_check_if_all_1s_are_at_least_length_k_places_away.rb index a4ef5e95..055446ef 100644 --- a/test/easy/test_1437_check_if_all_1s_are_at_least_length_k_places_away.rb +++ b/test/easy/test_1437_check_if_all_1s_are_at_least_length_k_places_away.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CheckIfAll1sAreAtLeastLengthKPlacesAwayTest < ::Minitest::Test - def test_default - assert(k_length_apart([1, 0, 0, 0, 1, 0, 0, 1], 2)) - assert(!k_length_apart([1, 0, 0, 1, 0, 1], 2)) - end + def test_default_one = assert(k_length_apart([1, 0, 0, 0, 1, 0, 0, 1], 2)) + + def test_default_two = assert(!k_length_apart([1, 0, 0, 1, 0, 1], 2)) end diff --git a/test/easy/test_1446_consecutive_characters.rb b/test/easy/test_1446_consecutive_characters.rb index e85c50b4..61eaefd3 100644 --- a/test/easy/test_1446_consecutive_characters.rb +++ b/test/easy/test_1446_consecutive_characters.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ConsecutiveCharactersTest < ::Minitest::Test - def test_default - assert_equal(2, max_power('leetcode')) - assert_equal(5, max_power('abbcccddddeeeeedcba')) - end + def test_default_one = assert_equal(2, max_power('leetcode')) + + def test_default_two = assert_equal(5, max_power('abbcccddddeeeeedcba')) end diff --git a/test/easy/test_1450_number_of_students_doing_homework_at_a_given_time.rb b/test/easy/test_1450_number_of_students_doing_homework_at_a_given_time.rb index f38006bb..a27aaddd 100644 --- a/test/easy/test_1450_number_of_students_doing_homework_at_a_given_time.rb +++ b/test/easy/test_1450_number_of_students_doing_homework_at_a_given_time.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class NumberOfStudentsDoingHomeworkAtAGivenTimeTest < ::Minitest::Test - def test_default - assert_equal(1, busy_student([1, 2, 3], [3, 2, 7], 4)) - assert_equal(1, busy_student([4], [4], 4)) - end + def test_default_one = assert_equal(1, busy_student([1, 2, 3], [3, 2, 7], 4)) + + def test_default_two = assert_equal(1, busy_student([4], [4], 4)) end diff --git a/test/easy/test_1455_check_if_a_word_occurs_as_a_prefix_of_any_word_in_a_sentence.rb b/test/easy/test_1455_check_if_a_word_occurs_as_a_prefix_of_any_word_in_a_sentence.rb index 730ae8cb..a20f4c6f 100644 --- a/test/easy/test_1455_check_if_a_word_occurs_as_a_prefix_of_any_word_in_a_sentence.rb +++ b/test/easy/test_1455_check_if_a_word_occurs_as_a_prefix_of_any_word_in_a_sentence.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class CheckIfAWordOccursAsAPrefixOfAnyWordInASentenceTest < ::Minitest::Test - def test_default - assert_equal(4, is_prefix_of_word('i love eating burger', 'burg')) - assert_equal(2, is_prefix_of_word('this problem is an easy problem', 'pro')) - assert_equal(-1, is_prefix_of_word('i am tired', 'you')) + def test_default_one + assert_equal( + 4, + is_prefix_of_word( + 'i love eating burger', + 'burg' + ) + ) + end + + def test_default_two + assert_equal( + 2, + is_prefix_of_word( + 'this problem is an easy problem', + 'pro' + ) + ) + end + + def test_default_three + assert_equal( + -1, + is_prefix_of_word( + 'i am tired', + 'you' + ) + ) end end diff --git a/test/easy/test_1460_make_two_arrays_equal_by_reversing_subarrays.rb b/test/easy/test_1460_make_two_arrays_equal_by_reversing_subarrays.rb index c12b87f1..21c2f4a2 100644 --- a/test/easy/test_1460_make_two_arrays_equal_by_reversing_subarrays.rb +++ b/test/easy/test_1460_make_two_arrays_equal_by_reversing_subarrays.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MakeTwoArraysEqualByReversingSubarraysTest < ::Minitest::Test - def test_default - assert(can_be_equal([1, 2, 3, 4], [2, 4, 1, 3])) - assert(can_be_equal([7], [7])) - assert(!can_be_equal([3, 7, 9], [3, 7, 11])) - end + def test_default_one = assert(can_be_equal([1, 2, 3, 4], [2, 4, 1, 3])) + + def test_default_two = assert(can_be_equal([7], [7])) + + def test_default_three = assert(!can_be_equal([3, 7, 9], [3, 7, 11])) end diff --git a/test/easy/test_1464_maximum_product_of_two_elements_in_an_array.rb b/test/easy/test_1464_maximum_product_of_two_elements_in_an_array.rb index 83e734cc..dc6e6e1a 100644 --- a/test/easy/test_1464_maximum_product_of_two_elements_in_an_array.rb +++ b/test/easy/test_1464_maximum_product_of_two_elements_in_an_array.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumProductOfTwoElementsInAnArrayTest < ::Minitest::Test - def test_default - assert_equal(12, max_product([3, 4, 5, 2])) - assert_equal(16, max_product([1, 5, 4, 5])) - assert_equal(12, max_product([3, 7])) - end + def test_default_one = assert_equal(12, max_product([3, 4, 5, 2])) + + def test_default_two = assert_equal(16, max_product([1, 5, 4, 5])) + + def test_default_three = assert_equal(12, max_product([3, 7])) end diff --git a/test/easy/test_1470_shuffle_the_array.rb b/test/easy/test_1470_shuffle_the_array.rb index fa1e8da9..2e51dfd4 100644 --- a/test/easy/test_1470_shuffle_the_array.rb +++ b/test/easy/test_1470_shuffle_the_array.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class ShuffleTheArrayTest < ::Minitest::Test - def test_default - assert_equal([2, 3, 5, 4, 1, 7], shuffle([2, 5, 1, 3, 4, 7], 3)) - assert_equal([1, 4, 2, 3, 3, 2, 4, 1], shuffle([1, 2, 3, 4, 4, 3, 2, 1], 4)) - assert_equal([1, 2, 1, 2], shuffle([1, 1, 2, 2], 2)) + def test_default_one + assert_equal( + [2, 3, 5, 4, 1, 7], + shuffle( + [2, 5, 1, 3, 4, 7], + 3 + ) + ) + end + + def test_default_two + assert_equal( + [1, 4, 2, 3, 3, 2, 4, 1], + shuffle( + [1, 2, 3, 4, 4, 3, 2, 1], + 4 + ) + ) + end + + def test_default_three + assert_equal( + [1, 2, 1, 2], + shuffle( + [1, 1, 2, 2], + 2 + ) + ) end end diff --git a/test/easy/test_1475_final_prices_with_a_special_discount_in_a_shop.rb b/test/easy/test_1475_final_prices_with_a_special_discount_in_a_shop.rb index 98bd7c86..144ae8fa 100644 --- a/test/easy/test_1475_final_prices_with_a_special_discount_in_a_shop.rb +++ b/test/easy/test_1475_final_prices_with_a_special_discount_in_a_shop.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class FinalPricesWithASpecialDiscountInAShopTest < ::Minitest::Test - def test_default - assert_equal([4, 2, 4, 2, 3], final_prices([8, 4, 6, 2, 3])) - assert_equal([1, 2, 3, 4, 5], final_prices([1, 2, 3, 4, 5])) - assert_equal([9, 0, 1, 6], final_prices([10, 1, 1, 6])) + def test_default_one + assert_equal( + [4, 2, 4, 2, 3], + final_prices( + [8, 4, 6, 2, 3] + ) + ) + end + + def test_default_two + assert_equal( + [1, 2, 3, 4, 5], + final_prices( + [1, 2, 3, 4, 5] + ) + ) + end + + def test_default_three + assert_equal( + [9, 0, 1, 6], + final_prices( + [10, 1, 1, 6] + ) + ) end end diff --git a/test/easy/test_1480_running_sum_of_1d_array.rb b/test/easy/test_1480_running_sum_of_1d_array.rb index 553a06c7..35773ec9 100644 --- a/test/easy/test_1480_running_sum_of_1d_array.rb +++ b/test/easy/test_1480_running_sum_of_1d_array.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class RunningSumOf1dArrayTest < ::Minitest::Test - def test_default - assert_equal([1, 3, 6, 10], running_sum([1, 2, 3, 4])) - assert_equal([1, 2, 3, 4, 5], running_sum([1, 1, 1, 1, 1])) - assert_equal([3, 4, 6, 16, 17], running_sum([3, 1, 2, 10, 1])) + def test_default_one + assert_equal( + [1, 3, 6, 10], + running_sum( + [1, 2, 3, 4] + ) + ) + end + + def test_default_two + assert_equal( + [1, 2, 3, 4, 5], + running_sum( + [1, 1, 1, 1, 1] + ) + ) + end + + def test_default_three + assert_equal( + [3, 4, 6, 16, 17], + running_sum( + [3, 1, 2, 10, 1] + ) + ) end end diff --git a/test/easy/test_1486_xor_operation_in_an_array.rb b/test/easy/test_1486_xor_operation_in_an_array.rb index 5f5caf35..61263428 100644 --- a/test/easy/test_1486_xor_operation_in_an_array.rb +++ b/test/easy/test_1486_xor_operation_in_an_array.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class XOROperationInAnArrayTest < ::Minitest::Test - def test_default - assert_equal(8, xor_operation(5, 0)) - assert_equal(8, xor_operation(4, 3)) - end + def test_default_one = assert_equal(8, xor_operation(5, 0)) + + def test_default_two = assert_equal(8, xor_operation(4, 3)) end diff --git a/test/easy/test_1491_average_salary_excluding_the_minimum_and_maximum_salary.rb b/test/easy/test_1491_average_salary_excluding_the_minimum_and_maximum_salary.rb index fb455de0..b48bccd2 100644 --- a/test/easy/test_1491_average_salary_excluding_the_minimum_and_maximum_salary.rb +++ b/test/easy/test_1491_average_salary_excluding_the_minimum_and_maximum_salary.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class AverageSalaryExcludingTheMinimumAndMaximumSalaryTest < ::Minitest::Test - def test_default - assert_equal(2500.00000, average([4000, 3000, 1000, 2000])) - assert_equal(2000.00000, average([1000, 2000, 3000])) + def test_default_one + assert_equal( + 2500.00000, + average( + [4000, 3000, 1000, 2000] + ) + ) + end + + def test_default_two + assert_equal( + 2000.00000, + average( + [1000, 2000, 3000] + ) + ) end end diff --git a/test/easy/test_1496_path_crossing.rb b/test/easy/test_1496_path_crossing.rb index 56408d31..76da195e 100644 --- a/test/easy/test_1496_path_crossing.rb +++ b/test/easy/test_1496_path_crossing.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class PathCrossingTest < ::Minitest::Test - def test_default - assert(!is_path_crossing('NES')) - assert(is_path_crossing('NESWW')) - end + def test_default_one = assert(!is_path_crossing('NES')) + + def test_default_two = assert(is_path_crossing('NESWW')) end diff --git a/test/easy/test_1502_can_make_arithmetic_progression_from_sequence.rb b/test/easy/test_1502_can_make_arithmetic_progression_from_sequence.rb index 93d8942e..f1df7286 100644 --- a/test/easy/test_1502_can_make_arithmetic_progression_from_sequence.rb +++ b/test/easy/test_1502_can_make_arithmetic_progression_from_sequence.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CanMakeArithmeticProgressionFromSequenceTest < ::Minitest::Test - def test_default - assert(can_make_arithmetic_progression([3, 5, 1])) - assert(!can_make_arithmetic_progression([1, 2, 4])) - end + def test_default_one = assert(can_make_arithmetic_progression([3, 5, 1])) + + def test_default_two = assert(!can_make_arithmetic_progression([1, 2, 4])) end diff --git a/test/easy/test_1507_reformat_date.rb b/test/easy/test_1507_reformat_date.rb index 510e70cf..f09663db 100644 --- a/test/easy/test_1507_reformat_date.rb +++ b/test/easy/test_1507_reformat_date.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ReformatDateTest < ::Minitest::Test - def test_default - assert_equal('2052-10-20', reformat_date('20th Oct 2052')) - assert_equal('1933-06-06', reformat_date('6th Jun 1933')) - assert_equal('1960-05-26', reformat_date('26th May 1960')) - end + def test_default_one = assert_equal('2052-10-20', reformat_date('20th Oct 2052')) + + def test_default_two = assert_equal('1933-06-06', reformat_date('6th Jun 1933')) + + def test_default_three = assert_equal('1960-05-26', reformat_date('26th May 1960')) end diff --git a/test/easy/test_1512_number_of_good_pairs.rb b/test/easy/test_1512_number_of_good_pairs.rb index ad4bd860..3e77edfb 100644 --- a/test/easy/test_1512_number_of_good_pairs.rb +++ b/test/easy/test_1512_number_of_good_pairs.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class NumberOfGoodPairsTest < ::Minitest::Test - def test_default - assert_equal(4, num_identical_pairs([1, 2, 3, 1, 1, 3])) - assert_equal(6, num_identical_pairs([1, 1, 1, 1])) - assert_equal(0, num_identical_pairs([1, 2, 3])) - end + def test_default_one = assert_equal(4, num_identical_pairs([1, 2, 3, 1, 1, 3])) + + def test_default_two = assert_equal(6, num_identical_pairs([1, 1, 1, 1])) + + def test_default_three = assert_equal(0, num_identical_pairs([1, 2, 3])) end diff --git a/test/easy/test_1518_water_bottles.rb b/test/easy/test_1518_water_bottles.rb index f0c12898..19491305 100644 --- a/test/easy/test_1518_water_bottles.rb +++ b/test/easy/test_1518_water_bottles.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class WaterBottlesTest < ::Minitest::Test - def test_default - assert_equal(13, num_water_bottles(9, 3)) - assert_equal(19, num_water_bottles(15, 4)) - end + def test_default_one = assert_equal(13, num_water_bottles(9, 3)) + + def test_default_two = assert_equal(19, num_water_bottles(15, 4)) end diff --git a/test/easy/test_1523_count_odd_numbers_in_an_interval_range.rb b/test/easy/test_1523_count_odd_numbers_in_an_interval_range.rb index c8c82150..79e8dcb3 100644 --- a/test/easy/test_1523_count_odd_numbers_in_an_interval_range.rb +++ b/test/easy/test_1523_count_odd_numbers_in_an_interval_range.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountOddNumbersInAnIntervalRangeTest < ::Minitest::Test - def test_default - assert_equal(3, count_odds(3, 7)) - assert_equal(1, count_odds(8, 10)) - end + def test_default_one = assert_equal(3, count_odds(3, 7)) + + def test_default_two = assert_equal(1, count_odds(8, 10)) end diff --git a/test/easy/test_1528_shuffle_string.rb b/test/easy/test_1528_shuffle_string.rb index 51981615..00fcc0ae 100644 --- a/test/easy/test_1528_shuffle_string.rb +++ b/test/easy/test_1528_shuffle_string.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class ShuffleStringTest < ::Minitest::Test - def test_default - assert_equal('leetcode', restore_string('codeleet', [4, 5, 6, 7, 0, 2, 1, 3])) - assert_equal('abc', restore_string('abc', [0, 1, 2])) + def test_default_one + assert_equal( + 'leetcode', + restore_string( + 'codeleet', + [4, 5, 6, 7, 0, 2, 1, 3] + ) + ) + end + + def test_default_two + assert_equal( + 'abc', + restore_string( + 'abc', + [0, 1, 2] + ) + ) end end diff --git a/test/easy/test_1534_count_good_triplets.rb b/test/easy/test_1534_count_good_triplets.rb index d71edf8a..5d85c4a8 100644 --- a/test/easy/test_1534_count_good_triplets.rb +++ b/test/easy/test_1534_count_good_triplets.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountGoodTripletsTest < ::Minitest::Test - def test_default - assert_equal(4, count_good_triplets([3, 0, 1, 1, 9, 7], 7, 2, 3)) - assert_equal(0, count_good_triplets([1, 1, 2, 2, 3], 0, 0, 1)) - end + def test_default_one = assert_equal(4, count_good_triplets([3, 0, 1, 1, 9, 7], 7, 2, 3)) + + def test_default_two = assert_equal(0, count_good_triplets([1, 1, 2, 2, 3], 0, 0, 1)) end diff --git a/test/easy/test_1539_kth_missing_positive_number.rb b/test/easy/test_1539_kth_missing_positive_number.rb index 61a75aa7..b5244022 100644 --- a/test/easy/test_1539_kth_missing_positive_number.rb +++ b/test/easy/test_1539_kth_missing_positive_number.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class KthMissingPositiveNumberTest < ::Minitest::Test - def test_default - assert_equal(9, find_kth_positive([2, 3, 4, 7, 11], 5)) - assert_equal(6, find_kth_positive([1, 2, 3, 4], 2)) - end + def test_default_one = assert_equal(9, find_kth_positive([2, 3, 4, 7, 11], 5)) + + def test_default_two = assert_equal(6, find_kth_positive([1, 2, 3, 4], 2)) end diff --git a/test/easy/test_1544_make_the_string_great.rb b/test/easy/test_1544_make_the_string_great.rb index aec54ba8..45b93edc 100644 --- a/test/easy/test_1544_make_the_string_great.rb +++ b/test/easy/test_1544_make_the_string_great.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MakeTheStringGreatTest < ::Minitest::Test - def test_default - assert_equal('leetcode', make_good('leEeetcode')) - assert_equal('', make_good('abBAcC')) - assert_equal('s', make_good('s')) - end + def test_default_one = assert_equal('leetcode', make_good('leEeetcode')) + + def test_default_two = assert_equal('', make_good('abBAcC')) + + def test_default_three = assert_equal('s', make_good('s')) end diff --git a/test/easy/test_1550_three_consecutive_odds.rb b/test/easy/test_1550_three_consecutive_odds.rb index 67b3cf4f..1cee1b6b 100644 --- a/test/easy/test_1550_three_consecutive_odds.rb +++ b/test/easy/test_1550_three_consecutive_odds.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ThreeConsecutiveOddsTest < ::Minitest::Test - def test_default - assert(!three_consecutive_odds([2, 6, 4, 1])) - assert(three_consecutive_odds([1, 2, 34, 3, 4, 5, 7, 23, 12])) - end + def test_default_one = assert(!three_consecutive_odds([2, 6, 4, 1])) + + def test_default_two = assert(three_consecutive_odds([1, 2, 34, 3, 4, 5, 7, 23, 12])) end diff --git a/test/easy/test_1556_thousand_separator.rb b/test/easy/test_1556_thousand_separator.rb index de67ec9f..df18f8e8 100644 --- a/test/easy/test_1556_thousand_separator.rb +++ b/test/easy/test_1556_thousand_separator.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ThousandSeparatorTest < ::Minitest::Test - def test_default - assert_equal('987', thousand_separator(987)) - assert_equal('1.234', thousand_separator(1234)) - end + def test_default_one = assert_equal('987', thousand_separator(987)) + + def test_default_two = assert_equal('1.234', thousand_separator(1234)) end diff --git a/test/easy/test_1566_detect_pattern_of_length_m_repeated_k_or_more_times.rb b/test/easy/test_1566_detect_pattern_of_length_m_repeated_k_or_more_times.rb index 01cd4618..ee75dc10 100644 --- a/test/easy/test_1566_detect_pattern_of_length_m_repeated_k_or_more_times.rb +++ b/test/easy/test_1566_detect_pattern_of_length_m_repeated_k_or_more_times.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class DetectPatternOnLengthMRepeatedKOrMoreTimesTest < ::Minitest::Test - def test_default - assert(contains_pattern([1, 2, 4, 4, 4, 4], 1, 3)) - assert(contains_pattern([1, 2, 1, 2, 1, 1, 1, 3], 2, 2)) - assert(!contains_pattern([1, 2, 1, 2, 1, 3], 2, 3)) - end + def test_default_one = assert(contains_pattern([1, 2, 4, 4, 4, 4], 1, 3)) + + def test_default_two = assert(contains_pattern([1, 2, 1, 2, 1, 1, 1, 3], 2, 2)) + + def test_default_three = assert(!contains_pattern([1, 2, 1, 2, 1, 3], 2, 3)) end diff --git a/test/easy/test_1572_matrix_diagonal_sum.rb b/test/easy/test_1572_matrix_diagonal_sum.rb index e9fe0f67..9e31a098 100644 --- a/test/easy/test_1572_matrix_diagonal_sum.rb +++ b/test/easy/test_1572_matrix_diagonal_sum.rb @@ -5,9 +5,32 @@ require 'minitest/autorun' class MatrixDiagonalSumTest < ::Minitest::Test - def test_default - assert_equal(25, diagonal_sum([[1, 2, 3], [4, 5, 6], [7, 8, 9]])) - assert_equal(8, diagonal_sum([[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]])) - assert_equal(5, diagonal_sum([[5]])) + def test_default_one + assert_equal( + 25, + diagonal_sum( + [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9] + ] + ) + ) end + + def test_default_two + assert_equal( + 8, + diagonal_sum( + [ + [1, 1, 1, 1], + [1, 1, 1, 1], + [1, 1, 1, 1], + [1, 1, 1, 1] + ] + ) + ) + end + + def test_default_three = assert_equal(5, diagonal_sum([[5]])) end diff --git a/test/easy/test_1576_replace_all_s_to_avoid_consecutive_repeating_characters.rb b/test/easy/test_1576_replace_all_s_to_avoid_consecutive_repeating_characters.rb index 2bbb6ea5..769818f1 100644 --- a/test/easy/test_1576_replace_all_s_to_avoid_consecutive_repeating_characters.rb +++ b/test/easy/test_1576_replace_all_s_to_avoid_consecutive_repeating_characters.rb @@ -5,12 +5,9 @@ require 'minitest/autorun' class ReplaceAllSToAvoidConsecutiveRepeatingCharactersTest < ::Minitest::Test - def test_default - assert_equal('azs', modify_string('?zs')) - assert_equal('ubvaw', modify_string('ubv?w')) - end + def test_default_one = assert_equal('azs', modify_string('?zs')) - def test_additional - assert_equal('ab', modify_string('a?')) - end + def test_default_two = assert_equal('ubvaw', modify_string('ubv?w')) + + def test_additional_one = assert_equal('ab', modify_string('a?')) end diff --git a/test/easy/test_1582_special_positions_in_a_binary_matrix.rb b/test/easy/test_1582_special_positions_in_a_binary_matrix.rb index f956e7f5..7fffc0bc 100644 --- a/test/easy/test_1582_special_positions_in_a_binary_matrix.rb +++ b/test/easy/test_1582_special_positions_in_a_binary_matrix.rb @@ -5,8 +5,29 @@ require 'minitest/autorun' class SpecialPositionsInABinaryMatrixTest < ::Minitest::Test - def test_default - assert_equal(1, num_special([[1, 0, 0], [0, 0, 1], [1, 0, 0]])) - assert_equal(3, num_special([[1, 0, 0], [0, 1, 0], [0, 0, 1]])) + def test_default_one + assert_equal( + 1, + num_special( + [ + [1, 0, 0], + [0, 0, 1], + [1, 0, 0] + ] + ) + ) + end + + def test_default_two + assert_equal( + 3, + num_special( + [ + [1, 0, 0], + [0, 1, 0], + [0, 0, 1] + ] + ) + ) end end diff --git a/test/easy/test_1588_sum_of_all_odd_length_subarrays.rb b/test/easy/test_1588_sum_of_all_odd_length_subarrays.rb index ac777681..fdd1f05c 100644 --- a/test/easy/test_1588_sum_of_all_odd_length_subarrays.rb +++ b/test/easy/test_1588_sum_of_all_odd_length_subarrays.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class SumOfAllOddLengthSubarraysTest < ::Minitest::Test - def test_default - assert_equal(58, sum_odd_length_subarrays([1, 4, 2, 5, 3])) - assert_equal(3, sum_odd_length_subarrays([1, 2])) - assert_equal(66, sum_odd_length_subarrays([10, 11, 12])) - end + def test_default_one = assert_equal(58, sum_odd_length_subarrays([1, 4, 2, 5, 3])) + + def test_default_two = assert_equal(3, sum_odd_length_subarrays([1, 2])) + + def test_default_three = assert_equal(66, sum_odd_length_subarrays([10, 11, 12])) end diff --git a/test/easy/test_1592_rearrange_spaces_between_words.rb b/test/easy/test_1592_rearrange_spaces_between_words.rb index 1465488f..f5aa9099 100644 --- a/test/easy/test_1592_rearrange_spaces_between_words.rb +++ b/test/easy/test_1592_rearrange_spaces_between_words.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class RearrangeSpacesBetweenWordsTest < ::Minitest::Test - def test_default - assert_equal('this is a sentence', reorder_spaces(' this is a sentence ')) - assert_equal('practice makes perfect ', reorder_spaces(' practice makes perfect')) + def test_default_one + assert_equal( + 'this is a sentence', + reorder_spaces( + ' this is a sentence ' + ) + ) + end + + def test_default_two + assert_equal( + 'practice makes perfect ', + reorder_spaces( + ' practice makes perfect' + ) + ) end end diff --git a/test/easy/test_1598_crawler_log_folder.rb b/test/easy/test_1598_crawler_log_folder.rb index 19d0ae13..8af2aadc 100644 --- a/test/easy/test_1598_crawler_log_folder.rb +++ b/test/easy/test_1598_crawler_log_folder.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CrawlerLogFolderTest < ::Minitest::Test - def test_default - assert_equal(2, _1598_min_operations(%w[d1/ d2/ ../ d21/ ./])) - assert_equal(3, _1598_min_operations(%w[d1/ d2/ ./ d3/ ../ d31/])) - assert_equal(0, _1598_min_operations(%w[d1/ ../ ../ ../])) - end + def test_default_one = assert_equal(2, _1598_min_operations(%w[d1/ d2/ ../ d21/ ./])) + + def test_default_two = assert_equal(3, _1598_min_operations(%w[d1/ d2/ ./ d3/ ../ d31/])) + + def test_default_three = assert_equal(0, _1598_min_operations(%w[d1/ ../ ../ ../])) end diff --git a/test/easy/test_1603_design_parking_system.rb b/test/easy/test_1603_design_parking_system.rb index f26608a3..0c264c3e 100644 --- a/test/easy/test_1603_design_parking_system.rb +++ b/test/easy/test_1603_design_parking_system.rb @@ -5,16 +5,18 @@ require 'minitest/autorun' class DesignParkingSystemTest < ::Minitest::Test - def test_default + def test_default_one parking_system = ::ParkingSystem.new(1, 1, 0) + assert(parking_system.add_car(1)) assert(parking_system.add_car(2)) assert(!parking_system.add_car(3)) assert(!parking_system.add_car(1)) end - def test_additional + def test_additional_one parking_system = ::ParkingSystem.new(1, 1, 1) + assert(parking_system.add_car(1)) assert(parking_system.add_car(2)) assert(parking_system.add_car(3)) diff --git a/test/easy/test_1608_special_array_with_x_elements_greater_than_or_equal_x.rb b/test/easy/test_1608_special_array_with_x_elements_greater_than_or_equal_x.rb index b1ec31dc..f4dedf4e 100644 --- a/test/easy/test_1608_special_array_with_x_elements_greater_than_or_equal_x.rb +++ b/test/easy/test_1608_special_array_with_x_elements_greater_than_or_equal_x.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class SpecialArrayWithXElementsGreaterThanOrEqualXTest < ::Minitest::Test - def test_default - assert_equal(2, special_array([3, 5])) - assert_equal(-1, special_array([0, 0])) - assert_equal(3, special_array([0, 4, 3, 0, 4])) - end + def test_default_one = assert_equal(2, special_array([3, 5])) + + def test_default_two = assert_equal(-1, special_array([0, 0])) + + def test_default_three = assert_equal(3, special_array([0, 4, 3, 0, 4])) end diff --git a/test/easy/test_1614_maximum_nesting_depth_of_the_parentheses.rb b/test/easy/test_1614_maximum_nesting_depth_of_the_parentheses.rb index 389e7e1b..e336b69c 100644 --- a/test/easy/test_1614_maximum_nesting_depth_of_the_parentheses.rb +++ b/test/easy/test_1614_maximum_nesting_depth_of_the_parentheses.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class MaximumNestingDepthOfTheParenthesesTest < ::Minitest::Test - def test_default - assert_equal(3, max_depth_of_the_parentheses('(1+(2*3)+((8)/4))+1')) - assert_equal(3, max_depth_of_the_parentheses('(1)+((2))+(((3)))')) + def test_default_one + assert_equal( + 3, + max_depth_of_the_parentheses( + '(1+(2*3)+((8)/4))+1' + ) + ) + end + + def test_default_two + assert_equal( + 2, + max_depth_of_the_parentheses( + '1)+((2))+(((3)))' + ) + ) end end diff --git a/test/easy/test_1619_mean_of_array_after_removing_some_elements.rb b/test/easy/test_1619_mean_of_array_after_removing_some_elements.rb index a5d93c6a..616c3264 100644 --- a/test/easy/test_1619_mean_of_array_after_removing_some_elements.rb +++ b/test/easy/test_1619_mean_of_array_after_removing_some_elements.rb @@ -6,7 +6,7 @@ class MeanOfArrayAfterMovingSomeElementsTest < ::Minitest::Test # rubocop:disable Style/DisableCopsWithinSourceCodeDirective, Layout/MultilineArrayLineBreaks - def test_default + def test_default_one assert_equal( 2.00000, trim_mean( @@ -16,6 +16,9 @@ def test_default ] ) ) + end + + def test_default_two assert_equal( 4.00000, trim_mean( @@ -25,6 +28,9 @@ def test_default ] ) ) + end + + def test_default_three assert_equal( 4.777777777777778, trim_mean( diff --git a/test/easy/test_1624_largest_substring_between_two_equal_characters.rb b/test/easy/test_1624_largest_substring_between_two_equal_characters.rb index a99c85c4..7fc89e38 100644 --- a/test/easy/test_1624_largest_substring_between_two_equal_characters.rb +++ b/test/easy/test_1624_largest_substring_between_two_equal_characters.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class LargestSubstringBetweenTwoEqualCharactersTest < ::Minitest::Test - def test_default - assert_equal(0, max_length_between_equal_characters('aa')) - assert_equal(2, max_length_between_equal_characters('abca')) - assert_equal(-1, max_length_between_equal_characters('cbzxy')) - end + def test_default_one = assert_equal(0, max_length_between_equal_characters('aa')) + + def test_default_two = assert_equal(2, max_length_between_equal_characters('abca')) + + def test_default_three = assert_equal(-1, max_length_between_equal_characters('cbzxy')) end diff --git a/test/easy/test_1629_slowest_key.rb b/test/easy/test_1629_slowest_key.rb index c0fb2e97..c4a550c0 100644 --- a/test/easy/test_1629_slowest_key.rb +++ b/test/easy/test_1629_slowest_key.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class SlowestKeyTest < ::Minitest::Test - def test_default - assert_equal('c', slowest_key([9, 29, 49, 50], 'cbcd')) - assert_equal('a', slowest_key([12, 23, 36, 46, 62], 'spuda')) - end + def test_default_one = assert_equal('c', slowest_key([9, 29, 49, 50], 'cbcd')) + + def test_default_two = assert_equal('a', slowest_key([12, 23, 36, 46, 62], 'spuda')) end diff --git a/test/easy/test_1636_sort_array_by_increasing_frequency.rb b/test/easy/test_1636_sort_array_by_increasing_frequency.rb index 9d024115..cc3fb57f 100644 --- a/test/easy/test_1636_sort_array_by_increasing_frequency.rb +++ b/test/easy/test_1636_sort_array_by_increasing_frequency.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class SortArrayByIncreasingFrequencyTest < ::Minitest::Test - def test_default - assert_equal([3, 1, 1, 2, 2, 2], frequency_sort([1, 1, 2, 2, 2, 3])) - assert_equal([1, 3, 3, 2, 2], frequency_sort([2, 3, 1, 3, 2])) - assert_equal([5, -1, 4, 4, -6, -6, 1, 1, 1], frequency_sort([-1, 1, -6, 4, 5, -6, 1, 4, 1])) + def test_default_one + assert_equal( + [3, 1, 1, 2, 2, 2], + frequency_sort( + [1, 1, 2, 2, 2, 3] + ) + ) + end + + def test_default_two + assert_equal( + [1, 3, 3, 2, 2], + frequency_sort( + [2, 3, 1, 3, 2] + ) + ) + end + + def test_default_three + assert_equal( + [5, -1, 4, 4, -6, -6, 1, 1, 1], + frequency_sort( + [-1, 1, -6, 4, 5, -6, 1, 4, 1] + ) + ) end end diff --git a/test/easy/test_1646_get_maximum_in_generated_array.rb b/test/easy/test_1646_get_maximum_in_generated_array.rb index 3e7d0581..d5e036ea 100644 --- a/test/easy/test_1646_get_maximum_in_generated_array.rb +++ b/test/easy/test_1646_get_maximum_in_generated_array.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class GetMaximumInGeneratedArrayTest < ::Minitest::Test - def test_default - assert_equal(3, get_maximum_generated(7)) - assert_equal(1, get_maximum_generated(2)) - assert_equal(2, get_maximum_generated(3)) - end + def test_default_one = assert_equal(3, get_maximum_generated(7)) + + def test_default_two = assert_equal(1, get_maximum_generated(2)) + + def test_default_three = assert_equal(2, get_maximum_generated(3)) end diff --git a/test/easy/test_1652_defuse_the_bomb.rb b/test/easy/test_1652_defuse_the_bomb.rb index df8b6b0d..b2a20d29 100644 --- a/test/easy/test_1652_defuse_the_bomb.rb +++ b/test/easy/test_1652_defuse_the_bomb.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class DefuseTheBombTest < ::Minitest::Test - def test_default - assert_equal([12, 10, 16, 13], decrypt([5, 7, 1, 4], 3)) - assert_equal([0, 0, 0, 0], decrypt([1, 2, 3, 4], 0)) - assert_equal([12, 5, 6, 13], decrypt([2, 4, 9, 3], -2)) - end + def test_default_one = assert_equal([12, 10, 16, 13], decrypt([5, 7, 1, 4], 3)) + + def test_default_two = assert_equal([0, 0, 0, 0], decrypt([1, 2, 3, 4], 0)) + + def test_default_three = assert_equal([12, 5, 6, 13], decrypt([2, 4, 9, 3], -2)) end diff --git a/test/easy/test_1662_check_if_two_string_arrays_are_equivalent.rb b/test/easy/test_1662_check_if_two_string_arrays_are_equivalent.rb index 177d01f8..283de64a 100644 --- a/test/easy/test_1662_check_if_two_string_arrays_are_equivalent.rb +++ b/test/easy/test_1662_check_if_two_string_arrays_are_equivalent.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CheckIfTwoStringArraysAreEquivalentTest < ::Minitest::Test - def test_default - assert(array_strings_are_equal(%w[ab c], %w[a bc])) - assert(!array_strings_are_equal(%w[a cb], %w[ab c])) - assert(array_strings_are_equal(%w[abc d defg], ['abcddefg'])) - end + def test_default_one = assert(array_strings_are_equal(%w[ab c], %w[a bc])) + + def test_default_two = assert(!array_strings_are_equal(%w[a cb], %w[ab c])) + + def test_default_three = assert(array_strings_are_equal(%w[abc d defg], ['abcddefg'])) end diff --git a/test/easy/test_1668_maximum_repeating_substring.rb b/test/easy/test_1668_maximum_repeating_substring.rb index 31288ea6..7921b876 100644 --- a/test/easy/test_1668_maximum_repeating_substring.rb +++ b/test/easy/test_1668_maximum_repeating_substring.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumRepeatingSubstringTest < ::Minitest::Test - def test_default - assert_equal(2, max_repeating('ababc', 'ab')) - assert_equal(1, max_repeating('ababc', 'ba')) - assert_equal(0, max_repeating('ababc', 'ac')) - end + def test_default_one = assert_equal(2, max_repeating('ababc', 'ab')) + + def test_default_two = assert_equal(1, max_repeating('ababc', 'ba')) + + def test_default_three = assert_equal(0, max_repeating('ababc', 'ac')) end diff --git a/test/easy/test_1672_richest_customer_wealth.rb b/test/easy/test_1672_richest_customer_wealth.rb index 89725a3b..3dcbbeec 100644 --- a/test/easy/test_1672_richest_customer_wealth.rb +++ b/test/easy/test_1672_richest_customer_wealth.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class RichestCustomerWealthTest < ::Minitest::Test - def test_default - assert_equal(6, maximum_wealth([[1, 2, 3], [3, 2, 1]])) - assert_equal(10, maximum_wealth([[1, 5], [7, 3], [3, 5]])) - assert_equal(17, maximum_wealth([[2, 8, 7], [7, 1, 3], [1, 9, 5]])) - end + def test_default_one = assert_equal(6, maximum_wealth([[1, 2, 3], [3, 2, 1]])) + + def test_default_two = assert_equal(10, maximum_wealth([[1, 5], [7, 3], [3, 5]])) + + def test_default_three = assert_equal(17, maximum_wealth([[2, 8, 7], [7, 1, 3], [1, 9, 5]])) end diff --git a/test/easy/test_1678_goal_parser_interpretation.rb b/test/easy/test_1678_goal_parser_interpretation.rb index 832da9ae..a0a4d614 100644 --- a/test/easy/test_1678_goal_parser_interpretation.rb +++ b/test/easy/test_1678_goal_parser_interpretation.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class GoalParserInterpretationTest < ::Minitest::Test - def test_default - assert_equal('Goal', interpret('G()(al)')) - assert_equal('Gooooal', interpret('G()()()()(al)')) - assert_equal('alGalooG', interpret('(al)G(al)()()G')) - end + def test_default_one = assert_equal('Goal', interpret('G()(al)')) + + def test_default_two = assert_equal('Gooooal', interpret('G()()()()(al)')) + + def test_default_three = assert_equal('alGalooG', interpret('(al)G(al)()()G')) end diff --git a/test/easy/test_1684_count_the_number_of_consistent_strings.rb b/test/easy/test_1684_count_the_number_of_consistent_strings.rb index 5f9e2809..82d07aba 100644 --- a/test/easy/test_1684_count_the_number_of_consistent_strings.rb +++ b/test/easy/test_1684_count_the_number_of_consistent_strings.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CountTheNumberOfConsistentStringsTest < ::Minitest::Test - def test_default - assert_equal(2, count_consistent_strings('ab', %w[ad bd aaab baa badab])) - assert_equal(7, count_consistent_strings('abc', %w[a b c ab ac bc abc])) - assert_equal(4, count_consistent_strings('cad', %w[cc acd b ba bac bad ac d])) - end + def test_default_one = assert_equal(2, count_consistent_strings('ab', %w[ad bd aaab baa badab])) + + def test_default_two = assert_equal(7, count_consistent_strings('abc', %w[a b c ab ac bc abc])) + + def test_default_three = assert_equal(4, count_consistent_strings('cad', %w[cc acd b ba bac bad ac d])) end diff --git a/test/easy/test_1688_count_of_matches_in_tournament.rb b/test/easy/test_1688_count_of_matches_in_tournament.rb index fc69643e..032a5698 100644 --- a/test/easy/test_1688_count_of_matches_in_tournament.rb +++ b/test/easy/test_1688_count_of_matches_in_tournament.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountOfMatchesInTournamentTest < ::Minitest::Test - def test_default - assert_equal(6, number_of_matches(7)) - assert_equal(13, number_of_matches(14)) - end + def test_default_one = assert_equal(6, number_of_matches(7)) + + def test_default_two = assert_equal(13, number_of_matches(14)) end diff --git a/test/easy/test_1694_reformat_phone_number.rb b/test/easy/test_1694_reformat_phone_number.rb index ba828258..5c759510 100644 --- a/test/easy/test_1694_reformat_phone_number.rb +++ b/test/easy/test_1694_reformat_phone_number.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ReformatPhoneNumberTest < ::Minitest::Test - def test_default - assert_equal('123-456', reformat_number('1-23-45 6')) - assert_equal('123-45-67', reformat_number('123 4-567')) - assert_equal('123-456-78', reformat_number('123 4-5678')) - end + def test_default_one = assert_equal('123-456', reformat_number('1-23-45 6')) + + def test_default_two = assert_equal('123-45-67', reformat_number('123 4-567')) + + def test_default_three = assert_equal('123-456-78', reformat_number('123 4-5678')) end diff --git a/test/easy/test_1700_number_of_students_unable_to_eat_lunch.rb b/test/easy/test_1700_number_of_students_unable_to_eat_lunch.rb index 4e8b4a64..49918829 100644 --- a/test/easy/test_1700_number_of_students_unable_to_eat_lunch.rb +++ b/test/easy/test_1700_number_of_students_unable_to_eat_lunch.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class NumberOfStudentsUnableToEatLunchTest < ::Minitest::Test - def test_default - assert_equal(0, count_students([1, 1, 0, 0], [0, 1, 0, 1])) - assert_equal(3, count_students([1, 1, 1, 0, 0, 1], [1, 0, 0, 0, 1, 1])) + def test_default_one + assert_equal( + 0, + count_students( + [1, 1, 0, 0], + [0, 1, 0, 1] + ) + ) + end + + def test_default_two + assert_equal( + 3, + count_students( + [1, 1, 1, 0, 0, 1], + [1, 0, 0, 0, 1, 1] + ) + ) end end diff --git a/test/easy/test_1704_determine_if_string_halves_are_alike.rb b/test/easy/test_1704_determine_if_string_halves_are_alike.rb index b93444a0..fa54fede 100644 --- a/test/easy/test_1704_determine_if_string_halves_are_alike.rb +++ b/test/easy/test_1704_determine_if_string_halves_are_alike.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DetermineIfStringHalvesAreAlikeTest < ::Minitest::Test - def test_default - assert(halves_are_alike('book')) - assert(!halves_are_alike('textbook')) - end + def test_default_one = assert(halves_are_alike('book')) + + def test_default_two = assert(!halves_are_alike('textbook')) end diff --git a/test/easy/test_1710_maximum_units_on_a_truck.rb b/test/easy/test_1710_maximum_units_on_a_truck.rb index d2854c5d..f4953538 100644 --- a/test/easy/test_1710_maximum_units_on_a_truck.rb +++ b/test/easy/test_1710_maximum_units_on_a_truck.rb @@ -5,8 +5,32 @@ require 'minitest/autorun' class MaximumUnitsOnATruckTest < ::Minitest::Test - def test_default - assert_equal(8, maximum_units([[1, 3], [2, 2], [3, 1]], 4)) - assert_equal(91, maximum_units([[5, 10], [2, 5], [4, 7], [3, 9]], 10)) + def test_default_one + assert_equal( + 8, + maximum_units( + [ + [1, 3], + [2, 2], + [3, 1] + ], + 4 + ) + ) + end + + def test_default_two + assert_equal( + 91, + maximum_units( + [ + [5, 10], + [2, 5], + [4, 7], + [3, 9] + ], + 10 + ) + ) end end diff --git a/test/easy/test_1716_calculate_money_in_leetcode_bank.rb b/test/easy/test_1716_calculate_money_in_leetcode_bank.rb index f0874e20..3a8aa6db 100644 --- a/test/easy/test_1716_calculate_money_in_leetcode_bank.rb +++ b/test/easy/test_1716_calculate_money_in_leetcode_bank.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CalculateMoneyInLeetcodeBankTest < ::Minitest::Test - def test_default - assert_equal(10, total_money(4)) - assert_equal(37, total_money(10)) - assert_equal(96, total_money(20)) - end + def test_default_one = assert_equal(10, total_money(4)) + + def test_default_two = assert_equal(37, total_money(10)) + + def test_default_three = assert_equal(96, total_money(20)) end diff --git a/test/easy/test_1720_decode_xored_array.rb b/test/easy/test_1720_decode_xored_array.rb index 4eab8327..7317ac0a 100644 --- a/test/easy/test_1720_decode_xored_array.rb +++ b/test/easy/test_1720_decode_xored_array.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DecodeXORedArrayTest < ::Minitest::Test - def test_default - assert_equal([1, 0, 2, 1], decode_xored([1, 2, 3], 1)) - assert_equal([4, 2, 0, 7, 4], decode_xored([6, 2, 7, 3], 4)) - end + def test_default_one = assert_equal([1, 0, 2, 1], decode_xored([1, 2, 3], 1)) + + def test_default_two = assert_equal([4, 2, 0, 7, 4], decode_xored([6, 2, 7, 3], 4)) end diff --git a/test/easy/test_1725_number_of_rectangles_that_can_form_the_largest_square.rb b/test/easy/test_1725_number_of_rectangles_that_can_form_the_largest_square.rb index 090f360d..72595057 100644 --- a/test/easy/test_1725_number_of_rectangles_that_can_form_the_largest_square.rb +++ b/test/easy/test_1725_number_of_rectangles_that_can_form_the_largest_square.rb @@ -5,8 +5,31 @@ require 'minitest/autorun' class NumberOfRectanglesThatCanFormTheLargestSquareTest < ::Minitest::Test - def test_default - assert_equal(3, count_good_rectangles([[5, 8], [3, 9], [5, 12], [16, 5]])) - assert_equal(3, count_good_rectangles([[2, 3], [3, 7], [4, 3], [3, 7]])) + def test_default_one + assert_equal( + 3, + count_good_rectangles( + [ + [5, 8], + [3, 9], + [5, 12], + [16, 5] + ] + ) + ) + end + + def test_default_two + assert_equal( + 3, + count_good_rectangles( + [ + [2, 3], + [3, 7], + [4, 3], + [3, 7] + ] + ) + ) end end diff --git a/test/easy/test_1732_find_the_highest_altitude.rb b/test/easy/test_1732_find_the_highest_altitude.rb index 25f603b8..125059f9 100644 --- a/test/easy/test_1732_find_the_highest_altitude.rb +++ b/test/easy/test_1732_find_the_highest_altitude.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class FindTheHighestAltitudeTest < ::Minitest::Test - def test_default - assert_equal(1, largest_altitude([-5, 1, 5, 0, -7])) - assert_equal(0, largest_altitude([-4, -3, -2, -1, 4, 3, 2])) - end + def test_default_one = assert_equal(1, largest_altitude([-5, 1, 5, 0, -7])) + + def test_default_two = assert_equal(0, largest_altitude([-4, -3, -2, -1, 4, 3, 2])) end diff --git a/test/easy/test_1736_latest_time_by_replacing_hidden_digits.rb b/test/easy/test_1736_latest_time_by_replacing_hidden_digits.rb index 1a714dc6..b92b94a8 100644 --- a/test/easy/test_1736_latest_time_by_replacing_hidden_digits.rb +++ b/test/easy/test_1736_latest_time_by_replacing_hidden_digits.rb @@ -5,14 +5,13 @@ require 'minitest/autorun' class LatestTimeByReplacinHiddenDigitsTest < ::Minitest::Test - def test_default - assert_equal('23:50', maximum_time('2?:?0')) - assert_equal('09:39', maximum_time('0?:3?')) - assert_equal('19:22', maximum_time('1?:22')) - end + def test_default_one = assert_equal('23:50', maximum_time('2?:?0')) - def test_additional - assert_equal('23:50', maximum_time('??:?0')) - assert_equal('23:50', maximum_time('?3:?0')) - end + def test_default_two = assert_equal('09:39', maximum_time('0?:3?')) + + def test_default_three = assert_equal('19:22', maximum_time('1?:22')) + + def test_additional_one = assert_equal('23:50', maximum_time('??:?0')) + + def test_additional_two = assert_equal('23:50', maximum_time('?3:?0')) end diff --git a/test/easy/test_1748_sum_of_unique_elements.rb b/test/easy/test_1748_sum_of_unique_elements.rb index da240b3f..9d879b0e 100644 --- a/test/easy/test_1748_sum_of_unique_elements.rb +++ b/test/easy/test_1748_sum_of_unique_elements.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class SumOfUniqueElementsTest < ::Minitest::Test - def test_default - assert_equal(4, sum_of_unique([1, 2, 3, 2])) - assert_equal(0, sum_of_unique([1, 1, 1, 1, 1])) - assert_equal(15, sum_of_unique([1, 2, 3, 4, 5])) - end + def test_default_one = assert_equal(4, sum_of_unique([1, 2, 3, 2])) + + def test_default_two = assert_equal(0, sum_of_unique([1, 1, 1, 1, 1])) + + def test_default_three = assert_equal(15, sum_of_unique([1, 2, 3, 4, 5])) end diff --git a/test/easy/test_1752_check_if_array_is_sorted_and_rotated.rb b/test/easy/test_1752_check_if_array_is_sorted_and_rotated.rb index 4a961a9d..e02f8586 100644 --- a/test/easy/test_1752_check_if_array_is_sorted_and_rotated.rb +++ b/test/easy/test_1752_check_if_array_is_sorted_and_rotated.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CheckIfArrayIsSortedAndRotatedTest < ::Minitest::Test - def test_default - assert(check([3, 4, 5, 1, 2])) - assert(!check([2, 1, 3, 4])) - assert(check([1, 2, 3])) - end + def test_default_one = assert(check([3, 4, 5, 1, 2])) + + def test_default_two = assert(!check([2, 1, 3, 4])) + + def test_default_three = assert(check([1, 2, 3])) end diff --git a/test/easy/test_1768_merge_strings_alternately.rb b/test/easy/test_1768_merge_strings_alternately.rb index f0a64e31..96a57711 100644 --- a/test/easy/test_1768_merge_strings_alternately.rb +++ b/test/easy/test_1768_merge_strings_alternately.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MergeStringsAlternatelyTest < ::Minitest::Test - def test_default - assert_equal('apbqcr', merge_alternately('abc', 'pqr')) - assert_equal('apbqrs', merge_alternately('ab', 'pqrs')) - assert_equal('apbqcd', merge_alternately('abcd', 'pq')) - end + def test_default_one = assert_equal('apbqcr', merge_alternately('abc', 'pqr')) + + def test_default_two = assert_equal('apbqrs', merge_alternately('ab', 'pqrs')) + + def test_default_three = assert_equal('apbqcd', merge_alternately('abcd', 'pq')) end diff --git a/test/easy/test_1773_count_items_matching_a_rule.rb b/test/easy/test_1773_count_items_matching_a_rule.rb index 1ce959d3..a3ddeb13 100644 --- a/test/easy/test_1773_count_items_matching_a_rule.rb +++ b/test/easy/test_1773_count_items_matching_a_rule.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class CountItemsMatchingARuleTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 1, count_matches( @@ -14,6 +14,9 @@ def test_default 'silver' ) ) + end + + def test_default_two assert_equal( 2, count_matches( @@ -24,7 +27,7 @@ def test_default ) end - def test_additional + def test_additional_one assert_equal( 1, count_matches( diff --git a/test/easy/test_1779_find_nearest_point_that_has_the_same_x_or_y_coordinate.rb b/test/easy/test_1779_find_nearest_point_that_has_the_same_x_or_y_coordinate.rb index 88ad11fa..84a7e9b4 100644 --- a/test/easy/test_1779_find_nearest_point_that_has_the_same_x_or_y_coordinate.rb +++ b/test/easy/test_1779_find_nearest_point_that_has_the_same_x_or_y_coordinate.rb @@ -5,9 +5,24 @@ require 'minitest/autorun' class FindNearestPointThatHasTheSameXOrYCoordinateTest < ::Minitest::Test - def test_default - assert_equal(2, nearest_valid_point(3, 4, [[1, 2], [3, 1], [2, 4], [2, 3], [4, 4]])) - assert_equal(0, nearest_valid_point(3, 4, [[3, 4]])) - assert_equal(-1, nearest_valid_point(3, 4, [[2, 3]])) + def test_default_one + assert_equal( + 2, + nearest_valid_point( + 3, + 4, + [ + [1, 2], + [3, 1], + [2, 4], + [2, 3], + [4, 4] + ] + ) + ) end + + def test_default_two = assert_equal(0, nearest_valid_point(3, 4, [[3, 4]])) + + def test_default_three = assert_equal(-1, nearest_valid_point(3, 4, [[2, 3]])) end diff --git a/test/easy/test_1784_check_if_binary_string_has_at_most_one_segment_of_ones.rb b/test/easy/test_1784_check_if_binary_string_has_at_most_one_segment_of_ones.rb index 6e318b30..735ca92e 100644 --- a/test/easy/test_1784_check_if_binary_string_has_at_most_one_segment_of_ones.rb +++ b/test/easy/test_1784_check_if_binary_string_has_at_most_one_segment_of_ones.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CheckIfBinaryStringHasAtMostOneSegmentOfOnesTest < ::Minitest::Test - def test_default - assert(!check_ones_segment('1001')) - assert(check_ones_segment('110')) - end + def test_default_one = assert(!check_ones_segment('1001')) + + def test_default_two = assert(check_ones_segment('110')) end From 72a736337a6c5e337524b5ef6ace60866101c266 Mon Sep 17 00:00:00 2001 From: fartem Date: Tue, 20 Aug 2024 20:23:58 +0300 Subject: [PATCH 7/9] 2024-08-20 v. 6.5.1: updated some tests --- .../test_1018_binary_prefix_divisible_by_5.rb | 14 +++++- .../test_1021_remove_outermost_parentheses.rb | 21 ++++++-- .../easy/test_1108_defanging_an_ip_address.rb | 10 +++- .../test_1184_distance_between_bus_stops.rb | 33 +++++++++++-- .../test_1200_minimum_absolute_difference.rb | 16 ++++-- .../test_1207_unique_number_of_occurrences.rb | 24 +++++++-- ...cost_to_move_chips_to_the_same_position.rb | 27 ++++++++-- ..._1252_cells_with_odd_values_in_a_matrix.rb | 28 ++++++++++- ...t_1266_minimum_time_visiting_all_points.rb | 11 ++++- ...1313_decompress_run_length_encoded_list.rb | 18 ++++++- ...t_1360_number_of_days_between_two_dates.rb | 19 ++++++- ...mum_subsequence_in_non_increasing_order.rb | 18 ++++++- .../test_1408_string_matching_in_an_array.rb | 27 ++++++++-- ..._value_to_get_positive_step_by_step_sum.rb | 27 ++++++++-- ...ll_1s_are_at_least_length_k_places_away.rb | 18 ++++++- ...two_arrays_equal_by_reversing_subarrays.rb | 27 ++++++++-- ...xcluding_the_minimum_and_maximum_salary.rb | 13 ++++- test/easy/test_14_longest_common_prefix.rb | 15 +++++- test/easy/test_1507_reformat_date.rb | 27 ++++++++-- test/easy/test_1512_number_of_good_pairs.rb | 27 ++++++++-- test/easy/test_1534_count_good_triplets.rb | 24 ++++++++- .../test_1539_kth_missing_positive_number.rb | 20 +++++++- test/easy/test_1550_three_consecutive_odds.rb | 16 +++++- ...rn_of_length_m_repeated_k_or_more_times.rb | 30 ++++++++++-- test/easy/test_1572_matrix_diagonal_sum.rb | 9 +++- ...st_1588_sum_of_all_odd_length_subarrays.rb | 27 ++++++++-- test/easy/test_1598_crawler_log_folder.rb | 27 ++++++++-- test/easy/test_1629_slowest_key.rb | 20 +++++++- test/easy/test_1652_defuse_the_bomb.rb | 30 ++++++++++-- ...eck_if_two_string_arrays_are_equivalent.rb | 27 ++++++++-- .../easy/test_1672_richest_customer_wealth.rb | 38 ++++++++++++-- .../test_1678_goal_parser_interpretation.rb | 27 ++++++++-- ..._count_the_number_of_consistent_strings.rb | 30 ++++++++++-- test/easy/test_1694_reformat_phone_number.rb | 27 ++++++++-- test/easy/test_1720_decode_xored_array.rb | 20 +++++++- .../test_1773_count_items_matching_a_rule.rb | 18 +++++-- ...int_that_has_the_same_x_or_y_coordinate.rb | 26 +++++++++- ..._one_string_swap_can_make_strings_equal.rb | 10 ++-- .../test_1791_find_center_of_star_graph.rb | 7 ++- ...t_1796_second_largest_digit_in_a_string.rb | 11 ++--- ...est_1800_maximum_ascending_subarray_sum.rb | 10 ++-- ...umber_of_different_integers_in_a_string.rb | 10 ++-- ..._determine_color_of_a_chessboard_square.rb | 10 ++-- test/easy/test_1816_truncate_sentence.rb | 32 ++++++++++-- ...st_1822_sign_of_the_product_of_an_array.rb | 10 ++-- ...operations_to_make_the_array_increasing.rb | 10 ++-- ...t_1832_check_if_the_sentence_is_pangram.rb | 11 +++-- .../easy/test_1837_sum_of_digits_in_base_k.rb | 7 ++- ...1844_replace_all_digits_with_characters.rb | 7 ++- ..._minimum_distance_to_the_target_element.rb | 10 ++-- test/easy/test_1859_sorting_the_sentence.rb | 19 +++++-- .../test_1863_sum_of_all_subset_xor_totals.rb | 10 ++-- ..._contiguous_segments_of_ones_than_zeros.rb | 10 ++-- ..._of_size_three_with_distinct_characters.rb | 7 ++- ...k_if_word_equals_summation_of_two_words.rb | 10 ++-- ...ther_matrix_can_be_obtained_by_rotation.rb | 49 +++++++++++++++++-- ...all_the_integers_in_a_range_are_covered.rb | 7 ++- ...te_characters_to_make_all_strings_equal.rb | 7 ++- .../test_1903_largest_odd_number_in_string.rb | 10 ++-- ...t_to_make_the_array_strictly_increasing.rb | 10 ++-- ...um_product_difference_between_two_pairs.rb | 7 ++- .../test_1920_build_array_from_permutation.rb | 19 +++++-- .../test_1925_count_square_sum_triples.rb | 7 ++- test/easy/test_1929_concatenation_of_array.rb | 19 +++++-- ...35_maximum_number_of_words_you_can_type.rb | 10 ++-- ...acters_have_equal_number_of_occurrences.rb | 7 ++- test/easy/test_1952_three_divisors.rb | 7 ++- ..._delete_characters_to_make_fancy_string.rb | 10 ++-- ...61_check_if_string_is_a_prefix_of_array.rb | 19 +++++-- ...rings_that_appear_as_substrings_in_word.rb | 10 ++-- .../test_1971_find_if_path_exists_in_graph.rb | 33 +++++++++++-- ...e_to_type_word_using_special_typewriter.rb | 10 ++-- ...9_find_greatest_common_divisor_of_array.rb | 10 ++-- ..._between_highest_and_lowest_of_k_scores.rb | 7 ++- ...est_1991_find_the_middle_index_in_array.rb | 10 ++-- .../test_1995_count_special_quadruplets.rb | 10 ++-- test/easy/test_1_two_sum.rb | 29 +++++++++-- test/easy/test_2000_reverse_prefix_of_word.rb | 10 ++-- ...ber_of_pairs_with_absolute_difference_k.rb | 10 ++-- ...of_variable_after_performing_operations.rb | 10 ++-- ..._difference_between_increasing_elements.rb | 10 ++-- ...est_2022_convert_1d_array_into_2d_array.rb | 40 +++++++++++++-- ...st_2027_minimum_moves_to_convert_string.rb | 10 ++-- test/easy/test_2032_two_out_of_three.rb | 35 +++++++++++-- ...inimum_number_of_moves_to_seat_everyone.rb | 32 ++++++++++-- ..._if_numbers_are_ascending_in_a_sentence.rb | 26 ++++++++-- ...047_number_of_valid_words_in_a_sentence.rb | 29 +++++++++-- ...st_2053_kth_distinct_string_in_an_array.rb | 32 ++++++++++-- ...st_2057_smallest_index_with_equal_value.rb | 29 +++++++++-- ...2062_count_vowel_substrings_of_a_string.rb | 10 ++-- ...ether_two_strings_are_almost_equivalent.rb | 10 ++-- test/easy/test_206_reverse_linked_list.rb | 8 ++- .../test_2073_time_needed_to_buy_tickets.rb | 21 ++++++-- ...o_furthest_houses_with_different_colors.rb | 10 ++-- ..._count_common_words_with_one_occurrence.rb | 32 ++++++++++-- ...find_target_indices_after_sorting_array.rb | 32 ++++++++++-- .../test_2094_finding_3_digit_even_numbers.rb | 29 +++++++++-- ...quence_of_length_k_with_the_largest_sum.rb | 32 ++++++++++-- test/easy/test_2103_rings_and_rods.rb | 10 ++-- ...d_first_palindromic_string_in_the_array.rb | 29 +++++++++-- ...imum_number_of_words_round_in_sentences.rb | 24 +++++++-- ...t_2119_a_number_after_a_double_reversal.rb | 10 ++-- ...4_check_if_all_as_appears_before_all_bs.rb | 10 ++-- test/easy/test_2129_capitalize_the_title.rb | 29 +++++++++-- ...ery_row_and_column_contains_all_numbers.rb | 25 ++++++++-- ...8_divide_a_string_into_groups_of_size_k.rb | 23 +++++++-- ...h_strictly_smaller_and_greater_elements.rb | 7 ++- ...54_keep_multiplying_found_values_by_two.rb | 21 ++++++-- ...our_digit_number_after_splitting_digits.rb | 7 ++- ...sort_even_and_odd_indices_independently.rb | 19 +++++-- ...st_2169_count_operations_to_obtain_zero.rb | 7 ++- ...t_equal_and_divisible_pairs_in_an_array.rb | 21 ++++++-- ...2180_count_integers_with_even_digit_sum.rb | 7 ++- ...2185_counting_words_with_a_given_prefix.rb | 21 ++++++-- ...equent_number_following_key_in_an_array.rb | 31 ++++++++++-- test/easy/test_21_merge_two_sorted_lists.rb | 8 ++- test/easy/test_234_palindrome_linked_list.rb | 20 +++++++- .../test_303_range_sum_query_immutable.rb | 1 + test/easy/test_35_search_insert_position.rb | 30 ++++++++++-- .../test_557_reverse_words_in_a_string_iii.rb | 8 ++- test/easy/test_566_reshape_the_matrix.rb | 19 +++++-- test/easy/test_58_length_of_last_word.rb | 27 ++++++++-- .../test_643_maximum_average_subarray_i.rb | 10 +++- test/easy/test_66_plus_one.rb | 25 ++++++++-- test/easy/test_704_binary_search.rb | 20 +++++++- test/easy/test_733_flood_fill.rb | 32 ++++++++++-- ...ind_smallest_letter_greater_than_target.rb | 30 ++++++++++-- test/easy/test_812_largest_triangle_area.rb | 14 +++++- .../test_830_positions_of_large_groups.rb | 30 ++++++++++-- test/easy/test_860_lemonade_change.rb | 16 +++++- test/easy/test_867_transpose_matrix.rb | 27 ++++++++-- test/easy/test_925_long_pressed_name.rb | 18 ++++++- 132 files changed, 1972 insertions(+), 465 deletions(-) diff --git a/test/easy/test_1018_binary_prefix_divisible_by_5.rb b/test/easy/test_1018_binary_prefix_divisible_by_5.rb index c4513ec6..015272bf 100644 --- a/test/easy/test_1018_binary_prefix_divisible_by_5.rb +++ b/test/easy/test_1018_binary_prefix_divisible_by_5.rb @@ -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 diff --git a/test/easy/test_1021_remove_outermost_parentheses.rb b/test/easy/test_1021_remove_outermost_parentheses.rb index 62c4284c..84da2624 100644 --- a/test/easy/test_1021_remove_outermost_parentheses.rb +++ b/test/easy/test_1021_remove_outermost_parentheses.rb @@ -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 diff --git a/test/easy/test_1108_defanging_an_ip_address.rb b/test/easy/test_1108_defanging_an_ip_address.rb index 1d642788..a741d515 100644 --- a/test/easy/test_1108_defanging_an_ip_address.rb +++ b/test/easy/test_1108_defanging_an_ip_address.rb @@ -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 diff --git a/test/easy/test_1184_distance_between_bus_stops.rb b/test/easy/test_1184_distance_between_bus_stops.rb index 197ededb..55df2843 100644 --- a/test/easy/test_1184_distance_between_bus_stops.rb +++ b/test/easy/test_1184_distance_between_bus_stops.rb @@ -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 diff --git a/test/easy/test_1200_minimum_absolute_difference.rb b/test/easy/test_1200_minimum_absolute_difference.rb index 8f4bd01c..77e2bc58 100644 --- a/test/easy/test_1200_minimum_absolute_difference.rb +++ b/test/easy/test_1200_minimum_absolute_difference.rb @@ -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] ) @@ -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] ) @@ -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] ) diff --git a/test/easy/test_1207_unique_number_of_occurrences.rb b/test/easy/test_1207_unique_number_of_occurrences.rb index 8219a0f5..d779bf02 100644 --- a/test/easy/test_1207_unique_number_of_occurrences.rb +++ b/test/easy/test_1207_unique_number_of_occurrences.rb @@ -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 diff --git a/test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb b/test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb index bbf2cd61..09edecee 100644 --- a/test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb +++ b/test/easy/test_1217_minimum_cost_to_move_chips_to_the_same_position.rb @@ -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 diff --git a/test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb b/test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb index 35a43faf..419b2343 100644 --- a/test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb +++ b/test/easy/test_1252_cells_with_odd_values_in_a_matrix.rb @@ -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 diff --git a/test/easy/test_1266_minimum_time_visiting_all_points.rb b/test/easy/test_1266_minimum_time_visiting_all_points.rb index fb94407e..31aafff7 100644 --- a/test/easy/test_1266_minimum_time_visiting_all_points.rb +++ b/test/easy/test_1266_minimum_time_visiting_all_points.rb @@ -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 @@ -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 diff --git a/test/easy/test_1313_decompress_run_length_encoded_list.rb b/test/easy/test_1313_decompress_run_length_encoded_list.rb index ad501173..f301d636 100644 --- a/test/easy/test_1313_decompress_run_length_encoded_list.rb +++ b/test/easy/test_1313_decompress_run_length_encoded_list.rb @@ -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 diff --git a/test/easy/test_1360_number_of_days_between_two_dates.rb b/test/easy/test_1360_number_of_days_between_two_dates.rb index 7938b750..abad99e5 100644 --- a/test/easy/test_1360_number_of_days_between_two_dates.rb +++ b/test/easy/test_1360_number_of_days_between_two_dates.rb @@ -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 diff --git a/test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb b/test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb index a352b42c..9fed747b 100644 --- a/test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb +++ b/test/easy/test_1403_minimum_subsequence_in_non_increasing_order.rb @@ -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 diff --git a/test/easy/test_1408_string_matching_in_an_array.rb b/test/easy/test_1408_string_matching_in_an_array.rb index 0799dbaa..f1d7803d 100644 --- a/test/easy/test_1408_string_matching_in_an_array.rb +++ b/test/easy/test_1408_string_matching_in_an_array.rb @@ -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 diff --git a/test/easy/test_1413_minimum_value_to_get_positive_step_by_step_sum.rb b/test/easy/test_1413_minimum_value_to_get_positive_step_by_step_sum.rb index 2d7afafd..57d33bd9 100644 --- a/test/easy/test_1413_minimum_value_to_get_positive_step_by_step_sum.rb +++ b/test/easy/test_1413_minimum_value_to_get_positive_step_by_step_sum.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class MinimumValueToGetPositiveStepByStepSumTest < ::Minitest::Test - def test_default_one = assert_equal(5, min_start_value([-3, 2, -3, 4, 2])) + def test_default_one + assert_equal( + 5, + min_start_value( + [-3, 2, -3, 4, 2] + ) + ) + end - def test_default_two = assert_equal(1, min_start_value([1, 2])) + def test_default_two + assert_equal( + 1, + min_start_value( + [1, 2] + ) + ) + end - def test_default_three = assert_equal(5, min_start_value([1, -2, -3])) + def test_default_three + assert_equal( + 5, + min_start_value( + [1, -2, -3] + ) + ) + end end diff --git a/test/easy/test_1437_check_if_all_1s_are_at_least_length_k_places_away.rb b/test/easy/test_1437_check_if_all_1s_are_at_least_length_k_places_away.rb index 055446ef..49c643b9 100644 --- a/test/easy/test_1437_check_if_all_1s_are_at_least_length_k_places_away.rb +++ b/test/easy/test_1437_check_if_all_1s_are_at_least_length_k_places_away.rb @@ -5,7 +5,21 @@ require 'minitest/autorun' class CheckIfAll1sAreAtLeastLengthKPlacesAwayTest < ::Minitest::Test - def test_default_one = assert(k_length_apart([1, 0, 0, 0, 1, 0, 0, 1], 2)) + def test_default_one + assert( + k_length_apart( + [1, 0, 0, 0, 1, 0, 0, 1], + 2 + ) + ) + end - def test_default_two = assert(!k_length_apart([1, 0, 0, 1, 0, 1], 2)) + def test_default_two + assert( + !k_length_apart( + [1, 0, 0, 1, 0, 1], + 2 + ) + ) + end end diff --git a/test/easy/test_1460_make_two_arrays_equal_by_reversing_subarrays.rb b/test/easy/test_1460_make_two_arrays_equal_by_reversing_subarrays.rb index 21c2f4a2..c95a16aa 100644 --- a/test/easy/test_1460_make_two_arrays_equal_by_reversing_subarrays.rb +++ b/test/easy/test_1460_make_two_arrays_equal_by_reversing_subarrays.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class MakeTwoArraysEqualByReversingSubarraysTest < ::Minitest::Test - def test_default_one = assert(can_be_equal([1, 2, 3, 4], [2, 4, 1, 3])) + def test_default_one + assert( + can_be_equal( + [1, 2, 3, 4], + [2, 4, 1, 3] + ) + ) + end - def test_default_two = assert(can_be_equal([7], [7])) + def test_default_two + assert( + can_be_equal( + [7], + [7] + ) + ) + end - def test_default_three = assert(!can_be_equal([3, 7, 9], [3, 7, 11])) + def test_default_three + assert( + !can_be_equal( + [3, 7, 9], + [3, 7, 11] + ) + ) + end end diff --git a/test/easy/test_1491_average_salary_excluding_the_minimum_and_maximum_salary.rb b/test/easy/test_1491_average_salary_excluding_the_minimum_and_maximum_salary.rb index b48bccd2..0a9d762d 100644 --- a/test/easy/test_1491_average_salary_excluding_the_minimum_and_maximum_salary.rb +++ b/test/easy/test_1491_average_salary_excluding_the_minimum_and_maximum_salary.rb @@ -9,7 +9,12 @@ def test_default_one assert_equal( 2500.00000, average( - [4000, 3000, 1000, 2000] + [ + 4000, + 3000, + 1000, + 2000 + ] ) ) end @@ -18,7 +23,11 @@ def test_default_two assert_equal( 2000.00000, average( - [1000, 2000, 3000] + [ + 1000, + 2000, + 3000 + ] ) ) end diff --git a/test/easy/test_14_longest_common_prefix.rb b/test/easy/test_14_longest_common_prefix.rb index 19fe0e89..f563bd77 100644 --- a/test/easy/test_14_longest_common_prefix.rb +++ b/test/easy/test_14_longest_common_prefix.rb @@ -5,7 +5,18 @@ require 'minitest/autorun' class LongestCommonPrefixTest < ::Minitest::Test - def test_default_one = assert('fl', longest_common_prefix(%w[flower flow flight])) + def test_default_one + assert( + 'fl', + longest_common_prefix(%w[flower flow flight]) + ) + end - def test_default_two = assert(longest_common_prefix(%w[dog racecar car]).empty?) + def test_default_two + assert( + longest_common_prefix( + %w[dog racecar car] + ).empty? + ) + end end diff --git a/test/easy/test_1507_reformat_date.rb b/test/easy/test_1507_reformat_date.rb index f09663db..5136e1ee 100644 --- a/test/easy/test_1507_reformat_date.rb +++ b/test/easy/test_1507_reformat_date.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class ReformatDateTest < ::Minitest::Test - def test_default_one = assert_equal('2052-10-20', reformat_date('20th Oct 2052')) + def test_default_one + assert_equal( + '2052-10-20', + reformat_date( + '20th Oct 2052' + ) + ) + end - def test_default_two = assert_equal('1933-06-06', reformat_date('6th Jun 1933')) + def test_default_two + assert_equal( + '1933-06-06', + reformat_date( + '6th Jun 1933' + ) + ) + end - def test_default_three = assert_equal('1960-05-26', reformat_date('26th May 1960')) + def test_default_three + assert_equal( + '1960-05-26', + reformat_date( + '26th May 1960' + ) + ) + end end diff --git a/test/easy/test_1512_number_of_good_pairs.rb b/test/easy/test_1512_number_of_good_pairs.rb index 3e77edfb..67cdd542 100644 --- a/test/easy/test_1512_number_of_good_pairs.rb +++ b/test/easy/test_1512_number_of_good_pairs.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class NumberOfGoodPairsTest < ::Minitest::Test - def test_default_one = assert_equal(4, num_identical_pairs([1, 2, 3, 1, 1, 3])) + def test_default_one + assert_equal( + 4, + num_identical_pairs( + [1, 2, 3, 1, 1, 3] + ) + ) + end - def test_default_two = assert_equal(6, num_identical_pairs([1, 1, 1, 1])) + def test_default_two + assert_equal( + 6, + num_identical_pairs( + [1, 1, 1, 1] + ) + ) + end - def test_default_three = assert_equal(0, num_identical_pairs([1, 2, 3])) + def test_default_three + assert_equal( + 0, + num_identical_pairs( + [1, 2, 3] + ) + ) + end end diff --git a/test/easy/test_1534_count_good_triplets.rb b/test/easy/test_1534_count_good_triplets.rb index 5d85c4a8..be3a0689 100644 --- a/test/easy/test_1534_count_good_triplets.rb +++ b/test/easy/test_1534_count_good_triplets.rb @@ -5,7 +5,27 @@ require 'minitest/autorun' class CountGoodTripletsTest < ::Minitest::Test - def test_default_one = assert_equal(4, count_good_triplets([3, 0, 1, 1, 9, 7], 7, 2, 3)) + def test_default_one + assert_equal( + 4, + count_good_triplets( + [3, 0, 1, 1, 9, 7], + 7, + 2, + 3 + ) + ) + end - def test_default_two = assert_equal(0, count_good_triplets([1, 1, 2, 2, 3], 0, 0, 1)) + def test_default_two + assert_equal( + 0, + count_good_triplets( + [1, 1, 2, 2, 3], + 0, + 0, + 1 + ) + ) + end end diff --git a/test/easy/test_1539_kth_missing_positive_number.rb b/test/easy/test_1539_kth_missing_positive_number.rb index b5244022..5b55c310 100644 --- a/test/easy/test_1539_kth_missing_positive_number.rb +++ b/test/easy/test_1539_kth_missing_positive_number.rb @@ -5,7 +5,23 @@ require 'minitest/autorun' class KthMissingPositiveNumberTest < ::Minitest::Test - def test_default_one = assert_equal(9, find_kth_positive([2, 3, 4, 7, 11], 5)) + def test_default_one + assert_equal( + 9, + find_kth_positive( + [2, 3, 4, 7, 11], + 5 + ) + ) + end - def test_default_two = assert_equal(6, find_kth_positive([1, 2, 3, 4], 2)) + def test_default_two + assert_equal( + 6, + find_kth_positive( + [1, 2, 3, 4], + 2 + ) + ) + end end diff --git a/test/easy/test_1550_three_consecutive_odds.rb b/test/easy/test_1550_three_consecutive_odds.rb index 1cee1b6b..6f402eb9 100644 --- a/test/easy/test_1550_three_consecutive_odds.rb +++ b/test/easy/test_1550_three_consecutive_odds.rb @@ -5,7 +5,19 @@ require 'minitest/autorun' class ThreeConsecutiveOddsTest < ::Minitest::Test - def test_default_one = assert(!three_consecutive_odds([2, 6, 4, 1])) + def test_default_one + assert( + !three_consecutive_odds( + [2, 6, 4, 1] + ) + ) + end - def test_default_two = assert(three_consecutive_odds([1, 2, 34, 3, 4, 5, 7, 23, 12])) + def test_default_two + assert( + three_consecutive_odds( + [1, 2, 34, 3, 4, 5, 7, 23, 12] + ) + ) + end end diff --git a/test/easy/test_1566_detect_pattern_of_length_m_repeated_k_or_more_times.rb b/test/easy/test_1566_detect_pattern_of_length_m_repeated_k_or_more_times.rb index ee75dc10..7a5c27cf 100644 --- a/test/easy/test_1566_detect_pattern_of_length_m_repeated_k_or_more_times.rb +++ b/test/easy/test_1566_detect_pattern_of_length_m_repeated_k_or_more_times.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class DetectPatternOnLengthMRepeatedKOrMoreTimesTest < ::Minitest::Test - def test_default_one = assert(contains_pattern([1, 2, 4, 4, 4, 4], 1, 3)) + def test_default_one + assert( + contains_pattern( + [1, 2, 4, 4, 4, 4], + 1, + 3 + ) + ) + end - def test_default_two = assert(contains_pattern([1, 2, 1, 2, 1, 1, 1, 3], 2, 2)) + def test_default_two + assert( + contains_pattern( + [1, 2, 1, 2, 1, 1, 1, 3], + 2, + 2 + ) + ) + end - def test_default_three = assert(!contains_pattern([1, 2, 1, 2, 1, 3], 2, 3)) + def test_default_three + assert( + !contains_pattern( + [1, 2, 1, 2, 1, 3], + 2, + 3 + ) + ) + end end diff --git a/test/easy/test_1572_matrix_diagonal_sum.rb b/test/easy/test_1572_matrix_diagonal_sum.rb index 9e31a098..6bce5420 100644 --- a/test/easy/test_1572_matrix_diagonal_sum.rb +++ b/test/easy/test_1572_matrix_diagonal_sum.rb @@ -32,5 +32,12 @@ def test_default_two ) end - def test_default_three = assert_equal(5, diagonal_sum([[5]])) + def test_default_three + assert_equal( + 5, + diagonal_sum( + [[5]] + ) + ) + end end diff --git a/test/easy/test_1588_sum_of_all_odd_length_subarrays.rb b/test/easy/test_1588_sum_of_all_odd_length_subarrays.rb index fdd1f05c..fe96d385 100644 --- a/test/easy/test_1588_sum_of_all_odd_length_subarrays.rb +++ b/test/easy/test_1588_sum_of_all_odd_length_subarrays.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class SumOfAllOddLengthSubarraysTest < ::Minitest::Test - def test_default_one = assert_equal(58, sum_odd_length_subarrays([1, 4, 2, 5, 3])) + def test_default_one + assert_equal( + 58, + sum_odd_length_subarrays( + [1, 4, 2, 5, 3] + ) + ) + end - def test_default_two = assert_equal(3, sum_odd_length_subarrays([1, 2])) + def test_default_two + assert_equal( + 3, + sum_odd_length_subarrays( + [1, 2] + ) + ) + end - def test_default_three = assert_equal(66, sum_odd_length_subarrays([10, 11, 12])) + def test_default_three + assert_equal( + 66, + sum_odd_length_subarrays( + [10, 11, 12] + ) + ) + end end diff --git a/test/easy/test_1598_crawler_log_folder.rb b/test/easy/test_1598_crawler_log_folder.rb index 8af2aadc..5447aab1 100644 --- a/test/easy/test_1598_crawler_log_folder.rb +++ b/test/easy/test_1598_crawler_log_folder.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class CrawlerLogFolderTest < ::Minitest::Test - def test_default_one = assert_equal(2, _1598_min_operations(%w[d1/ d2/ ../ d21/ ./])) + def test_default_one + assert_equal( + 2, + _1598_min_operations( + %w[d1/ d2/ ../ d21/ ./] + ) + ) + end - def test_default_two = assert_equal(3, _1598_min_operations(%w[d1/ d2/ ./ d3/ ../ d31/])) + def test_default_two + assert_equal( + 3, + _1598_min_operations( + %w[d1/ d2/ ./ d3/ ../ d31/] + ) + ) + end - def test_default_three = assert_equal(0, _1598_min_operations(%w[d1/ ../ ../ ../])) + def test_default_three + assert_equal( + 0, + _1598_min_operations( + %w[d1/ ../ ../ ../] + ) + ) + end end diff --git a/test/easy/test_1629_slowest_key.rb b/test/easy/test_1629_slowest_key.rb index c4a550c0..0e23480d 100644 --- a/test/easy/test_1629_slowest_key.rb +++ b/test/easy/test_1629_slowest_key.rb @@ -5,7 +5,23 @@ require 'minitest/autorun' class SlowestKeyTest < ::Minitest::Test - def test_default_one = assert_equal('c', slowest_key([9, 29, 49, 50], 'cbcd')) + def test_default_one + assert_equal( + 'c', + slowest_key( + [9, 29, 49, 50], + 'cbcd' + ) + ) + end - def test_default_two = assert_equal('a', slowest_key([12, 23, 36, 46, 62], 'spuda')) + def test_default_two + assert_equal( + 'a', + slowest_key( + [12, 23, 36, 46, 62], + 'spuda' + ) + ) + end end diff --git a/test/easy/test_1652_defuse_the_bomb.rb b/test/easy/test_1652_defuse_the_bomb.rb index b2a20d29..8c762cf5 100644 --- a/test/easy/test_1652_defuse_the_bomb.rb +++ b/test/easy/test_1652_defuse_the_bomb.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class DefuseTheBombTest < ::Minitest::Test - def test_default_one = assert_equal([12, 10, 16, 13], decrypt([5, 7, 1, 4], 3)) + def test_default_one + assert_equal( + [12, 10, 16, 13], + decrypt( + [5, 7, 1, 4], + 3 + ) + ) + end - def test_default_two = assert_equal([0, 0, 0, 0], decrypt([1, 2, 3, 4], 0)) + def test_default_two + assert_equal( + [0, 0, 0, 0], + decrypt( + [1, 2, 3, 4], + 0 + ) + ) + end - def test_default_three = assert_equal([12, 5, 6, 13], decrypt([2, 4, 9, 3], -2)) + def test_default_three + assert_equal( + [12, 5, 6, 13], + decrypt( + [2, 4, 9, 3], + -2 + ) + ) + end end diff --git a/test/easy/test_1662_check_if_two_string_arrays_are_equivalent.rb b/test/easy/test_1662_check_if_two_string_arrays_are_equivalent.rb index 283de64a..7b926ddd 100644 --- a/test/easy/test_1662_check_if_two_string_arrays_are_equivalent.rb +++ b/test/easy/test_1662_check_if_two_string_arrays_are_equivalent.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class CheckIfTwoStringArraysAreEquivalentTest < ::Minitest::Test - def test_default_one = assert(array_strings_are_equal(%w[ab c], %w[a bc])) + def test_default_one + assert( + array_strings_are_equal( + %w[ab c], + %w[a bc] + ) + ) + end - def test_default_two = assert(!array_strings_are_equal(%w[a cb], %w[ab c])) + def test_default_two + assert( + !array_strings_are_equal( + %w[a cb], + %w[ab c] + ) + ) + end - def test_default_three = assert(array_strings_are_equal(%w[abc d defg], ['abcddefg'])) + def test_default_three + assert( + array_strings_are_equal( + %w[abc d defg], + ['abcddefg'] + ) + ) + end end diff --git a/test/easy/test_1672_richest_customer_wealth.rb b/test/easy/test_1672_richest_customer_wealth.rb index 3dcbbeec..91de0db3 100644 --- a/test/easy/test_1672_richest_customer_wealth.rb +++ b/test/easy/test_1672_richest_customer_wealth.rb @@ -5,9 +5,41 @@ require 'minitest/autorun' class RichestCustomerWealthTest < ::Minitest::Test - def test_default_one = assert_equal(6, maximum_wealth([[1, 2, 3], [3, 2, 1]])) + def test_default_one + assert_equal( + 6, + maximum_wealth( + [ + [1, 2, 3], + [3, 2, 1] + ] + ) + ) + end - def test_default_two = assert_equal(10, maximum_wealth([[1, 5], [7, 3], [3, 5]])) + def test_default_two + assert_equal( + 10, + maximum_wealth( + [ + [1, 5], + [7, 3], + [3, 5] + ] + ) + ) + end - def test_default_three = assert_equal(17, maximum_wealth([[2, 8, 7], [7, 1, 3], [1, 9, 5]])) + def test_default_three + assert_equal( + 17, + maximum_wealth( + [ + [2, 8, 7], + [7, 1, 3], + [1, 9, 5] + ] + ) + ) + end end diff --git a/test/easy/test_1678_goal_parser_interpretation.rb b/test/easy/test_1678_goal_parser_interpretation.rb index a0a4d614..21258209 100644 --- a/test/easy/test_1678_goal_parser_interpretation.rb +++ b/test/easy/test_1678_goal_parser_interpretation.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class GoalParserInterpretationTest < ::Minitest::Test - def test_default_one = assert_equal('Goal', interpret('G()(al)')) + def test_default_one + assert_equal( + 'Goal', + interpret( + 'G()(al)' + ) + ) + end - def test_default_two = assert_equal('Gooooal', interpret('G()()()()(al)')) + def test_default_two + assert_equal( + 'Gooooal', + interpret( + 'G()()()()(al)' + ) + ) + end - def test_default_three = assert_equal('alGalooG', interpret('(al)G(al)()()G')) + def test_default_three + assert_equal( + 'alGalooG', + interpret( + '(al)G(al)()()G' + ) + ) + end end diff --git a/test/easy/test_1684_count_the_number_of_consistent_strings.rb b/test/easy/test_1684_count_the_number_of_consistent_strings.rb index 82d07aba..e9240423 100644 --- a/test/easy/test_1684_count_the_number_of_consistent_strings.rb +++ b/test/easy/test_1684_count_the_number_of_consistent_strings.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class CountTheNumberOfConsistentStringsTest < ::Minitest::Test - def test_default_one = assert_equal(2, count_consistent_strings('ab', %w[ad bd aaab baa badab])) + def test_default_one + assert_equal( + 2, + count_consistent_strings( + 'ab', + %w[ad bd aaab baa badab] + ) + ) + end - def test_default_two = assert_equal(7, count_consistent_strings('abc', %w[a b c ab ac bc abc])) + def test_default_two + assert_equal( + 7, + count_consistent_strings( + 'abc', + %w[a b c ab ac bc abc] + ) + ) + end - def test_default_three = assert_equal(4, count_consistent_strings('cad', %w[cc acd b ba bac bad ac d])) + def test_default_three + assert_equal( + 4, + count_consistent_strings( + 'cad', + %w[cc acd b ba bac bad ac d] + ) + ) + end end diff --git a/test/easy/test_1694_reformat_phone_number.rb b/test/easy/test_1694_reformat_phone_number.rb index 5c759510..6735e457 100644 --- a/test/easy/test_1694_reformat_phone_number.rb +++ b/test/easy/test_1694_reformat_phone_number.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class ReformatPhoneNumberTest < ::Minitest::Test - def test_default_one = assert_equal('123-456', reformat_number('1-23-45 6')) + def test_default_one + assert_equal( + '123-456', + reformat_number( + '1-23-45 6' + ) + ) + end - def test_default_two = assert_equal('123-45-67', reformat_number('123 4-567')) + def test_default_two + assert_equal( + '123-45-67', + reformat_number( + '123 4-567' + ) + ) + end - def test_default_three = assert_equal('123-456-78', reformat_number('123 4-5678')) + def test_default_three + assert_equal( + '123-456-78', + reformat_number( + '123 4-5678' + ) + ) + end end diff --git a/test/easy/test_1720_decode_xored_array.rb b/test/easy/test_1720_decode_xored_array.rb index 7317ac0a..b8473cd9 100644 --- a/test/easy/test_1720_decode_xored_array.rb +++ b/test/easy/test_1720_decode_xored_array.rb @@ -5,7 +5,23 @@ require 'minitest/autorun' class DecodeXORedArrayTest < ::Minitest::Test - def test_default_one = assert_equal([1, 0, 2, 1], decode_xored([1, 2, 3], 1)) + def test_default_one + assert_equal( + [1, 0, 2, 1], + decode_xored( + [1, 2, 3], + 1 + ) + ) + end - def test_default_two = assert_equal([4, 2, 0, 7, 4], decode_xored([6, 2, 7, 3], 4)) + def test_default_two + assert_equal( + [4, 2, 0, 7, 4], + decode_xored( + [6, 2, 7, 3], + 4 + ) + ) + end end diff --git a/test/easy/test_1773_count_items_matching_a_rule.rb b/test/easy/test_1773_count_items_matching_a_rule.rb index a3ddeb13..3fc02383 100644 --- a/test/easy/test_1773_count_items_matching_a_rule.rb +++ b/test/easy/test_1773_count_items_matching_a_rule.rb @@ -9,7 +9,11 @@ def test_default_one assert_equal( 1, count_matches( - [%w[phone blue pixel], %w[computer silver lenovo], %w[phone gold iphone]], + [ + %w[phone blue pixel], + %w[computer silver lenovo], + %w[phone gold iphone] + ], 'color', 'silver' ) @@ -20,7 +24,11 @@ def test_default_two assert_equal( 2, count_matches( - [%w[phone blue pixel], %w[computer silver phone], %w[phone gold iphone]], + [ + %w[phone blue pixel], + %w[computer silver phone], + %w[phone gold iphone] + ], 'type', 'phone' ) @@ -31,7 +39,11 @@ def test_additional_one assert_equal( 1, count_matches( - [%w[phone blue pixel], %w[computer silver phone], %w[phone gold iphone]], + [ + %w[phone blue pixel], + %w[computer silver phone], + %w[phone gold iphone] + ], 'name', 'phone' ) diff --git a/test/easy/test_1779_find_nearest_point_that_has_the_same_x_or_y_coordinate.rb b/test/easy/test_1779_find_nearest_point_that_has_the_same_x_or_y_coordinate.rb index 84a7e9b4..05fecb8f 100644 --- a/test/easy/test_1779_find_nearest_point_that_has_the_same_x_or_y_coordinate.rb +++ b/test/easy/test_1779_find_nearest_point_that_has_the_same_x_or_y_coordinate.rb @@ -22,7 +22,29 @@ def test_default_one ) end - def test_default_two = assert_equal(0, nearest_valid_point(3, 4, [[3, 4]])) + def test_default_two + assert_equal( + 0, + nearest_valid_point( + 3, + 4, + [ + [3, 4] + ] + ) + ) + end - def test_default_three = assert_equal(-1, nearest_valid_point(3, 4, [[2, 3]])) + def test_default_three + assert_equal( + -1, + nearest_valid_point( + 3, + 4, + [ + [2, 3] + ] + ) + ) + end end diff --git a/test/easy/test_1790_check_if_one_string_swap_can_make_strings_equal.rb b/test/easy/test_1790_check_if_one_string_swap_can_make_strings_equal.rb index 16b20753..4c744ceb 100644 --- a/test/easy/test_1790_check_if_one_string_swap_can_make_strings_equal.rb +++ b/test/easy/test_1790_check_if_one_string_swap_can_make_strings_equal.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CheckIfOneStringSwapCanMakeStringsEqualTest < ::Minitest::Test - def test_default - assert(are_almost_equal('bank', 'kanb')) - assert(!are_almost_equal('attack', 'defend')) - assert(are_almost_equal('kelb', 'kelb')) - end + def test_default_one = assert(are_almost_equal('bank', 'kanb')) + + def test_default_two = assert(!are_almost_equal('attack', 'defend')) + + def test_default_three = assert(are_almost_equal('kelb', 'kelb')) end diff --git a/test/easy/test_1791_find_center_of_star_graph.rb b/test/easy/test_1791_find_center_of_star_graph.rb index 6f4e8c3f..be69172b 100644 --- a/test/easy/test_1791_find_center_of_star_graph.rb +++ b/test/easy/test_1791_find_center_of_star_graph.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class FindCenterOfStarGraphTest < ::Minitest::Test - def test_default - assert_equal(2, find_center([[1, 2], [2, 3], [4, 2]])) - assert_equal(1, find_center([[1, 2], [5, 1], [1, 3], [1, 4]])) - end + def test_default_one = assert_equal(2, find_center([[1, 2], [2, 3], [4, 2]])) + + def test_default_two = assert_equal(1, find_center([[1, 2], [5, 1], [1, 3], [1, 4]])) end diff --git a/test/easy/test_1796_second_largest_digit_in_a_string.rb b/test/easy/test_1796_second_largest_digit_in_a_string.rb index 648f6617..4e2d015f 100644 --- a/test/easy/test_1796_second_largest_digit_in_a_string.rb +++ b/test/easy/test_1796_second_largest_digit_in_a_string.rb @@ -5,12 +5,9 @@ require 'minitest/autorun' class SecondLargestDigitInAStringTest < ::Minitest::Test - def test_default - assert_equal(2, second_highest('dfa12321afd')) - assert_equal(-1, second_highest('abc1111')) - end + def test_default_one = assert_equal(2, second_highest('dfa12321afd')) - def test_additional - assert_equal(4, second_highest('sjhtz8344')) - end + def test_default_two = assert_equal(-1, second_highest('abc1111')) + + def test_additional_one = assert_equal(4, second_highest('sjhtz8344')) end diff --git a/test/easy/test_1800_maximum_ascending_subarray_sum.rb b/test/easy/test_1800_maximum_ascending_subarray_sum.rb index 870b3bc3..443f1f0a 100644 --- a/test/easy/test_1800_maximum_ascending_subarray_sum.rb +++ b/test/easy/test_1800_maximum_ascending_subarray_sum.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumAscendingSubarraySumTest < ::Minitest::Test - def test_default - assert_equal(65, max_ascending_sum([10, 20, 30, 5, 10, 50])) - assert_equal(150, max_ascending_sum([10, 20, 30, 40, 50])) - assert_equal(33, max_ascending_sum([12, 17, 15, 13, 10, 11, 12])) - end + def test_default_one = assert_equal(65, max_ascending_sum([10, 20, 30, 5, 10, 50])) + + def test_default_two = assert_equal(150, max_ascending_sum([10, 20, 30, 40, 50])) + + def test_default_three = assert_equal(33, max_ascending_sum([12, 17, 15, 13, 10, 11, 12])) end diff --git a/test/easy/test_1805_number_of_different_integers_in_a_string.rb b/test/easy/test_1805_number_of_different_integers_in_a_string.rb index cc58447c..6122228c 100644 --- a/test/easy/test_1805_number_of_different_integers_in_a_string.rb +++ b/test/easy/test_1805_number_of_different_integers_in_a_string.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class NumberOfDifferentIntegersInAStringTest < ::Minitest::Test - def test_default - assert_equal(3, num_different_integers('a123bc34d8ef34')) - assert_equal(2, num_different_integers('leet1234code234')) - assert_equal(1, num_different_integers('a1b01c001')) - end + def test_default_one = assert_equal(3, num_different_integers('a123bc34d8ef34')) + + def test_default_two = assert_equal(2, num_different_integers('leet1234code234')) + + def test_default_three = assert_equal(1, num_different_integers('a1b01c001')) end diff --git a/test/easy/test_1812_determine_color_of_a_chessboard_square.rb b/test/easy/test_1812_determine_color_of_a_chessboard_square.rb index a93846d0..92b01e74 100644 --- a/test/easy/test_1812_determine_color_of_a_chessboard_square.rb +++ b/test/easy/test_1812_determine_color_of_a_chessboard_square.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class DetermineColorOfAChessboardSquareTest < ::Minitest::Test - def test_default - assert(!square_is_white('a1')) - assert(square_is_white('h3')) - assert(!square_is_white('c7')) - end + def test_default_one = assert(!square_is_white('a1')) + + def test_default_two = assert(square_is_white('h3')) + + def test_default_three = assert(!square_is_white('c7')) end diff --git a/test/easy/test_1816_truncate_sentence.rb b/test/easy/test_1816_truncate_sentence.rb index a8c362f6..53fb7c51 100644 --- a/test/easy/test_1816_truncate_sentence.rb +++ b/test/easy/test_1816_truncate_sentence.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class TruncateSentenceTest < ::Minitest::Test - def test_default - assert_equal('Hello how are you', truncate_sentence('Hello how are you Contestant', 4)) - assert_equal('What is the solution', truncate_sentence('What is the solution to this problem', 4)) - assert_equal('chopper is not a tanuki', truncate_sentence('chopper is not a tanuki', 5)) + def test_default_one + assert_equal( + 'Hello how are you', + truncate_sentence( + 'Hello how are you Contestant', + 4 + ) + ) + end + + def test_default_two + assert_equal( + 'What is the solution', + truncate_sentence( + 'What is the solution to this problem', + 4 + ) + ) + end + + def test_default_three + assert_equal( + 'chopper is not a tanuki', + truncate_sentence( + 'chopper is not a tanuki', + 5 + ) + ) end end diff --git a/test/easy/test_1822_sign_of_the_product_of_an_array.rb b/test/easy/test_1822_sign_of_the_product_of_an_array.rb index 0b503f60..5efae698 100644 --- a/test/easy/test_1822_sign_of_the_product_of_an_array.rb +++ b/test/easy/test_1822_sign_of_the_product_of_an_array.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class SignOfTheProductOfAnArrayTest < ::Minitest::Test - def test_default - assert_equal(1, array_sign([-1, -2, -3, -4, 3, 2, 1])) - assert_equal(0, array_sign([1, 5, 0, 2, -3])) - assert_equal(-1, array_sign([-1, 1, -1, 1, -1])) - end + def test_default_one = assert_equal(1, array_sign([-1, -2, -3, -4, 3, 2, 1])) + + def test_default_two = assert_equal(0, array_sign([1, 5, 0, 2, -3])) + + def test_default_three = assert_equal(-1, array_sign([-1, 1, -1, 1, -1])) end diff --git a/test/easy/test_1827_minimum_operations_to_make_the_array_increasing.rb b/test/easy/test_1827_minimum_operations_to_make_the_array_increasing.rb index 9b786cc9..5a3180ab 100644 --- a/test/easy/test_1827_minimum_operations_to_make_the_array_increasing.rb +++ b/test/easy/test_1827_minimum_operations_to_make_the_array_increasing.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MinimumOperationsToMakeTheArrayIncreasingTest < ::Minitest::Test - def test_default - assert_equal(3, _1827_min_operations([1, 1, 1])) - assert_equal(14, _1827_min_operations([1, 5, 2, 4, 1])) - assert_equal(0, _1827_min_operations([8])) - end + def test_default_one = assert_equal(3, _1827_min_operations([1, 1, 1])) + + def test_default_two = assert_equal(14, _1827_min_operations([1, 5, 2, 4, 1])) + + def test_default_three = assert_equal(0, _1827_min_operations([8])) end diff --git a/test/easy/test_1832_check_if_the_sentence_is_pangram.rb b/test/easy/test_1832_check_if_the_sentence_is_pangram.rb index 1afc634f..aea838bb 100644 --- a/test/easy/test_1832_check_if_the_sentence_is_pangram.rb +++ b/test/easy/test_1832_check_if_the_sentence_is_pangram.rb @@ -5,8 +5,13 @@ require 'minitest/autorun' class CheckIfTheSentenceIsPangramTest < ::Minitest::Test - def test_default - assert(check_if_pangram('thequickbrownfoxjumpsoverthelazydog')) - assert(!check_if_pangram('leetcode')) + def test_default_one + assert( + check_if_pangram( + 'thequickbrownfoxjumpsoverthelazydog' + ) + ) end + + def test_default_two = assert(!check_if_pangram('leetcode')) end diff --git a/test/easy/test_1837_sum_of_digits_in_base_k.rb b/test/easy/test_1837_sum_of_digits_in_base_k.rb index a7116b7c..4c12b8b9 100644 --- a/test/easy/test_1837_sum_of_digits_in_base_k.rb +++ b/test/easy/test_1837_sum_of_digits_in_base_k.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class SumOfDigitsInBaseKTest < ::Minitest::Test - def test_default - assert_equal(9, sum_base(34, 6)) - assert_equal(1, sum_base(10, 10)) - end + def test_default_one = assert_equal(9, sum_base(34, 6)) + + def test_default_two = assert_equal(1, sum_base(10, 10)) end diff --git a/test/easy/test_1844_replace_all_digits_with_characters.rb b/test/easy/test_1844_replace_all_digits_with_characters.rb index ddf94549..23ea5229 100644 --- a/test/easy/test_1844_replace_all_digits_with_characters.rb +++ b/test/easy/test_1844_replace_all_digits_with_characters.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ReplaceAllDigitsWithCharactersTest < ::Minitest::Test - def test_default - assert_equal('abcdef', replace_digits('a1c1e1')) - assert_equal('abbdcfdhe', replace_digits('a1b2c3d4e')) - end + def test_default_one = assert_equal('abcdef', replace_digits('a1c1e1')) + + def test_default_two = assert_equal('abbdcfdhe', replace_digits('a1b2c3d4e')) end diff --git a/test/easy/test_1848_minimum_distance_to_the_target_element.rb b/test/easy/test_1848_minimum_distance_to_the_target_element.rb index 99d9dd88..87a64a82 100644 --- a/test/easy/test_1848_minimum_distance_to_the_target_element.rb +++ b/test/easy/test_1848_minimum_distance_to_the_target_element.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MinimumDistanceToTheTargetElementTest < ::Minitest::Test - def test_default - assert_equal(1, get_min_distance([1, 2, 3, 4, 5], 5, 3)) - assert_equal(0, get_min_distance([1], 1, 0)) - assert_equal(0, get_min_distance([1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 1, 0)) - end + def test_default_one = assert_equal(1, get_min_distance([1, 2, 3, 4, 5], 5, 3)) + + def test_default_two = assert_equal(0, get_min_distance([1], 1, 0)) + + def test_default_three = assert_equal(0, get_min_distance([1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 1, 0)) end diff --git a/test/easy/test_1859_sorting_the_sentence.rb b/test/easy/test_1859_sorting_the_sentence.rb index 8ea22505..dc087b66 100644 --- a/test/easy/test_1859_sorting_the_sentence.rb +++ b/test/easy/test_1859_sorting_the_sentence.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class SortingTheSentenceTest < ::Minitest::Test - def test_default - assert_equal('This is a sentence', sort_sentence('is2 sentence4 This1 a3')) - assert_equal('Me Myself and I', sort_sentence('Myself2 Me1 I4 and3')) + def test_default_one + assert_equal( + 'This is a sentence', + sort_sentence( + 'is2 sentence4 This1 a3' + ) + ) + end + + def test_default_two + assert_equal( + 'Me Myself and I', + sort_sentence( + 'Myself2 Me1 I4 and3' + ) + ) end end diff --git a/test/easy/test_1863_sum_of_all_subset_xor_totals.rb b/test/easy/test_1863_sum_of_all_subset_xor_totals.rb index c14462d4..3328ec4e 100644 --- a/test/easy/test_1863_sum_of_all_subset_xor_totals.rb +++ b/test/easy/test_1863_sum_of_all_subset_xor_totals.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class SumOfAllSubsetXORTotalsTest < ::Minitest::Test - def test_default - assert_equal(6, subset_xor_sum([1, 3])) - assert_equal(28, subset_xor_sum([5, 1, 6])) - assert_equal(480, subset_xor_sum([3, 4, 5, 6, 7, 8])) - end + def test_default_one = assert_equal(6, subset_xor_sum([1, 3])) + + def test_default_two = assert_equal(28, subset_xor_sum([5, 1, 6])) + + def test_default_three = assert_equal(480, subset_xor_sum([3, 4, 5, 6, 7, 8])) end diff --git a/test/easy/test_1869_longer_contiguous_segments_of_ones_than_zeros.rb b/test/easy/test_1869_longer_contiguous_segments_of_ones_than_zeros.rb index 72beada0..59d3d483 100644 --- a/test/easy/test_1869_longer_contiguous_segments_of_ones_than_zeros.rb +++ b/test/easy/test_1869_longer_contiguous_segments_of_ones_than_zeros.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class LongerContiguousSegmentsOfOnesThanZerosTest < ::Minitest::Test - def test_default - assert(check_zero_ones('1101')) - assert(!check_zero_ones('111000')) - assert(!check_zero_ones('110100010')) - end + def test_default_one = assert(check_zero_ones('1101')) + + def test_default_two = assert(!check_zero_ones('111000')) + + def test_default_three = assert(!check_zero_ones('110100010')) end diff --git a/test/easy/test_1876_substrings_of_size_three_with_distinct_characters.rb b/test/easy/test_1876_substrings_of_size_three_with_distinct_characters.rb index 0ea1f1de..d9a14da3 100644 --- a/test/easy/test_1876_substrings_of_size_three_with_distinct_characters.rb +++ b/test/easy/test_1876_substrings_of_size_three_with_distinct_characters.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class SubstringsOfSizeThreeWithDistinctCharactersTest < ::Minitest::Test - def test_default - assert_equal(1, count_good_substrings('xyzzaz')) - assert_equal(4, count_good_substrings('aababcabc')) - end + def test_default_one = assert_equal(1, count_good_substrings('xyzzaz')) + + def test_default_two = assert_equal(4, count_good_substrings('aababcabc')) end diff --git a/test/easy/test_1880_check_if_word_equals_summation_of_two_words.rb b/test/easy/test_1880_check_if_word_equals_summation_of_two_words.rb index f404f083..aa0a76ee 100644 --- a/test/easy/test_1880_check_if_word_equals_summation_of_two_words.rb +++ b/test/easy/test_1880_check_if_word_equals_summation_of_two_words.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CheckIfWordEqualsSummationOfTwoWordsTest < ::Minitest::Test - def test_default - assert(is_sum_equal('acb', 'cba', 'cdb')) - assert(!is_sum_equal('aaa', 'a', 'aab')) - assert(is_sum_equal('aaa', 'a', 'aaaa')) - end + def test_default_one = assert(is_sum_equal('acb', 'cba', 'cdb')) + + def test_default_two = assert(!is_sum_equal('aaa', 'a', 'aab')) + + def test_default_three = assert(is_sum_equal('aaa', 'a', 'aaaa')) end diff --git a/test/easy/test_1886_determine_whether_matrix_can_be_obtained_by_rotation.rb b/test/easy/test_1886_determine_whether_matrix_can_be_obtained_by_rotation.rb index 37f02d4c..20024583 100644 --- a/test/easy/test_1886_determine_whether_matrix_can_be_obtained_by_rotation.rb +++ b/test/easy/test_1886_determine_whether_matrix_can_be_obtained_by_rotation.rb @@ -5,9 +5,50 @@ require 'minitest/autorun' class DetermineWhetherMatrixCanBeObtainedByRotationTest < ::Minitest::Test - def test_default - assert(find_rotation([[0, 1], [1, 0]], [[1, 0], [0, 1]])) - assert(!find_rotation([[0, 1], [1, 1]], [[1, 0], [0, 1]])) - assert(find_rotation([[0, 0, 0], [0, 1, 0], [1, 1, 1]], [[1, 1, 1], [0, 1, 0], [0, 0, 0]])) + def test_default_one + assert( + find_rotation( + [ + [0, 1], + [1, 0] + ], + [ + [1, 0], + [0, 1] + ] + ) + ) + end + + def test_default_two + assert( + !find_rotation( + [ + [0, 1], + [1, 1] + ], + [ + [1, 0], + [0, 1] + ] + ) + ) + end + + def test_default_three + assert( + find_rotation( + [ + [0, 0, 0], + [0, 1, 0], + [1, 1, 1] + ], + [ + [1, 1, 1], + [0, 1, 0], + [0, 0, 0] + ] + ) + ) end end diff --git a/test/easy/test_1893_check_if_all_the_integers_in_a_range_are_covered.rb b/test/easy/test_1893_check_if_all_the_integers_in_a_range_are_covered.rb index 7d49a0d1..29028a41 100644 --- a/test/easy/test_1893_check_if_all_the_integers_in_a_range_are_covered.rb +++ b/test/easy/test_1893_check_if_all_the_integers_in_a_range_are_covered.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CheckIfAllTheIntegersInARangeAreCoveredTest < ::Minitest::Test - def test_default - assert(is_covered([[1, 2], [3, 4], [5, 6]], 2, 5)) - assert(!is_covered([[1, 10], [10, 20]], 21, 21)) - end + def test_default_one = assert(is_covered([[1, 2], [3, 4], [5, 6]], 2, 5)) + + def test_default_two = assert(!is_covered([[1, 10], [10, 20]], 21, 21)) end diff --git a/test/easy/test_1897_redistribute_characters_to_make_all_strings_equal.rb b/test/easy/test_1897_redistribute_characters_to_make_all_strings_equal.rb index 0df1ae56..14b04500 100644 --- a/test/easy/test_1897_redistribute_characters_to_make_all_strings_equal.rb +++ b/test/easy/test_1897_redistribute_characters_to_make_all_strings_equal.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class RedistributeCharactersToMakeAllStringsEqualTest < ::Minitest::Test - def test_default - assert(make_equal(%w[abc aabc bc])) - assert(!make_equal(%w[ab a])) - end + def test_default_one = assert(make_equal(%w[abc aabc bc])) + + def test_default_two = assert(!make_equal(%w[ab a])) end diff --git a/test/easy/test_1903_largest_odd_number_in_string.rb b/test/easy/test_1903_largest_odd_number_in_string.rb index 8aa03115..2c46cd9a 100644 --- a/test/easy/test_1903_largest_odd_number_in_string.rb +++ b/test/easy/test_1903_largest_odd_number_in_string.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class LargestOddNumberInStringTest < ::Minitest::Test - def test_default - assert_equal('5', largest_odd_number('52')) - assert_equal('', largest_odd_number('4206')) - assert_equal('35427', largest_odd_number('35427')) - end + def test_default_one = assert_equal('5', largest_odd_number('52')) + + def test_default_two = assert_equal('', largest_odd_number('4206')) + + def test_default_three = assert_equal('35427', largest_odd_number('35427')) end diff --git a/test/easy/test_1909_remove_one_element_to_make_the_array_strictly_increasing.rb b/test/easy/test_1909_remove_one_element_to_make_the_array_strictly_increasing.rb index 82ff4ce6..d187a5b5 100644 --- a/test/easy/test_1909_remove_one_element_to_make_the_array_strictly_increasing.rb +++ b/test/easy/test_1909_remove_one_element_to_make_the_array_strictly_increasing.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class RemoveOneElementToMakeTheArrayStrictlyIncreasingTest < ::Minitest::Test - def test_default - assert(can_be_increasing([1, 2, 10, 5, 7])) - assert(!can_be_increasing([2, 3, 1, 2])) - assert(!can_be_increasing([1, 1, 1])) - end + def test_default_one = assert(can_be_increasing([1, 2, 10, 5, 7])) + + def test_default_two = assert(!can_be_increasing([2, 3, 1, 2])) + + def test_default_three = assert(!can_be_increasing([1, 1, 1])) end diff --git a/test/easy/test_1913_maximum_product_difference_between_two_pairs.rb b/test/easy/test_1913_maximum_product_difference_between_two_pairs.rb index f940780d..e8ec4159 100644 --- a/test/easy/test_1913_maximum_product_difference_between_two_pairs.rb +++ b/test/easy/test_1913_maximum_product_difference_between_two_pairs.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class MaximumProductDifferenceBetweenTwoPairsTest < ::Minitest::Test - def test_default - assert_equal(34, max_product_difference([5, 6, 2, 7, 4])) - assert_equal(64, max_product_difference([4, 2, 5, 9, 7, 4, 8])) - end + def test_default_one = assert_equal(34, max_product_difference([5, 6, 2, 7, 4])) + + def test_default_two = assert_equal(64, max_product_difference([4, 2, 5, 9, 7, 4, 8])) end diff --git a/test/easy/test_1920_build_array_from_permutation.rb b/test/easy/test_1920_build_array_from_permutation.rb index 54b73bdd..5fa6ad51 100644 --- a/test/easy/test_1920_build_array_from_permutation.rb +++ b/test/easy/test_1920_build_array_from_permutation.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class BuildArrayFromPermutationTest < ::Minitest::Test - def test_default - assert_equal([0, 1, 2, 4, 5, 3], build_array([0, 2, 1, 5, 3, 4])) - assert_equal([4, 5, 0, 1, 2, 3], build_array([5, 0, 1, 2, 3, 4])) + def test_default_one + assert_equal( + [0, 1, 2, 4, 5, 3], + build_array( + [0, 2, 1, 5, 3, 4] + ) + ) + end + + def test_default_two + assert_equal( + [4, 5, 0, 1, 2, 3], + build_array( + [5, 0, 1, 2, 3, 4] + ) + ) end end diff --git a/test/easy/test_1925_count_square_sum_triples.rb b/test/easy/test_1925_count_square_sum_triples.rb index ece447a4..82dcfaf2 100644 --- a/test/easy/test_1925_count_square_sum_triples.rb +++ b/test/easy/test_1925_count_square_sum_triples.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountSquareSumTriplesTest < ::Minitest::Test - def test_default - assert_equal(2, count_triples(5)) - assert_equal(4, count_triples(10)) - end + def test_default_one = assert_equal(2, count_triples(5)) + + def test_default_two = assert_equal(4, count_triples(10)) end diff --git a/test/easy/test_1929_concatenation_of_array.rb b/test/easy/test_1929_concatenation_of_array.rb index 7b0bc046..5bf21652 100644 --- a/test/easy/test_1929_concatenation_of_array.rb +++ b/test/easy/test_1929_concatenation_of_array.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class ConcatenationOfArrayTest < ::Minitest::Test - def test_default - assert_equal([1, 2, 1, 1, 2, 1], get_concatenation([1, 2, 1])) - assert_equal([1, 3, 2, 1, 1, 3, 2, 1], get_concatenation([1, 3, 2, 1])) + def test_default_one + assert_equal( + [1, 2, 1, 1, 2, 1], + get_concatenation( + [1, 2, 1] + ) + ) + end + + def test_default_two + assert_equal( + [1, 3, 2, 1, 1, 3, 2, 1], + get_concatenation( + [1, 3, 2, 1] + ) + ) end end diff --git a/test/easy/test_1935_maximum_number_of_words_you_can_type.rb b/test/easy/test_1935_maximum_number_of_words_you_can_type.rb index ad09a8ad..49a9f785 100644 --- a/test/easy/test_1935_maximum_number_of_words_you_can_type.rb +++ b/test/easy/test_1935_maximum_number_of_words_you_can_type.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumNumberOfWordsYouCanTypeTest < ::Minitest::Test - def test_default - assert_equal(1, can_be_typed_words('hello world', 'ad')) - assert_equal(1, can_be_typed_words('leet code', 'lt')) - assert_equal(0, can_be_typed_words('leet code', 'e')) - end + def test_default_one = assert_equal(1, can_be_typed_words('hello world', 'ad')) + + def test_default_two = assert_equal(1, can_be_typed_words('leet code', 'lt')) + + def test_default_three = assert_equal(0, can_be_typed_words('leet code', 'e')) end diff --git a/test/easy/test_1941_check_if_all_characters_have_equal_number_of_occurrences.rb b/test/easy/test_1941_check_if_all_characters_have_equal_number_of_occurrences.rb index a49a33c8..89c21edf 100644 --- a/test/easy/test_1941_check_if_all_characters_have_equal_number_of_occurrences.rb +++ b/test/easy/test_1941_check_if_all_characters_have_equal_number_of_occurrences.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CheckIfAllCharactersHaveEqualNumberOfOccurrencesTest < ::Minitest::Test - def test_default - assert(are_occurrences_equal('abacbc')) - assert(!are_occurrences_equal('aaabb')) - end + def test_default_one = assert(are_occurrences_equal('abacbc')) + + def test_default_two = assert(!are_occurrences_equal('aaabb')) end diff --git a/test/easy/test_1952_three_divisors.rb b/test/easy/test_1952_three_divisors.rb index 399068cf..f7dc9d29 100644 --- a/test/easy/test_1952_three_divisors.rb +++ b/test/easy/test_1952_three_divisors.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ThreeDivisorsTest < ::Minitest::Test - def test_default - assert(!is_three(2)) - assert(is_three(4)) - end + def test_default_one = assert(!is_three(2)) + + def test_default_two = assert(is_three(4)) end diff --git a/test/easy/test_1957_delete_characters_to_make_fancy_string.rb b/test/easy/test_1957_delete_characters_to_make_fancy_string.rb index 392928a3..66caff80 100644 --- a/test/easy/test_1957_delete_characters_to_make_fancy_string.rb +++ b/test/easy/test_1957_delete_characters_to_make_fancy_string.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class DeleteCharactersToMakeFancyStringTest < ::Minitest::Test - def test_default - assert_equal('leetcode', make_fancy_string('leeetcode')) - assert_equal('aabaa', make_fancy_string('aaabaaaa')) - assert_equal('aab', make_fancy_string('aab')) - end + def test_default_one = assert_equal('leetcode', make_fancy_string('leeetcode')) + + def test_default_two = assert_equal('aabaa', make_fancy_string('aaabaaaa')) + + def test_default_three = assert_equal('aab', make_fancy_string('aab')) end diff --git a/test/easy/test_1961_check_if_string_is_a_prefix_of_array.rb b/test/easy/test_1961_check_if_string_is_a_prefix_of_array.rb index eea65697..704f400d 100644 --- a/test/easy/test_1961_check_if_string_is_a_prefix_of_array.rb +++ b/test/easy/test_1961_check_if_string_is_a_prefix_of_array.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class CheckIfStringIsAPrefixOfArrayTest < ::Minitest::Test - def test_default - assert(is_prefix_string('iloveleetcode', %w[i love leetcode apples])) - assert(!is_prefix_string('iloveleetcode', %w[apples i love leetcode])) + def test_default_one + assert( + is_prefix_string( + 'iloveleetcode', + %w[i love leetcode apples] + ) + ) + end + + def test_default_two + assert( + !is_prefix_string( + 'iloveleetcode', + %w[apples i love leetcode] + ) + ) end end diff --git a/test/easy/test_1967_number_of_strings_that_appear_as_substrings_in_word.rb b/test/easy/test_1967_number_of_strings_that_appear_as_substrings_in_word.rb index f7683852..bf2977fe 100644 --- a/test/easy/test_1967_number_of_strings_that_appear_as_substrings_in_word.rb +++ b/test/easy/test_1967_number_of_strings_that_appear_as_substrings_in_word.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class NumberOfStringsThatAppearAsSubstringsInWordTest < ::Minitest::Test - def test_default - assert_equal(3, num_of_strings(%w[a abc bc d], 'abc')) - assert_equal(2, num_of_strings(%w[a b c], 'aaaaabbbbb')) - assert_equal(3, num_of_strings(%w[a a a], 'ab')) - end + def test_default_one = assert_equal(3, num_of_strings(%w[a abc bc d], 'abc')) + + def test_default_two = assert_equal(2, num_of_strings(%w[a b c], 'aaaaabbbbb')) + + def test_default_three = assert_equal(3, num_of_strings(%w[a a a], 'ab')) end diff --git a/test/easy/test_1971_find_if_path_exists_in_graph.rb b/test/easy/test_1971_find_if_path_exists_in_graph.rb index 8621854e..5ae78ff7 100644 --- a/test/easy/test_1971_find_if_path_exists_in_graph.rb +++ b/test/easy/test_1971_find_if_path_exists_in_graph.rb @@ -5,8 +5,35 @@ require 'minitest/autorun' class FindIfPathExistsInGraphTest < ::Minitest::Test - def test_default - assert(valid_path(3, [[0, 1], [1, 2], [2, 0]], 0, 2)) - assert(!valid_path(6, [[0, 1], [0, 2], [3, 5], [5, 4], [4, 3]], 0, 5)) + def test_default_one + assert( + valid_path( + 3, + [ + [0, 1], + [1, 2], + [2, 0] + ], + 0, + 2 + ) + ) + end + + def test_default_two + assert( + !valid_path( + 6, + [ + [0, 1], + [0, 2], + [3, 5], + [5, 4], + [4, 3] + ], + 0, + 5 + ) + ) end end diff --git a/test/easy/test_1974_minimum_time_to_type_word_using_special_typewriter.rb b/test/easy/test_1974_minimum_time_to_type_word_using_special_typewriter.rb index 772c6fe3..17729880 100644 --- a/test/easy/test_1974_minimum_time_to_type_word_using_special_typewriter.rb +++ b/test/easy/test_1974_minimum_time_to_type_word_using_special_typewriter.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MinimumTimeToTypeWordUsingSpecialTypewriterTest < ::Minitest::Test - def test_default - assert_equal(5, min_time_to_type('abc')) - assert_equal(7, min_time_to_type('bza')) - assert_equal(34, min_time_to_type('zjpc')) - end + def test_default_one = assert_equal(5, min_time_to_type('abc')) + + def test_default_two = assert_equal(7, min_time_to_type('bza')) + + def test_default_three = assert_equal(34, min_time_to_type('zjpc')) end diff --git a/test/easy/test_1979_find_greatest_common_divisor_of_array.rb b/test/easy/test_1979_find_greatest_common_divisor_of_array.rb index 612bea43..183d057b 100644 --- a/test/easy/test_1979_find_greatest_common_divisor_of_array.rb +++ b/test/easy/test_1979_find_greatest_common_divisor_of_array.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FindGreatestCommonDivisorOfArrayTest < ::Minitest::Test - def test_default - assert_equal(2, find_gcd([2, 5, 6, 9, 10])) - assert_equal(1, find_gcd([7, 5, 6, 8, 3])) - assert_equal(3, find_gcd([3, 3])) - end + def test_default_one = assert_equal(2, find_gcd([2, 5, 6, 9, 10])) + + def test_default_two = assert_equal(1, find_gcd([7, 5, 6, 8, 3])) + + def test_default_three = assert_equal(3, find_gcd([3, 3])) end diff --git a/test/easy/test_1984_minimum_difference_between_highest_and_lowest_of_k_scores.rb b/test/easy/test_1984_minimum_difference_between_highest_and_lowest_of_k_scores.rb index 2d638f8c..f8c0b2fe 100644 --- a/test/easy/test_1984_minimum_difference_between_highest_and_lowest_of_k_scores.rb +++ b/test/easy/test_1984_minimum_difference_between_highest_and_lowest_of_k_scores.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class MinimumDifferenceBetweenHighestAndLowestOfKScoresTest < ::Minitest::Test - def test_default - assert_equal(0, minimum_difference([90], 1)) - assert_equal(2, minimum_difference([9, 4, 1, 7], 2)) - end + def test_default_one = assert_equal(0, minimum_difference([90], 1)) + + def test_default_two = assert_equal(2, minimum_difference([9, 4, 1, 7], 2)) end diff --git a/test/easy/test_1991_find_the_middle_index_in_array.rb b/test/easy/test_1991_find_the_middle_index_in_array.rb index ed73d7ac..cdb4bb57 100644 --- a/test/easy/test_1991_find_the_middle_index_in_array.rb +++ b/test/easy/test_1991_find_the_middle_index_in_array.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FindTheMiddleIndexInArrayTest < ::Minitest::Test - def test_default - assert_equal(3, find_middle_index([2, 3, -1, 8, 4])) - assert_equal(2, find_middle_index([1, -1, 4])) - assert_equal(-1, find_middle_index([2, 5])) - end + def test_default_one = assert_equal(3, find_middle_index([2, 3, -1, 8, 4])) + + def test_default_two = assert_equal(2, find_middle_index([1, -1, 4])) + + def test_default_three = assert_equal(-1, find_middle_index([2, 5])) end diff --git a/test/easy/test_1995_count_special_quadruplets.rb b/test/easy/test_1995_count_special_quadruplets.rb index ee567c0b..34447657 100644 --- a/test/easy/test_1995_count_special_quadruplets.rb +++ b/test/easy/test_1995_count_special_quadruplets.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CountSpecialQuadrupletsTest < ::Minitest::Test - def test_default - assert_equal(1, count_quadruplets([1, 2, 3, 6])) - assert_equal(0, count_quadruplets([3, 3, 6, 4, 5])) - assert_equal(4, count_quadruplets([1, 1, 1, 3, 5])) - end + def test_default_one = assert_equal(1, count_quadruplets([1, 2, 3, 6])) + + def test_default_two = assert_equal(0, count_quadruplets([3, 3, 6, 4, 5])) + + def test_default_three = assert_equal(4, count_quadruplets([1, 1, 1, 3, 5])) end diff --git a/test/easy/test_1_two_sum.rb b/test/easy/test_1_two_sum.rb index 54a5d6e9..58eaf65c 100644 --- a/test/easy/test_1_two_sum.rb +++ b/test/easy/test_1_two_sum.rb @@ -5,9 +5,32 @@ require 'minitest/autorun' class TwoSumTest < ::Minitest::Test - def test_default_one = assert_equal([0, 1], two_sum([2, 7, 11, 15], 9)) + def test_default_one + assert_equal( + [0, 1], + two_sum( + [2, 7, 11, 15], + 9 + ) + ) + end - def test_default_two = assert_equal([1, 2], two_sum([3, 2, 4], 6)) + def test_default_two + assert_equal( + [1, 2], + two_sum( + [3, 2, 4], + 6 + ) + ) + end - def test_default_three = assert_equal([0, 1], two_sum([3, 3], 6)) + def test_default_three + assert_equal( + [0, 1], + two_sum( + [3, 3], 6 + ) + ) + end end diff --git a/test/easy/test_2000_reverse_prefix_of_word.rb b/test/easy/test_2000_reverse_prefix_of_word.rb index 6c4aa7ea..dc0f60b7 100644 --- a/test/easy/test_2000_reverse_prefix_of_word.rb +++ b/test/easy/test_2000_reverse_prefix_of_word.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ReversePrefixOfWordTest < ::Minitest::Test - def test_default - assert_equal('dcbaefd', reverse_prefix('abcdefd', 'd')) - assert_equal('zxyxxe', reverse_prefix('xyxzxe', 'z')) - assert_equal('abcd', reverse_prefix('abcd', 'z')) - end + def test_default_one = assert_equal('dcbaefd', reverse_prefix('abcdefd', 'd')) + + def test_default_two = assert_equal('zxyxxe', reverse_prefix('xyxzxe', 'z')) + + def test_default_three = assert_equal('abcd', reverse_prefix('abcd', 'z')) end diff --git a/test/easy/test_2006_count_number_of_pairs_with_absolute_difference_k.rb b/test/easy/test_2006_count_number_of_pairs_with_absolute_difference_k.rb index bbce869d..4b508d04 100644 --- a/test/easy/test_2006_count_number_of_pairs_with_absolute_difference_k.rb +++ b/test/easy/test_2006_count_number_of_pairs_with_absolute_difference_k.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CountNumberOfPairsWithAbsoluteDifferenceKTest < ::Minitest::Test - def test_default - assert_equal(4, count_k_difference([1, 2, 2, 1], 1)) - assert_equal(0, count_k_difference([1, 3], 3)) - assert_equal(3, count_k_difference([3, 2, 1, 5, 4], 2)) - end + def test_default_one = assert_equal(4, count_k_difference([1, 2, 2, 1], 1)) + + def test_default_two = assert_equal(0, count_k_difference([1, 3], 3)) + + def test_default_three = assert_equal(3, count_k_difference([3, 2, 1, 5, 4], 2)) end diff --git a/test/easy/test_2011_final_value_of_variable_after_performing_operations.rb b/test/easy/test_2011_final_value_of_variable_after_performing_operations.rb index 398a19a5..50bfd77e 100644 --- a/test/easy/test_2011_final_value_of_variable_after_performing_operations.rb +++ b/test/easy/test_2011_final_value_of_variable_after_performing_operations.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FinalValueOfVariableAfterPerformingOperationsTest < ::Minitest::Test - def test_default - assert_equal(1, final_value_after_operations(%w[--X X++ X++])) - assert_equal(3, final_value_after_operations(%w[++X ++X X++])) - assert_equal(0, final_value_after_operations(%w[X++ ++X --X X--])) - end + def test_default_one = assert_equal(1, final_value_after_operations(%w[--X X++ X++])) + + def test_default_two = assert_equal(3, final_value_after_operations(%w[++X ++X X++])) + + def test_default_three = assert_equal(0, final_value_after_operations(%w[X++ ++X --X X--])) end diff --git a/test/easy/test_2016_maximum_difference_between_increasing_elements.rb b/test/easy/test_2016_maximum_difference_between_increasing_elements.rb index f5b3f3d4..ed7563b5 100644 --- a/test/easy/test_2016_maximum_difference_between_increasing_elements.rb +++ b/test/easy/test_2016_maximum_difference_between_increasing_elements.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumDifferenceBetweenIncreasingElementsTest < ::Minitest::Test - def test_default - assert_equal(4, maximum_difference([7, 1, 5, 4])) - assert_equal(-1, maximum_difference([9, 4, 3, 2])) - assert_equal(9, maximum_difference([1, 5, 2, 10])) - end + def test_default_one = assert_equal(4, maximum_difference([7, 1, 5, 4])) + + def test_default_two = assert_equal(-1, maximum_difference([9, 4, 3, 2])) + + def test_default_three = assert_equal(9, maximum_difference([1, 5, 2, 10])) end diff --git a/test/easy/test_2022_convert_1d_array_into_2d_array.rb b/test/easy/test_2022_convert_1d_array_into_2d_array.rb index 0ffc5308..68fac122 100644 --- a/test/easy/test_2022_convert_1d_array_into_2d_array.rb +++ b/test/easy/test_2022_convert_1d_array_into_2d_array.rb @@ -5,9 +5,41 @@ require 'minitest/autorun' class Convert1DArrayInto2DArrayTest < ::Minitest::Test - def test_default - assert_equal([[1, 2], [3, 4]], construct2_d_array([1, 2, 3, 4], 2, 2)) - assert_equal([[1, 2, 3]], construct2_d_array([1, 2, 3], 1, 3)) - assert_equal([], construct2_d_array([1, 2], 1, 1)) + def test_default_one + assert_equal( + [ + [1, 2], + [3, 4] + ], + construct2_d_array( + [1, 2, 3, 4], + 2, + 2 + ) + ) + end + + def test_default_two + assert_equal( + [ + [1, 2, 3] + ], + construct2_d_array( + [1, 2, 3], + 1, + 3 + ) + ) + end + + def test_default_three + assert_equal( + [], + construct2_d_array( + [1, 2], + 1, + 1 + ) + ) end end diff --git a/test/easy/test_2027_minimum_moves_to_convert_string.rb b/test/easy/test_2027_minimum_moves_to_convert_string.rb index f4202873..df20bcab 100644 --- a/test/easy/test_2027_minimum_moves_to_convert_string.rb +++ b/test/easy/test_2027_minimum_moves_to_convert_string.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MinimumMovesToConvertStringTest < ::Minitest::Test - def test_default - assert_equal(1, minimum_moves('XXX')) - assert_equal(2, minimum_moves('XXOX')) - assert_equal(0, minimum_moves('OOOO')) - end + def test_default_one = assert_equal(1, minimum_moves('XXX')) + + def test_default_two = assert_equal(2, minimum_moves('XXOX')) + + def test_default_three = assert_equal(0, minimum_moves('OOOO')) end diff --git a/test/easy/test_2032_two_out_of_three.rb b/test/easy/test_2032_two_out_of_three.rb index 75468e3e..8f0ce4c5 100644 --- a/test/easy/test_2032_two_out_of_three.rb +++ b/test/easy/test_2032_two_out_of_three.rb @@ -5,9 +5,36 @@ require 'minitest/autorun' class TwoOutOfThreeTest < ::Minitest::Test - def test_default - assert_equal([2, 3], two_out_of_three([1, 1, 3, 2], [2, 3], [3])) - assert_equal([1, 2, 3], two_out_of_three([3, 1], [2, 3], [1, 2])) - assert_equal([], two_out_of_three([1, 2, 2], [4, 3, 3], [5])) + def test_default_one + assert_equal( + [2, 3], + two_out_of_three( + [1, 1, 3, 2], + [2, 3], + [3] + ) + ) + end + + def test_default_two + assert_equal( + [1, 2, 3], + two_out_of_three( + [3, 1], + [2, 3], + [1, 2] + ) + ) + end + + def test_default_three + assert_equal( + [], + two_out_of_three( + [1, 2, 2], + [4, 3, 3], + [5] + ) + ) end end diff --git a/test/easy/test_2037_minimum_number_of_moves_to_seat_everyone.rb b/test/easy/test_2037_minimum_number_of_moves_to_seat_everyone.rb index 6a55043a..dad3a4d0 100644 --- a/test/easy/test_2037_minimum_number_of_moves_to_seat_everyone.rb +++ b/test/easy/test_2037_minimum_number_of_moves_to_seat_everyone.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class MinimumNumberOfMovesToSeatEveryoneTest < ::Minitest::Test - def test_default - assert_equal(4, min_moves_to_seat([3, 1, 5], [2, 7, 4])) - assert_equal(7, min_moves_to_seat([4, 1, 5, 9], [1, 3, 2, 6])) - assert_equal(4, min_moves_to_seat([2, 2, 6, 6], [1, 3, 2, 6])) + def test_default_one + assert_equal( + 4, + min_moves_to_seat( + [3, 1, 5], + [2, 7, 4] + ) + ) + end + + def test_default_two + assert_equal( + 7, + min_moves_to_seat( + [4, 1, 5, 9], + [1, 3, 2, 6] + ) + ) + end + + def test_default_three + assert_equal( + 4, + min_moves_to_seat( + [2, 2, 6, 6], + [1, 3, 2, 6] + ) + ) end end diff --git a/test/easy/test_2042_check_if_numbers_are_ascending_in_a_sentence.rb b/test/easy/test_2042_check_if_numbers_are_ascending_in_a_sentence.rb index 8c73a77c..cbdd33c2 100644 --- a/test/easy/test_2042_check_if_numbers_are_ascending_in_a_sentence.rb +++ b/test/easy/test_2042_check_if_numbers_are_ascending_in_a_sentence.rb @@ -5,9 +5,27 @@ require 'minitest/autorun' class CheckIfNumbersAreAscendingInASentenceTest < ::Minitest::Test - def test_default - assert(are_numbers_ascending('1 box has 3 blue 4 red 6 green and 12 yellow marbles')) - assert(!are_numbers_ascending('hello world 5 x 5')) - assert(!are_numbers_ascending('sunset is at 7 51 pm overnight lows will be in the low 50 and 60 s')) + def test_default_one + assert( + are_numbers_ascending( + '1 box has 3 blue 4 red 6 green and 12 yellow marbles' + ) + ) + end + + def test_default_two + assert( + !are_numbers_ascending( + 'hello world 5 x 5' + ) + ) + end + + def test_default_three + assert( + !are_numbers_ascending( + 'sunset is at 7 51 pm overnight lows will be in the low 50 and 60 s' + ) + ) end end diff --git a/test/easy/test_2047_number_of_valid_words_in_a_sentence.rb b/test/easy/test_2047_number_of_valid_words_in_a_sentence.rb index d08c4a01..1a140e95 100644 --- a/test/easy/test_2047_number_of_valid_words_in_a_sentence.rb +++ b/test/easy/test_2047_number_of_valid_words_in_a_sentence.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class NumberOfValidWordsInASentenceTest < ::Minitest::Test - def test_default - assert_equal(3, count_valid_words('cat and dog')) - assert_equal(0, count_valid_words('!this 1-s b8d!')) - assert_equal(5, count_valid_words('alice and bob are playing stone-game10')) + def test_default_one + assert_equal( + 3, + count_valid_words( + 'cat and dog' + ) + ) + end + + def test_default_two + assert_equal( + 0, + count_valid_words( + '!this 1-s b8d!' + ) + ) + end + + def test_default_three + assert_equal( + 5, + count_valid_words( + 'alice and bob are playing stone-game10' + ) + ) end end diff --git a/test/easy/test_2053_kth_distinct_string_in_an_array.rb b/test/easy/test_2053_kth_distinct_string_in_an_array.rb index ef327c31..cc192095 100644 --- a/test/easy/test_2053_kth_distinct_string_in_an_array.rb +++ b/test/easy/test_2053_kth_distinct_string_in_an_array.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class KthDistinctStringInAnArrayTest < ::Minitest::Test - def test_default - assert_equal('a', kth_distinct(%w[d b c b c a], 2)) - assert_equal('aaa', kth_distinct(%w[aaa aa a], 1)) - assert_equal('', kth_distinct(%w[a b a], 3)) + def test_default_one + assert_equal( + 'a', + kth_distinct( + %w[d b c b c a], + 2 + ) + ) + end + + def test_default_two + assert_equal( + 'aaa', + kth_distinct( + %w[aaa aa a], + 1 + ) + ) + end + + def test_default_three + assert_equal( + '', + kth_distinct( + %w[a b a], + 3 + ) + ) end end diff --git a/test/easy/test_2057_smallest_index_with_equal_value.rb b/test/easy/test_2057_smallest_index_with_equal_value.rb index 9128790c..f9b80aeb 100644 --- a/test/easy/test_2057_smallest_index_with_equal_value.rb +++ b/test/easy/test_2057_smallest_index_with_equal_value.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class SmallestIndexWithEqualValueTest < ::Minitest::Test - def test_default - assert_equal(0, smallest_equal([0, 1, 2])) - assert_equal(2, smallest_equal([4, 3, 2, 1])) - assert_equal(-1, smallest_equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])) + def test_default_one + assert_equal( + 0, + smallest_equal( + [0, 1, 2] + ) + ) + end + + def test_default_two + assert_equal( + 2, + smallest_equal( + [4, 3, 2, 1] + ) + ) + end + + def test_default_three + assert_equal( + -1, + smallest_equal( + [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] + ) + ) end end diff --git a/test/easy/test_2062_count_vowel_substrings_of_a_string.rb b/test/easy/test_2062_count_vowel_substrings_of_a_string.rb index 5e843b7f..1df92c52 100644 --- a/test/easy/test_2062_count_vowel_substrings_of_a_string.rb +++ b/test/easy/test_2062_count_vowel_substrings_of_a_string.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CountVowelSubstringsOfAStringTest < ::Minitest::Test - def test_default - assert_equal(2, count_vowel_substrings('aeiouu')) - assert_equal(0, count_vowel_substrings('unicornarihan')) - assert_equal(7, count_vowel_substrings('cuaieuouac')) - end + def test_default_one = assert_equal(2, count_vowel_substrings('aeiouu')) + + def test_default_two = assert_equal(0, count_vowel_substrings('unicornarihan')) + + def test_default_three = assert_equal(7, count_vowel_substrings('cuaieuouac')) end diff --git a/test/easy/test_2068_check_whether_two_strings_are_almost_equivalent.rb b/test/easy/test_2068_check_whether_two_strings_are_almost_equivalent.rb index 95daa9ae..1b4e48ef 100644 --- a/test/easy/test_2068_check_whether_two_strings_are_almost_equivalent.rb +++ b/test/easy/test_2068_check_whether_two_strings_are_almost_equivalent.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CheckWhetherTwoStringsAreAlmostEquivalentTest < ::Minitest::Test - def test_default - assert(!check_almost_equivalent('aaaa', 'bccb')) - assert(check_almost_equivalent('abcdeef', 'abaaacc')) - assert(check_almost_equivalent('cccddabba', 'babababab')) - end + def test_default_one = assert(!check_almost_equivalent('aaaa', 'bccb')) + + def test_default_two = assert(check_almost_equivalent('abcdeef', 'abaaacc')) + + def test_default_three = assert(check_almost_equivalent('cccddabba', 'babababab')) end diff --git a/test/easy/test_206_reverse_linked_list.rb b/test/easy/test_206_reverse_linked_list.rb index 5dad0112..879f2db4 100644 --- a/test/easy/test_206_reverse_linked_list.rb +++ b/test/easy/test_206_reverse_linked_list.rb @@ -24,9 +24,13 @@ def test_default_one def test_default_two assert( ::ListNode.are_equals( - ::ListNode.from_array([2, 1]), + ::ListNode.from_array( + [2, 1] + ), reverse_list( - ::ListNode.from_array([1, 2]) + ::ListNode.from_array( + [1, 2] + ) ) ) ) diff --git a/test/easy/test_2073_time_needed_to_buy_tickets.rb b/test/easy/test_2073_time_needed_to_buy_tickets.rb index eccd8505..9ad19ffc 100644 --- a/test/easy/test_2073_time_needed_to_buy_tickets.rb +++ b/test/easy/test_2073_time_needed_to_buy_tickets.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class TimeNeededToBuyTicketsTest < ::Minitest::Test - def test_default - assert_equal(6, time_required_to_buy([2, 3, 2], 2)) - assert_equal(8, time_required_to_buy([5, 1, 1, 1], 0)) + def test_default_one + assert_equal( + 6, + time_required_to_buy( + [2, 3, 2], + 2 + ) + ) + end + + def test_default_two + assert_equal( + 8, + time_required_to_buy( + [5, 1, 1, 1], + 0 + ) + ) end end diff --git a/test/easy/test_2078_two_furthest_houses_with_different_colors.rb b/test/easy/test_2078_two_furthest_houses_with_different_colors.rb index c1d0d865..eee601f8 100644 --- a/test/easy/test_2078_two_furthest_houses_with_different_colors.rb +++ b/test/easy/test_2078_two_furthest_houses_with_different_colors.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class TwoFurthestHousesWithDifferentColorsTest < ::Minitest::Test - def test_default - assert_equal(3, max_distance([1, 1, 1, 6, 1, 1, 1])) - assert_equal(4, max_distance([1, 8, 3, 8, 3])) - assert_equal(1, max_distance([0, 1])) - end + def test_default_one = assert_equal(3, max_distance([1, 1, 1, 6, 1, 1, 1])) + + def test_default_two = assert_equal(4, max_distance([1, 8, 3, 8, 3])) + + def test_default_three = assert_equal(1, max_distance([0, 1])) end diff --git a/test/easy/test_2085_count_common_words_with_one_occurrence.rb b/test/easy/test_2085_count_common_words_with_one_occurrence.rb index e33a851c..38d836d0 100644 --- a/test/easy/test_2085_count_common_words_with_one_occurrence.rb +++ b/test/easy/test_2085_count_common_words_with_one_occurrence.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class CountCommonWordsWithOneOccurrenceTest < ::Minitest::Test - def test_default - assert_equal(2, count_words(%w[leetcode is amazing as is], %w[amazing leetcode is])) - assert_equal(0, count_words(%w[b bb bbb], %w[a aa aaa])) - assert_equal(1, count_words(%w[a ab], %w[a a a ab])) + def test_default_one + assert_equal( + 2, + count_words( + %w[leetcode is amazing as is], + %w[amazing leetcode is] + ) + ) + end + + def test_default_two + assert_equal( + 0, + count_words( + %w[b bb bbb], + %w[a aa aaa] + ) + ) + end + + def test_default_three + assert_equal( + 1, + count_words( + %w[a ab], + %w[a a a ab] + ) + ) end end diff --git a/test/easy/test_2089_find_target_indices_after_sorting_array.rb b/test/easy/test_2089_find_target_indices_after_sorting_array.rb index f8fd6222..76d9bc9a 100644 --- a/test/easy/test_2089_find_target_indices_after_sorting_array.rb +++ b/test/easy/test_2089_find_target_indices_after_sorting_array.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class FindTargetIndicesAfterSortingArrayTest < ::Minitest::Test - def test_default - assert_equal([1, 2], target_indices([1, 2, 5, 2, 3], 2)) - assert_equal([3], target_indices([1, 2, 5, 2, 3], 3)) - assert_equal([4], target_indices([1, 2, 5, 2, 3], 5)) + def test_default_one + assert_equal( + [1, 2], + target_indices( + [1, 2, 5, 2, 3], + 2 + ) + ) + end + + def test_default_two + assert_equal( + [3], + target_indices( + [1, 2, 5, 2, 3], + 3 + ) + ) + end + + def test_default_three + assert_equal( + [4], + target_indices( + [1, 2, 5, 2, 3], + 5 + ) + ) end end diff --git a/test/easy/test_2094_finding_3_digit_even_numbers.rb b/test/easy/test_2094_finding_3_digit_even_numbers.rb index 8c85f534..74e6f477 100644 --- a/test/easy/test_2094_finding_3_digit_even_numbers.rb +++ b/test/easy/test_2094_finding_3_digit_even_numbers.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class Finding3DigitEvenNumbersTest < ::Minitest::Test - def test_default - assert_equal([102, 120, 130, 132, 210, 230, 302, 310, 312, 320], find_even_numbers([2, 1, 3, 0])) - assert_equal([222, 228, 282, 288, 822, 828, 882], find_even_numbers([2, 2, 8, 8, 2])) - assert_equal([], find_even_numbers([3, 7, 5])) + def test_default_one + assert_equal( + [102, 120, 130, 132, 210, 230, 302, 310, 312, 320], + find_even_numbers( + [2, 1, 3, 0] + ) + ) + end + + def test_default_two + assert_equal( + [222, 228, 282, 288, 822, 828, 882], + find_even_numbers( + [2, 2, 8, 8, 2] + ) + ) + end + + def test_default_three + assert_equal( + [], + find_even_numbers( + [3, 7, 5] + ) + ) end end diff --git a/test/easy/test_2099_find_subsequence_of_length_k_with_the_largest_sum.rb b/test/easy/test_2099_find_subsequence_of_length_k_with_the_largest_sum.rb index c18d3e5a..1fa4797b 100644 --- a/test/easy/test_2099_find_subsequence_of_length_k_with_the_largest_sum.rb +++ b/test/easy/test_2099_find_subsequence_of_length_k_with_the_largest_sum.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class FindSubsequenceOfLengthKWithTheLargestSumTest < ::Minitest::Test - def test_default - assert_equal([3, 3], max_subsequence([2, 1, 3, 3], 2)) - assert_equal([-1, 3, 4], max_subsequence([-1, -2, 3, 4], 3)) - assert_equal([4, 3], max_subsequence([3, 4, 3, 3], 2)) + def test_default_one + assert_equal( + [3, 3], + max_subsequence( + [2, 1, 3, 3], + 2 + ) + ) + end + + def test_default_two + assert_equal( + [-1, 3, 4], + max_subsequence( + [-1, -2, 3, 4], + 3 + ) + ) + end + + def test_default_three + assert_equal( + [4, 3], + max_subsequence( + [3, 4, 3, 3], + 2 + ) + ) end end diff --git a/test/easy/test_2103_rings_and_rods.rb b/test/easy/test_2103_rings_and_rods.rb index 3ec314fe..86a0691e 100644 --- a/test/easy/test_2103_rings_and_rods.rb +++ b/test/easy/test_2103_rings_and_rods.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class RingsAndRodsTest < ::Minitest::Test - def test_default - assert_equal(1, count_points('B0B6G0R6R0R6G9')) - assert_equal(1, count_points('B0R0G0R9R0B0G0')) - assert_equal(0, count_points('G4')) - end + def test_default_one = assert_equal(1, count_points('B0B6G0R6R0R6G9')) + + def test_default_two = assert_equal(1, count_points('B0R0G0R9R0B0G0')) + + def test_default_three = assert_equal(0, count_points('G4')) end diff --git a/test/easy/test_2108_find_first_palindromic_string_in_the_array.rb b/test/easy/test_2108_find_first_palindromic_string_in_the_array.rb index 0a86755c..21bd6a96 100644 --- a/test/easy/test_2108_find_first_palindromic_string_in_the_array.rb +++ b/test/easy/test_2108_find_first_palindromic_string_in_the_array.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class FindFirstPalindromicStringInTheArrayTest < ::Minitest::Test - def test_default - assert_equal('ada', first_palindrome(%w[abc car ada racecar cool])) - assert_equal('racecar', first_palindrome(%w[notapalindrome racecar])) - assert_equal('', first_palindrome(%w[def ghi])) + def test_default_one + assert_equal( + 'ada', + first_palindrome( + %w[abc car ada racecar cool] + ) + ) + end + + def test_default_two + assert_equal( + 'racecar', + first_palindrome( + %w[notapalindrome racecar] + ) + ) + end + + def test_default_three + assert_equal( + '', + first_palindrome( + %w[def ghi] + ) + ) end end diff --git a/test/easy/test_2114_maximum_number_of_words_round_in_sentences.rb b/test/easy/test_2114_maximum_number_of_words_round_in_sentences.rb index 81f46af4..afdb9a10 100644 --- a/test/easy/test_2114_maximum_number_of_words_round_in_sentences.rb +++ b/test/easy/test_2114_maximum_number_of_words_round_in_sentences.rb @@ -5,11 +5,29 @@ require 'minitest/autorun' class MaximumNumberOfWordsRoundInSentencesTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 6, - most_words_found(['alice and bob love leetcode', 'i think so too', 'this is great thanks very much']) + most_words_found( + [ + 'alice and bob love leetcode', + 'i think so too', + 'this is great thanks very much' + ] + ) + ) + end + + def test_default_two + assert_equal( + 3, + most_words_found( + [ + 'please wait', + 'continue to fight', + 'continue to win' + ] + ) ) - assert_equal(3, most_words_found(['please wait', 'continue to fight', 'continue to win'])) end end diff --git a/test/easy/test_2119_a_number_after_a_double_reversal.rb b/test/easy/test_2119_a_number_after_a_double_reversal.rb index ff3e476c..1c86c5cf 100644 --- a/test/easy/test_2119_a_number_after_a_double_reversal.rb +++ b/test/easy/test_2119_a_number_after_a_double_reversal.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class ANumberAfterADoubleReversalTest < ::Minitest::Test - def test_default - assert(is_same_after_reversals(526)) - assert(!is_same_after_reversals(1800)) - assert(is_same_after_reversals(0)) - end + def test_default_one = assert(is_same_after_reversals(526)) + + def test_default_two = assert(!is_same_after_reversals(1800)) + + def test_default_three = assert(is_same_after_reversals(0)) end diff --git a/test/easy/test_2124_check_if_all_as_appears_before_all_bs.rb b/test/easy/test_2124_check_if_all_as_appears_before_all_bs.rb index f30af272..12a8c214 100644 --- a/test/easy/test_2124_check_if_all_as_appears_before_all_bs.rb +++ b/test/easy/test_2124_check_if_all_as_appears_before_all_bs.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CheckIfAllAsAppearsBeforeAllBsTest < ::Minitest::Test - def test_default - assert(check_string('aaabbb')) - assert(!check_string('abab')) - assert(check_string('bbb')) - end + def test_default_one = assert(check_string('aaabbb')) + + def test_default_two = assert(!check_string('abab')) + + def test_default_three = assert(check_string('bbb')) end diff --git a/test/easy/test_2129_capitalize_the_title.rb b/test/easy/test_2129_capitalize_the_title.rb index 850db989..393de577 100644 --- a/test/easy/test_2129_capitalize_the_title.rb +++ b/test/easy/test_2129_capitalize_the_title.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class CapitalizeTheTitleTest < ::Minitest::Test - def test_default - assert_equal('Capitalize The Title', capitalize_title('capiTalIze tHe titLe')) - assert_equal('First Letter of Each Word', capitalize_title('First leTTeR of EACH Word')) - assert_equal('i Love Leetcode', capitalize_title('i lOve leetcode')) + def test_default_one + assert_equal( + 'Capitalize The Title', + capitalize_title( + 'capiTalIze tHe titLe' + ) + ) + end + + def test_default_two + assert_equal( + 'First Letter of Each Word', + capitalize_title( + 'First leTTeR of EACH Word' + ) + ) + end + + def test_default_three + assert_equal( + 'i Love Leetcode', + capitalize_title( + 'i lOve leetcode' + ) + ) end end diff --git a/test/easy/test_2133_check_if_every_row_and_column_contains_all_numbers.rb b/test/easy/test_2133_check_if_every_row_and_column_contains_all_numbers.rb index fc69a5e2..5677496b 100644 --- a/test/easy/test_2133_check_if_every_row_and_column_contains_all_numbers.rb +++ b/test/easy/test_2133_check_if_every_row_and_column_contains_all_numbers.rb @@ -5,8 +5,27 @@ require 'minitest/autorun' class CheckIfEveryRowAndColumnContainsAllNumbersTest < ::Minitest::Test - def test_default - assert(check_valid([[1, 2, 3], [3, 1, 2], [2, 3, 1]])) - assert(!check_valid([[1, 1, 1], [1, 2, 3], [1, 2, 3]])) + def test_default_one + assert( + check_valid( + [ + [1, 2, 3], + [3, 1, 2], + [2, 3, 1] + ] + ) + ) + end + + def test_default_two + assert( + !check_valid( + [ + [1, 1, 1], + [1, 2, 3], + [1, 2, 3] + ] + ) + ) end end diff --git a/test/easy/test_2138_divide_a_string_into_groups_of_size_k.rb b/test/easy/test_2138_divide_a_string_into_groups_of_size_k.rb index 0ba7079c..929bfcbe 100644 --- a/test/easy/test_2138_divide_a_string_into_groups_of_size_k.rb +++ b/test/easy/test_2138_divide_a_string_into_groups_of_size_k.rb @@ -5,8 +5,25 @@ require 'minitest/autorun' class DivideAStringIntoGroupsOfSizeKTest < ::Minitest::Test - def test_default - assert_equal(%w[abc def ghi], divide_string('abcdefghi', 3, 'x')) - assert_equal(%w[abc def ghi jxx], divide_string('abcdefghij', 3, 'x')) + def test_default_one + assert_equal( + %w[abc def ghi], + divide_string( + 'abcdefghi', + 3, + 'x' + ) + ) + end + + def test_default_two + assert_equal( + %w[abc def ghi jxx], + divide_string( + 'abcdefghij', + 3, + 'x' + ) + ) end end diff --git a/test/easy/test_2148_count_elements_with_strictly_smaller_and_greater_elements.rb b/test/easy/test_2148_count_elements_with_strictly_smaller_and_greater_elements.rb index 4b1bad95..a2081b3a 100644 --- a/test/easy/test_2148_count_elements_with_strictly_smaller_and_greater_elements.rb +++ b/test/easy/test_2148_count_elements_with_strictly_smaller_and_greater_elements.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountElementsWithStrictlySmallerAndGreaterElementsTest < ::Minitest::Test - def test_default - assert_equal(2, count_elements([11, 7, 2, 15])) - assert_equal(2, count_elements([-3, 3, 3, 90])) - end + def test_default_one = assert_equal(2, count_elements([11, 7, 2, 15])) + + def test_default_two = assert_equal(2, count_elements([-3, 3, 3, 90])) end diff --git a/test/easy/test_2154_keep_multiplying_found_values_by_two.rb b/test/easy/test_2154_keep_multiplying_found_values_by_two.rb index 2e3981e9..7db14cdb 100644 --- a/test/easy/test_2154_keep_multiplying_found_values_by_two.rb +++ b/test/easy/test_2154_keep_multiplying_found_values_by_two.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class KeepMultiplyingFoundValuesByTwoTest < ::Minitest::Test - def test_default - assert_equal(24, find_final_value([5, 3, 6, 1, 12], 3)) - assert_equal(4, find_final_value([2, 7, 9], 4)) + def test_default_one + assert_equal( + 24, + find_final_value( + [5, 3, 6, 1, 12], + 3 + ) + ) + end + + def test_default_two + assert_equal( + 4, + find_final_value( + [2, 7, 9], + 4 + ) + ) end end diff --git a/test/easy/test_2160_minimum_sum_of_four_digit_number_after_splitting_digits.rb b/test/easy/test_2160_minimum_sum_of_four_digit_number_after_splitting_digits.rb index c4303971..033c9ece 100644 --- a/test/easy/test_2160_minimum_sum_of_four_digit_number_after_splitting_digits.rb +++ b/test/easy/test_2160_minimum_sum_of_four_digit_number_after_splitting_digits.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class MinimumSumOfFourDigitNumberAfterSplittingDigitsTest < ::Minitest::Test - def test_default - assert_equal(52, minimum_sum(2932)) - assert_equal(13, minimum_sum(4009)) - end + def test_default_one = assert_equal(52, minimum_sum(2932)) + + def test_default_two = assert_equal(13, minimum_sum(4009)) end diff --git a/test/easy/test_2164_sort_even_and_odd_indices_independently.rb b/test/easy/test_2164_sort_even_and_odd_indices_independently.rb index 89d7eaf0..3dbad9fd 100644 --- a/test/easy/test_2164_sort_even_and_odd_indices_independently.rb +++ b/test/easy/test_2164_sort_even_and_odd_indices_independently.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class SortEvenAndOddIndicesIndependentlyTest < ::Minitest::Test - def test_default - assert_equal([2, 3, 4, 1], sort_even_odd([4, 1, 2, 3])) - assert_equal([2, 1], sort_even_odd([2, 1])) + def test_default_one + assert_equal( + [2, 3, 4, 1], + sort_even_odd( + [4, 1, 2, 3] + ) + ) + end + + def test_default_two + assert_equal( + [2, 1], + sort_even_odd( + [2, 1] + ) + ) end end diff --git a/test/easy/test_2169_count_operations_to_obtain_zero.rb b/test/easy/test_2169_count_operations_to_obtain_zero.rb index 85c6197b..90ba9f43 100644 --- a/test/easy/test_2169_count_operations_to_obtain_zero.rb +++ b/test/easy/test_2169_count_operations_to_obtain_zero.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountOperationsToObtainZeroTest < ::Minitest::Test - def test_default - assert_equal(3, count_operations(2, 3)) - assert_equal(1, count_operations(10, 10)) - end + def test_default_one = assert_equal(3, count_operations(2, 3)) + + def test_default_two = assert_equal(1, count_operations(10, 10)) end diff --git a/test/easy/test_2176_count_equal_and_divisible_pairs_in_an_array.rb b/test/easy/test_2176_count_equal_and_divisible_pairs_in_an_array.rb index 0fe7734c..58841b16 100644 --- a/test/easy/test_2176_count_equal_and_divisible_pairs_in_an_array.rb +++ b/test/easy/test_2176_count_equal_and_divisible_pairs_in_an_array.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class CountEqualAndDivisiblePairsInAnArrayTest < ::Minitest::Test - def test_default - assert_equal(4, count_pairs([3, 1, 2, 2, 2, 1, 3], 2)) - assert_equal(0, count_pairs([1, 2, 3, 4], 1)) + def test_default_one + assert_equal( + 4, + count_pairs( + [3, 1, 2, 2, 2, 1, 3], + 2 + ) + ) + end + + def test_default_two + assert_equal( + 0, + count_pairs( + [1, 2, 3, 4], + 1 + ) + ) end end diff --git a/test/easy/test_2180_count_integers_with_even_digit_sum.rb b/test/easy/test_2180_count_integers_with_even_digit_sum.rb index 8089c87e..55255668 100644 --- a/test/easy/test_2180_count_integers_with_even_digit_sum.rb +++ b/test/easy/test_2180_count_integers_with_even_digit_sum.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountIntegersWithEvenDigitSumTest < ::Minitest::Test - def test_default - assert_equal(2, count_even(4)) - assert_equal(14, count_even(30)) - end + def test_default_one = assert_equal(2, count_even(4)) + + def test_default_two = assert_equal(14, count_even(30)) end diff --git a/test/easy/test_2185_counting_words_with_a_given_prefix.rb b/test/easy/test_2185_counting_words_with_a_given_prefix.rb index 3fd50409..53a5c08d 100644 --- a/test/easy/test_2185_counting_words_with_a_given_prefix.rb +++ b/test/easy/test_2185_counting_words_with_a_given_prefix.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class CountingWordsWithAGivenPrefixTest < ::Minitest::Test - def test_default - assert_equal(2, prefix_count(%w[pay attention practice attend], 'at')) - assert_equal(0, prefix_count(%w[leetcode win loops success], 'code')) + def test_default_one + assert_equal( + 2, + prefix_count( + %w[pay attention practice attend], + 'at' + ) + ) + end + + def test_default_two + assert_equal( + 0, + prefix_count( + %w[leetcode win loops success], + 'code' + ) + ) end end diff --git a/test/easy/test_2190_most_frequent_number_following_key_in_an_array.rb b/test/easy/test_2190_most_frequent_number_following_key_in_an_array.rb index cfc2473c..33aa2e1f 100644 --- a/test/easy/test_2190_most_frequent_number_following_key_in_an_array.rb +++ b/test/easy/test_2190_most_frequent_number_following_key_in_an_array.rb @@ -5,12 +5,33 @@ require 'minitest/autorun' class MostFrequentNumberFollowingKeyInAnArrayTest < ::Minitest::Test - def test_default - assert_equal(100, most_frequent([1, 100, 200, 1, 100], 1)) - assert_equal(2, most_frequent([2, 2, 2, 2, 3], 2)) + def test_default_one + assert_equal( + 100, + most_frequent( + [1, 100, 200, 1, 100], + 1 + ) + ) end - def test_additional - assert_equal(-1, most_frequent([1, 100, 200, 1, 100], 30)) + def test_default_two + assert_equal( + 2, + most_frequent( + [2, 2, 2, 2, 3], + 2 + ) + ) + end + + def test_additional_one + assert_equal( + -1, + most_frequent( + [1, 100, 200, 1, 100], + 30 + ) + ) end end diff --git a/test/easy/test_21_merge_two_sorted_lists.rb b/test/easy/test_21_merge_two_sorted_lists.rb index 22aa4f97..836c1740 100644 --- a/test/easy/test_21_merge_two_sorted_lists.rb +++ b/test/easy/test_21_merge_two_sorted_lists.rb @@ -12,8 +12,12 @@ def test_default [1, 1, 2, 3, 4, 4] ), merge_two_lists( - ::ListNode.from_array([1, 2, 4]), - ::ListNode.from_array([1, 3, 4]) + ::ListNode.from_array( + [1, 2, 4] + ), + ::ListNode.from_array( + [1, 3, 4] + ) ) ) ) diff --git a/test/easy/test_234_palindrome_linked_list.rb b/test/easy/test_234_palindrome_linked_list.rb index bab41d74..47295810 100644 --- a/test/easy/test_234_palindrome_linked_list.rb +++ b/test/easy/test_234_palindrome_linked_list.rb @@ -6,7 +6,23 @@ require 'minitest/autorun' class PalindromeLinkedListTest < ::Minitest::Test - def test_default_one = assert(is_palindrome_ll(::ListNode.from_array([1, 2, 2, 1]))) + def test_default_one + assert( + is_palindrome_ll( + ::ListNode.from_array( + [1, 2, 2, 1] + ) + ) + ) + end - def test_default_two = assert(!is_palindrome_ll(::ListNode.from_array([1, 2]))) + def test_default_two + assert( + !is_palindrome_ll( + ::ListNode.from_array( + [1, 2] + ) + ) + ) + end end diff --git a/test/easy/test_303_range_sum_query_immutable.rb b/test/easy/test_303_range_sum_query_immutable.rb index 1f57183b..acf36aaa 100644 --- a/test/easy/test_303_range_sum_query_immutable.rb +++ b/test/easy/test_303_range_sum_query_immutable.rb @@ -7,6 +7,7 @@ class RangeSumQueryImmutableTest < ::Minitest::Test def test_default_one num_array = ::NumArray.new([-2, 0, 3, -5, 2, -1]) + assert_equal(1, num_array.sum_range(0, 2)) assert_equal(-1, num_array.sum_range(2, 5)) assert_equal(-3, num_array.sum_range(0, 5)) diff --git a/test/easy/test_35_search_insert_position.rb b/test/easy/test_35_search_insert_position.rb index eef64a63..89a20aee 100644 --- a/test/easy/test_35_search_insert_position.rb +++ b/test/easy/test_35_search_insert_position.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class SearchInsertPositionTest < ::Minitest::Test - def test_default_one = assert_equal(2, search_insert([1, 3, 5, 6], 5)) + def test_default_one + assert_equal( + 2, + search_insert( + [1, 3, 5, 6], + 5 + ) + ) + end - def test_default_two = assert_equal(1, search_insert([1, 3, 5, 6], 2)) + def test_default_two + assert_equal( + 1, + search_insert( + [1, 3, 5, 6], + 2 + ) + ) + end - def test_default_three = assert_equal(4, search_insert([1, 3, 5, 6], 7)) + def test_default_three + assert_equal( + 4, + search_insert( + [1, 3, 5, 6], + 7 + ) + ) + end end diff --git a/test/easy/test_557_reverse_words_in_a_string_iii.rb b/test/easy/test_557_reverse_words_in_a_string_iii.rb index 85901d31..dfa2d9f2 100644 --- a/test/easy/test_557_reverse_words_in_a_string_iii.rb +++ b/test/easy/test_557_reverse_words_in_a_string_iii.rb @@ -8,14 +8,18 @@ class ReverseWordsInAStringIIITest < ::Minitest::Test def test_default_one assert_equal( "s'teL ekat edoCteeL tsetnoc", - reverse_words("Let's take LeetCode contest") + reverse_words( + "Let's take LeetCode contest" + ) ) end def test_default_two assert_equal( 'doG gniD', - reverse_words('God Ding') + reverse_words( + 'God Ding' + ) ) end end diff --git a/test/easy/test_566_reshape_the_matrix.rb b/test/easy/test_566_reshape_the_matrix.rb index bc6e26c9..f82dcd64 100644 --- a/test/easy/test_566_reshape_the_matrix.rb +++ b/test/easy/test_566_reshape_the_matrix.rb @@ -7,9 +7,14 @@ class ReshapeTheMatrixTest < ::Minitest::Test def test_default_one assert_equal( - [[1, 2, 3, 4]], + [ + [1, 2, 3, 4] + ], matrix_reshape( - [[1, 2], [3, 4]], + [ + [1, 2], + [3, 4] + ], 1, 4 ) @@ -18,9 +23,15 @@ def test_default_one def test_default_two assert_equal( - [[1, 2], [3, 4]], + [ + [1, 2], + [3, 4] + ], matrix_reshape( - [[1, 2], [3, 4]], + [ + [1, 2], + [3, 4] + ], 2, 4 ) diff --git a/test/easy/test_58_length_of_last_word.rb b/test/easy/test_58_length_of_last_word.rb index 28f6b03b..9b84c926 100644 --- a/test/easy/test_58_length_of_last_word.rb +++ b/test/easy/test_58_length_of_last_word.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class LengthOfLastWordTest < ::Minitest::Test - def test_default_one = assert_equal(5, length_of_last_word('Hello World')) + def test_default_one + assert_equal( + 5, + length_of_last_word( + 'Hello World' + ) + ) + end - def test_default_two = assert_equal(4, length_of_last_word(' fly me to the moon ')) + def test_default_two + assert_equal( + 4, + length_of_last_word( + ' fly me to the moon ' + ) + ) + end - def test_default_three = assert_equal(6, length_of_last_word('luffy is still joyboy')) + def test_default_three + assert_equal( + 6, + length_of_last_word( + 'luffy is still joyboy' + ) + ) + end end diff --git a/test/easy/test_643_maximum_average_subarray_i.rb b/test/easy/test_643_maximum_average_subarray_i.rb index 5b60e944..aa276875 100644 --- a/test/easy/test_643_maximum_average_subarray_i.rb +++ b/test/easy/test_643_maximum_average_subarray_i.rb @@ -15,5 +15,13 @@ def test_default_one ) end - def test_default_two = assert_equal(5.00000, find_max_average([5], 1)) + def test_default_two + assert_equal( + 5.00000, + find_max_average( + [5], + 1 + ) + ) + end end diff --git a/test/easy/test_66_plus_one.rb b/test/easy/test_66_plus_one.rb index 4bc3f9bb..805fa610 100644 --- a/test/easy/test_66_plus_one.rb +++ b/test/easy/test_66_plus_one.rb @@ -5,9 +5,28 @@ require 'minitest/autorun' class PlusOneTest < ::Minitest::Test - def test_default_one = assert_equal([1, 2, 4], plus_one([1, 2, 3])) + def test_default_one + assert_equal( + [1, 2, 4], + plus_one( + [1, 2, 3] + ) + ) + end - def test_default_two = assert_equal([4, 3, 2, 2], plus_one([4, 3, 2, 1])) + def test_default_two + assert_equal( + [4, 3, 2, 2], + plus_one( + [4, 3, 2, 1] + ) + ) + end - def test_default_three = assert_equal([1, 0], plus_one([9])) + def test_default_three + assert_equal( + [1, 0], + plus_one([9]) + ) + end end diff --git a/test/easy/test_704_binary_search.rb b/test/easy/test_704_binary_search.rb index 3b1a9c42..1d3ea400 100644 --- a/test/easy/test_704_binary_search.rb +++ b/test/easy/test_704_binary_search.rb @@ -5,7 +5,23 @@ require 'minitest/autorun' class BinarySearchTest < ::Minitest::Test - def test_default_one = assert_equal(4, search([-1, 0, 3, 5, 9, 12], 9)) + def test_default_one + assert_equal( + 4, + search( + [-1, 0, 3, 5, 9, 12], + 9 + ) + ) + end - def test_default_two = assert_equal(-1, search([-1, 0, 3, 5, 9, 12], 2)) + def test_default_two + assert_equal( + -1, + search( + [-1, 0, 3, 5, 9, 12], + 2 + ) + ) + end end diff --git a/test/easy/test_733_flood_fill.rb b/test/easy/test_733_flood_fill.rb index de7bc8e6..66576a63 100644 --- a/test/easy/test_733_flood_fill.rb +++ b/test/easy/test_733_flood_fill.rb @@ -7,15 +7,39 @@ class FloodFillTest < ::Minitest::Test def test_default_one assert_equal( - [[2, 2, 2], [2, 2, 0], [2, 0, 1]], - flood_fill([[1, 1, 1], [1, 1, 0], [1, 0, 1]], 1, 1, 2) + [ + [2, 2, 2], + [2, 2, 0], + [2, 0, 1] + ], + flood_fill( + [ + [1, 1, 1], + [1, 1, 0], + [1, 0, 1] + ], + 1, + 1, + 2 + ) ) end def test_default_two assert_equal( - [[0, 0, 0], [0, 0, 0]], - flood_fill([[0, 0, 0], [0, 0, 0]], 0, 0, 0) + [ + [0, 0, 0], + [0, 0, 0] + ], + flood_fill( + [ + [0, 0, 0], + [0, 0, 0] + ], + 0, + 0, + 0 + ) ) end end diff --git a/test/easy/test_744_find_smallest_letter_greater_than_target.rb b/test/easy/test_744_find_smallest_letter_greater_than_target.rb index 4daa0297..03d8d811 100644 --- a/test/easy/test_744_find_smallest_letter_greater_than_target.rb +++ b/test/easy/test_744_find_smallest_letter_greater_than_target.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class FindSmallestLetterGreaterThanTargetTest < ::Minitest::Test - def test_default_one = assert_equal('c', next_greatest_letter(%w[c f j], 'a')) + def test_default_one + assert_equal( + 'c', + next_greatest_letter( + %w[c f j], + 'a' + ) + ) + end - def test_default_two = assert_equal('f', next_greatest_letter(%w[c f j], 'c')) + def test_default_two + assert_equal( + 'f', + next_greatest_letter( + %w[c f j], + 'c' + ) + ) + end - def test_default_three = assert_equal('x', next_greatest_letter(%w[x x y y], 'z')) + def test_default_three + assert_equal( + 'x', + next_greatest_letter( + %w[x x y y], + 'z' + ) + ) + end end diff --git a/test/easy/test_812_largest_triangle_area.rb b/test/easy/test_812_largest_triangle_area.rb index b1517e35..b206258d 100644 --- a/test/easy/test_812_largest_triangle_area.rb +++ b/test/easy/test_812_largest_triangle_area.rb @@ -9,7 +9,13 @@ def test_default_one assert_equal( 2.00000, largest_triangle_area( - [[0, 0], [0, 1], [1, 0], [0, 2], [2, 0]] + [ + [0, 0], + [0, 1], + [1, 0], + [0, 2], + [2, 0] + ] ) ) end @@ -18,7 +24,11 @@ def test_default_two assert_equal( 0.50000, largest_triangle_area( - [[1, 0], [0, 0], [0, 1]] + [ + [1, 0], + [0, 0], + [0, 1] + ] ) ) end diff --git a/test/easy/test_830_positions_of_large_groups.rb b/test/easy/test_830_positions_of_large_groups.rb index 420c192d..e5489a90 100644 --- a/test/easy/test_830_positions_of_large_groups.rb +++ b/test/easy/test_830_positions_of_large_groups.rb @@ -5,14 +5,36 @@ require 'minitest/autorun' class PositionsOfLargeGroupsTest < ::Minitest::Test - def test_default_one = assert_equal([[3, 6]], large_group_positions('abbxxxxzzy')) + def test_default_one + assert_equal( + [ + [3, 6] + ], + large_group_positions( + 'abbxxxxzzy' + ) + ) + end - def test_default_two = assert_equal([], large_group_positions('abc')) + def test_default_two + assert_equal( + [], + large_group_positions( + 'abc' + ) + ) + end def test_default_three assert_equal( - [[3, 5], [6, 9], [12, 14]], - large_group_positions('abcdddeeeeaabbbcd') + [ + [3, 5], + [6, 9], + [12, 14] + ], + large_group_positions( + 'abcdddeeeeaabbbcd' + ) ) end end diff --git a/test/easy/test_860_lemonade_change.rb b/test/easy/test_860_lemonade_change.rb index e9e3d3f7..a927aa47 100644 --- a/test/easy/test_860_lemonade_change.rb +++ b/test/easy/test_860_lemonade_change.rb @@ -5,9 +5,21 @@ require 'minitest/autorun' class LemonadeChangeTest < ::Minitest::Test - def test_default_one = assert(lemonade_change([5, 5, 5, 10, 20])) + def test_default_one + assert( + lemonade_change( + [5, 5, 5, 10, 20] + ) + ) + end - def test_default_two = assert(!lemonade_change([5, 5, 10, 10, 20])) + def test_default_two + assert( + !lemonade_change( + [5, 5, 10, 10, 20] + ) + ) + end def test_additional_one assert( diff --git a/test/easy/test_867_transpose_matrix.rb b/test/easy/test_867_transpose_matrix.rb index f4cfaa3b..356cc668 100644 --- a/test/easy/test_867_transpose_matrix.rb +++ b/test/easy/test_867_transpose_matrix.rb @@ -7,15 +7,34 @@ class TransposeMatrixTest < ::Minitest::Test def test_default_one assert_equal( - [[1, 4, 7], [2, 5, 8], [3, 6, 9]], - transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) + [ + [1, 4, 7], + [2, 5, 8], + [3, 6, 9] + ], + transpose( + [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9] + ] + ) ) end def test_default_two assert_equal( - [[1, 4], [2, 5], [3, 6]], - transpose([[1, 2, 3], [4, 5, 6]]) + [ + [1, 4], + [2, 5], + [3, 6] + ], + transpose( + [ + [1, 2, 3], + [4, 5, 6] + ] + ) ) end end diff --git a/test/easy/test_925_long_pressed_name.rb b/test/easy/test_925_long_pressed_name.rb index 05a2d2c0..54041028 100644 --- a/test/easy/test_925_long_pressed_name.rb +++ b/test/easy/test_925_long_pressed_name.rb @@ -5,9 +5,23 @@ require 'minitest/autorun' class LongPressedNameTest < ::Minitest::Test - def test_default_one = assert(is_long_pressed_name('alex', 'aaleex')) + def test_default_one + assert( + is_long_pressed_name( + 'alex', + 'aaleex' + ) + ) + end - def test_default_two = assert(!is_long_pressed_name('saeed', 'ssaaedd')) + def test_default_two + assert( + !is_long_pressed_name( + 'saeed', + 'ssaaedd' + ) + ) + end def test_additional_one assert( From 3431112838f80a6482492bbf58a17f718bb48a53 Mon Sep 17 00:00:00 2001 From: fartem Date: Tue, 20 Aug 2024 21:25:56 +0300 Subject: [PATCH 8/9] 2024-08-20 v. 6.5.1.1: updated some tests --- leetcode-ruby.gemspec | 2 +- ...2194_cells_in_a_range_on_an_excel_sheet.rb | 19 +++++- ...test_2206_divide_array_into_equal_pairs.rb | 7 +-- ...210_count_hills_and_valleys_in_an_array.rb | 7 +-- ..._2215_find_the_difference_of_two_arrays.rb | 27 +++++++- ...220_minimum_bit_flips_to_convert_number.rb | 7 +-- ...gest_number_after_digit_swaps_by_parity.rb | 7 +-- test/easy/test_2235_add_two_integers.rb | 7 +-- .../test_2236_root_equals_sum_of_children.rb | 5 +- .../test_2239_find_closest_number_to_zero.rb | 19 +++++- ...st_2243_calculate_digit_sum_of_a_string.rb | 11 ++-- ...st_2248_intersection_of_multiple_arrays.rb | 26 +++++++- ...t_2255_count_prefixes_of_a_given_string.rb | 21 ++++++- ...ve_digit_from_number_to_maximize_result.rb | 14 ++--- ...4_largest_3_same_digit_number_in_string.rb | 10 +-- ...est_2278_percentage_of_letter_in_string.rb | 7 +-- ...r_has_equal_digit_count_and_digit_value.rb | 7 +-- ...rrange_characters_to_make_target_string.rb | 32 ++++++++-- test/easy/test_2293_min_max_game.rb | 19 +++++- .../test_2299_strong_password_checker_ii.rb | 10 +-- ...est_2303_calculate_amount_paid_in_taxes.rb | 54 ++++++++++++++-- ..._english_letter_in_upper_and_lower_case.rb | 10 +-- test/easy/test_2315_count_asterisks.rb | 10 +-- .../test_2319_check_if_matrix_is_x_matrix.rb | 26 +++++++- test/easy/test_2325_decode_the_message.rb | 5 +- .../test_2331_evaluate_boolean_binary_tree.rb | 12 +++- ...335_minimum_amount_of_time_to_fill_cups.rb | 10 +-- ...t_2341_maximum_number_of_pairs_in_array.rb | 10 +-- test/easy/test_2347_best_poker_hand.rb | 42 +++++++++++-- .../test_2351_first_letter_to_appear_twice.rb | 11 ++-- ...array_zero_by_subtracting_equal_amounts.rb | 7 +-- test/easy/test_2363_merge_similar_items.rb | 60 +++++++++++++++--- ...test_2367_number_of_arithmetic_triplets.rb | 21 ++++++- ...t_2373_largest_local_values_in_a_matrix.rb | 16 ++++- ...olors_to_get_k_consecutive_black_blocks.rb | 7 +-- ..._hours_of_training_to_win_a_competition.rb | 25 +++++++- ...89_longest_subsequence_with_limited_sum.rb | 21 ++++++- ...test_2395_find_subarrays_with_equal_sum.rb | 10 +-- ...99_check_distances_between_same_letters.rb | 5 +- .../test_2404_most_frequent_even_element.rb | 29 +++++++-- test/easy/test_2413_smallest_even_multiple.rb | 7 +-- test/easy/test_2418_sort_the_people.rb | 21 ++++++- ...423_remove_letter_to_equalize_frequency.rb | 7 +-- .../test_2427_number_of_common_factors.rb | 7 +-- ...mployee_that_worked_on_the_longest_task.rb | 31 +++++++++- ...e_integer_that_exists_with_its_negative.rb | 29 +++++++-- ...6_determine_if_two_events_have_conflict.rb | 29 +++++++-- ...ven_numbers_that_are_divisible_by_three.rb | 7 +-- .../test_2460_apply_operations_to_an_array.rb | 19 +++++- .../easy/test_2469_convert_the_temperature.rb | 25 +++++++- ...475_number_of_unequal_triplets_in_array.rb | 7 +-- ...st_2481_minimum_cuts_to_divide_a_circle.rb | 11 ++-- test/easy/test_2485_find_the_pivot_integer.rb | 10 +-- test/easy/test_2490_circular_sentence.rb | 10 +-- ...6_maximum_value_of_a_string_in_an_array.rb | 19 +++++- ..._2500_delete_greatest_value_in_each_row.rb | 24 +++++++- ...est_2506_count_pairs_of_similar_strings.rb | 29 +++++++-- ...aximum_enemy_forts_that_can_be_captured.rb | 19 +++++- ...ce_to_target_string_in_a_circular_array.rb | 35 +++++++++-- ...0_count_the_digits_that_divide_a_number.rb | 10 +-- ...25_categorize_box_according_to_criteria.rb | 50 +++++++++++++-- ...f_positive_integer_and_negative_integer.rb | 10 +-- ...n_element_sum_and_digit_sum_of_an_array.rb | 7 +-- test/easy/test_2540_minimum_common_value.rb | 31 ++++++++-- test/easy/test_2544_alternating_digit_sum.rb | 10 +-- ...st_2549_count_distinct_numbers_on_board.rb | 7 +-- ...t_102_binary_tree_level_order_traversal.rb | 18 +++++- ...inary_tree_zigzag_level_order_traversal.rb | 18 +++++- ...ree_from_preorder_and_inorder_traversal.rb | 5 +- ...ee_from_inorder_and_postorder_traversal.rb | 5 +- ...07_binary_tree_level_order_traversal_ii.rb | 18 +++++- ...nvert_sorted_list_to_binary_search_tree.rb | 5 +- test/medium/test_113_path_sum_ii.rb | 13 +++- ..._114_flatten_binary_tree_to_linked_list.rb | 6 +- ...lating_next_right_pointers_in_each_node.rb | 4 +- ...ing_next_right_pointers_in_each_node_ii.rb | 4 +- .../test_11_container_with_most_water.rb | 7 +-- test/medium/test_120_triangle.rb | 26 +++++++- .../test_128_longest_consecutive_sequence.rb | 19 +++++- .../test_129_sum_root_to_leaf_numbers.rb | 5 +- test/medium/test_12_integer_to_roman.rb | 10 +-- test/medium/test_133_clone_graph.rb | 12 ++-- test/medium/test_134_gas_station.rb | 5 +- test/medium/test_15_3sum.rb | 18 ++++-- test/medium/test_16_3sum_closest.rb | 7 +-- ...7_letter_combinations_of_a_phone_number.rb | 18 ++++-- ...est_19_remove_nth_node_from_end_of_list.rb | 8 ++- test/medium/test_22_generate_parentheses.rb | 10 ++- test/medium/test_24_swap_nodes_in_pairs.rb | 16 ++++- test/medium/test_29_divide_two_integers.rb | 7 +-- test/medium/test_2_add_two_numbers.rb | 61 ++++++++++++++----- .../test_33_search_in_rotated_sorted_array.rb | 32 ++++++++-- ...ast_position_of_element_in_sorted_array.rb | 32 ++++++++-- test/medium/test_36_valid_sudoku.rb | 5 +- test/medium/test_38_count_and_say.rb | 7 +-- test/medium/test_39_combination_sum.rb | 39 ++++++++++-- ..._substring_without_repeating_characters.rb | 10 +-- test/medium/test_43_multiply_strings.rb | 7 +-- test/medium/test_46_permutations.rb | 31 ++++++++-- test/medium/test_48_rotate_image.rb | 4 +- test/medium/test_49_group_anagrams.rb | 36 +++++++++-- test/medium/test_53_maximum_subarray.rb | 29 +++++++-- test/medium/test_54_spiral_matrix.rb | 5 +- test/medium/test_55_jump_game.rb | 7 +-- test/medium/test_56_merge_intervals.rb | 33 +++++++++- test/medium/test_57_insert_interval.rb | 37 ++++++++++- test/medium/test_59_spiral_matrix_ii.rb | 21 ++++++- .../test_5_longest_palindromic_substring.rb | 7 +-- test/medium/test_61_rotate_list.rb | 27 ++++++-- test/medium/test_62_unique_paths.rb | 7 +-- test/medium/test_71_simplify_path.rb | 49 +++++++++++++-- test/medium/test_74_search_a_2d_matrix.rb | 27 +++++++- test/medium/test_75_sort_colors.rb | 4 +- test/medium/test_78_subsets.rb | 29 +++++++-- test/medium/test_7_reverse_integer.rb | 14 ++--- ...2_remove_duplicates_from_sorted_list_ii.rb | 9 ++- test/medium/test_86_partition_list.rb | 13 +++- test/medium/test_8_string_to_integer_atoi.rb | 10 +-- test/medium/test_92_reverse_linked_list_ii.rb | 5 +- .../test_95_unique_binary_search_trees_ii.rb | 4 +- .../test_96_unique_binary_search_trees.rb | 7 +-- .../test_98_validate_binary_search_tree.rb | 5 +- .../test_99_recover_binary_search_tree.rb | 4 +- 123 files changed, 1556 insertions(+), 451 deletions(-) diff --git a/leetcode-ruby.gemspec b/leetcode-ruby.gemspec index aca18652..7c34ef1d 100644 --- a/leetcode-ruby.gemspec +++ b/leetcode-ruby.gemspec @@ -5,7 +5,7 @@ require 'English' ::Gem::Specification.new do |s| s.required_ruby_version = '>= 3.0' s.name = 'leetcode-ruby' - s.version = '6.5.1' + s.version = '6.5.1.1' s.license = 'MIT' s.files = ::Dir['lib/**/*.rb'] + %w[README.md] s.executable = 'leetcode-ruby' diff --git a/test/easy/test_2194_cells_in_a_range_on_an_excel_sheet.rb b/test/easy/test_2194_cells_in_a_range_on_an_excel_sheet.rb index 0e141bb6..ee3c2552 100644 --- a/test/easy/test_2194_cells_in_a_range_on_an_excel_sheet.rb +++ b/test/easy/test_2194_cells_in_a_range_on_an_excel_sheet.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class CellsInARangeOnAnExcelSheetTest < ::Minitest::Test - def test_default - assert_equal(%w[K1 K2 L1 L2], cells_in_range('K1:L2')) - assert_equal(%w[A1 B1 C1 D1 E1 F1], cells_in_range('A1:F1')) + def test_default_one + assert_equal( + %w[K1 K2 L1 L2], + cells_in_range( + 'K1:L2' + ) + ) + end + + def test_default_two + assert_equal( + %w[A1 B1 C1 D1 E1 F1], + cells_in_range( + 'A1:F1' + ) + ) end end diff --git a/test/easy/test_2206_divide_array_into_equal_pairs.rb b/test/easy/test_2206_divide_array_into_equal_pairs.rb index 292f0d63..ea4cb221 100644 --- a/test/easy/test_2206_divide_array_into_equal_pairs.rb +++ b/test/easy/test_2206_divide_array_into_equal_pairs.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DivideArrayIntoEqualPairsTest < ::Minitest::Test - def test_default - assert(divide_array([3, 2, 3, 2, 2, 2])) - assert(!divide_array([1, 2, 3, 4])) - end + def test_default_one = assert(divide_array([3, 2, 3, 2, 2, 2])) + + def test_default_two = assert(!divide_array([1, 2, 3, 4])) end diff --git a/test/easy/test_2210_count_hills_and_valleys_in_an_array.rb b/test/easy/test_2210_count_hills_and_valleys_in_an_array.rb index ce4eda49..b478b183 100644 --- a/test/easy/test_2210_count_hills_and_valleys_in_an_array.rb +++ b/test/easy/test_2210_count_hills_and_valleys_in_an_array.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountHillsAndValleysInAnArrayTest < ::Minitest::Test - def test_default - assert_equal(3, count_hill_valley([2, 4, 1, 1, 6, 5])) - assert_equal(0, count_hill_valley([6, 6, 5, 5, 4, 1])) - end + def test_default_one = assert_equal(3, count_hill_valley([2, 4, 1, 1, 6, 5])) + + def test_default_two = assert_equal(0, count_hill_valley([6, 6, 5, 5, 4, 1])) end diff --git a/test/easy/test_2215_find_the_difference_of_two_arrays.rb b/test/easy/test_2215_find_the_difference_of_two_arrays.rb index 13322212..c5516faa 100644 --- a/test/easy/test_2215_find_the_difference_of_two_arrays.rb +++ b/test/easy/test_2215_find_the_difference_of_two_arrays.rb @@ -5,8 +5,29 @@ require 'minitest/autorun' class FindTheDifferenceOfTwoArraysTest < ::Minitest::Test - def test_default - assert_equal([[1, 3], [4, 6]], find_difference([1, 2, 3], [2, 4, 6])) - assert_equal([[3], []], find_difference([1, 2, 3, 3], [1, 1, 2, 2])) + def test_default_one + assert_equal( + [ + [1, 3], + [4, 6] + ], + find_difference( + [1, 2, 3], + [2, 4, 6] + ) + ) + end + + def test_default_two + assert_equal( + [ + [3], + [] + ], + find_difference( + [1, 2, 3, 3], + [1, 1, 2, 2] + ) + ) end end diff --git a/test/easy/test_2220_minimum_bit_flips_to_convert_number.rb b/test/easy/test_2220_minimum_bit_flips_to_convert_number.rb index 32ad86f7..bb6fabd8 100644 --- a/test/easy/test_2220_minimum_bit_flips_to_convert_number.rb +++ b/test/easy/test_2220_minimum_bit_flips_to_convert_number.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class MinimumBitFlipsToConvertNumberTest < ::Minitest::Test - def test_default - assert_equal(3, min_bit_flips(10, 7)) - assert_equal(3, min_bit_flips(3, 4)) - end + def test_default_one = assert_equal(3, min_bit_flips(10, 7)) + + def test_default_two = assert_equal(3, min_bit_flips(3, 4)) end diff --git a/test/easy/test_2231_largest_number_after_digit_swaps_by_parity.rb b/test/easy/test_2231_largest_number_after_digit_swaps_by_parity.rb index 2954ce09..0c74354b 100644 --- a/test/easy/test_2231_largest_number_after_digit_swaps_by_parity.rb +++ b/test/easy/test_2231_largest_number_after_digit_swaps_by_parity.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class LargestNumberAfterDigitSwapsByParityTest < ::Minitest::Test - def test_default - assert_equal(3412, largest_integer(1234)) - assert_equal(87_655, largest_integer(65_875)) - end + def test_default_one = assert_equal(3412, largest_integer(1234)) + + def test_default_two = assert_equal(87_655, largest_integer(65_875)) end diff --git a/test/easy/test_2235_add_two_integers.rb b/test/easy/test_2235_add_two_integers.rb index 0a036c17..89e9e9ee 100644 --- a/test/easy/test_2235_add_two_integers.rb +++ b/test/easy/test_2235_add_two_integers.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class AddTwoIntegersTest < ::Minitest::Test - def test_default - assert_equal(17, sum(12, 5)) - assert_equal(-6, sum(-10, 4)) - end + def test_default_one = assert_equal(17, sum(12, 5)) + + def test_default_two = assert_equal(-6, sum(-10, 4)) end diff --git a/test/easy/test_2236_root_equals_sum_of_children.rb b/test/easy/test_2236_root_equals_sum_of_children.rb index 1400d54a..0e2ebca1 100644 --- a/test/easy/test_2236_root_equals_sum_of_children.rb +++ b/test/easy/test_2236_root_equals_sum_of_children.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class RootEqualsSumOfChildrenTest < ::Minitest::Test - def test_default + def test_default_one assert( check_tree( ::TreeNode.new( @@ -16,6 +16,9 @@ def test_default ) ) ) + end + + def test_default_two assert( !check_tree( ::TreeNode.new( diff --git a/test/easy/test_2239_find_closest_number_to_zero.rb b/test/easy/test_2239_find_closest_number_to_zero.rb index 8ddf5358..1b3a2c03 100644 --- a/test/easy/test_2239_find_closest_number_to_zero.rb +++ b/test/easy/test_2239_find_closest_number_to_zero.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class FindClosestNumberToZeroTest < ::Minitest::Test - def test_default - assert_equal(1, find_closest_number([-4, -2, 1, 4, 8])) - assert_equal(1, find_closest_number([2, -1, 1])) + def test_default_one + assert_equal( + 1, + find_closest_number( + [-4, -2, 1, 4, 8] + ) + ) + end + + def test_default_two + assert_equal( + 1, + find_closest_number( + [2, -1, 1] + ) + ) end end diff --git a/test/easy/test_2243_calculate_digit_sum_of_a_string.rb b/test/easy/test_2243_calculate_digit_sum_of_a_string.rb index 2a3e8cd5..a30cf04b 100644 --- a/test/easy/test_2243_calculate_digit_sum_of_a_string.rb +++ b/test/easy/test_2243_calculate_digit_sum_of_a_string.rb @@ -1,14 +1,11 @@ -# rubocop:disable Style/FrozenStringLiteralComment, Style/DisableCopsWithinSourceCodeDirective +# frozen_string_literal: true require_relative '../test_helper' require_relative '../../lib/easy/2243_calculate_digit_sum_of_a_string' require 'minitest/autorun' class CalculateDigitSumOfAStringTest < ::Minitest::Test - def test_default - assert_equal('135', digit_sum('11111222223', 3)) - assert_equal('000', digit_sum('00000000', 3)) - end -end + def test_default_one = assert_equal('135', digit_sum('11111222223', 3)) -# rubocop:enable Style/FrozenStringLiteralComment, Style/DisableCopsWithinSourceCodeDirective + def test_default_two = assert_equal('000', digit_sum('00000000', 3)) +end diff --git a/test/easy/test_2248_intersection_of_multiple_arrays.rb b/test/easy/test_2248_intersection_of_multiple_arrays.rb index 29b07acc..f6778fdb 100644 --- a/test/easy/test_2248_intersection_of_multiple_arrays.rb +++ b/test/easy/test_2248_intersection_of_multiple_arrays.rb @@ -5,8 +5,28 @@ require 'minitest/autorun' class IntersectionOfMultipleArraysTest < ::Minitest::Test - def test_default - assert_equal([3, 4], intersection2248([[3, 1, 2, 4, 5], [1, 2, 3, 4], [3, 4, 5, 6]])) - assert_equal([], intersection2248([[1, 2, 3], [4, 5, 6]])) + def test_default_one + assert_equal( + [3, 4], + intersection2248( + [ + [3, 1, 2, 4, 5], + [1, 2, 3, 4], + [3, 4, 5, 6] + ] + ) + ) + end + + def test_default_two + assert_equal( + [], + intersection2248( + [ + [1, 2, 3], + [4, 5, 6] + ] + ) + ) end end diff --git a/test/easy/test_2255_count_prefixes_of_a_given_string.rb b/test/easy/test_2255_count_prefixes_of_a_given_string.rb index 9c1ffc95..6ace8544 100644 --- a/test/easy/test_2255_count_prefixes_of_a_given_string.rb +++ b/test/easy/test_2255_count_prefixes_of_a_given_string.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class CountPrefixesOfAGivenStringTest < ::Minitest::Test - def test_default - assert_equal(3, count_prefixes(%w[a b c ab bc abc], 'abc')) - assert_equal(2, count_prefixes(%w[a a], 'aa')) + def test_default_one + assert_equal( + 3, + count_prefixes( + %w[a b c ab bc abc], + 'abc' + ) + ) + end + + def test_default_two + assert_equal( + 2, + count_prefixes( + %w[a a], + 'aa' + ) + ) end end diff --git a/test/easy/test_2259_remove_digit_from_number_to_maximize_result.rb b/test/easy/test_2259_remove_digit_from_number_to_maximize_result.rb index f55b8835..66a8844d 100644 --- a/test/easy/test_2259_remove_digit_from_number_to_maximize_result.rb +++ b/test/easy/test_2259_remove_digit_from_number_to_maximize_result.rb @@ -1,15 +1,13 @@ -# rubocop:disable Style/FrozenStringLiteralComment, Style/DisableCopsWithinSourceCodeDirective +# frozen_string_literal: true require_relative '../test_helper' require_relative '../../lib/easy/2259_remove_digit_from_number_to_maximize_result' require 'minitest/autorun' class RemoveDigitFromNumberToMaximizeResultTest < ::Minitest::Test - def test_default - assert_equal('12', remove_digit('123', '3')) - assert_equal('231', remove_digit('1231', '1')) - assert_equal('51', remove_digit('551', '5')) - end -end + def test_default_one = assert_equal('12', remove_digit('123', '3')) + + def test_default_two = assert_equal('231', remove_digit('1231', '1')) -# rubocop:enable Style/FrozenStringLiteralComment, Style/DisableCopsWithinSourceCodeDirective + def test_default_three = assert_equal('51', remove_digit('551', '5')) +end diff --git a/test/easy/test_2264_largest_3_same_digit_number_in_string.rb b/test/easy/test_2264_largest_3_same_digit_number_in_string.rb index 34c29e91..e65f1351 100644 --- a/test/easy/test_2264_largest_3_same_digit_number_in_string.rb +++ b/test/easy/test_2264_largest_3_same_digit_number_in_string.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class Largest3SameDigitNumberInStringTest < ::Minitest::Test - def test_default - assert_equal('777', largest_good_integer('6777133339')) - assert_equal('000', largest_good_integer('2300019')) - assert_equal('', largest_good_integer('42352338')) - end + def test_default_one = assert_equal('777', largest_good_integer('6777133339')) + + def test_default_two = assert_equal('000', largest_good_integer('2300019')) + + def test_default_three = assert_equal('', largest_good_integer('42352338')) end diff --git a/test/easy/test_2278_percentage_of_letter_in_string.rb b/test/easy/test_2278_percentage_of_letter_in_string.rb index b9a64ee2..383688f2 100644 --- a/test/easy/test_2278_percentage_of_letter_in_string.rb +++ b/test/easy/test_2278_percentage_of_letter_in_string.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class PercentageOfLetterInStringTest < ::Minitest::Test - def test_default - assert_equal(33, percentage_letter('foobar', 'o')) - assert_equal(0, percentage_letter('jjjj', 'k')) - end + def test_default_one = assert_equal(33, percentage_letter('foobar', 'o')) + + def test_default_two = assert_equal(0, percentage_letter('jjjj', 'k')) end diff --git a/test/easy/test_2283_check_if_number_has_equal_digit_count_and_digit_value.rb b/test/easy/test_2283_check_if_number_has_equal_digit_count_and_digit_value.rb index f25a7c40..1835f0f0 100644 --- a/test/easy/test_2283_check_if_number_has_equal_digit_count_and_digit_value.rb +++ b/test/easy/test_2283_check_if_number_has_equal_digit_count_and_digit_value.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CheckIfNumberHasEqualDigitCountAndDigitValueTest < ::Minitest::Test - def test_default - assert(digit_count('1210')) - assert(!digit_count('030')) - end + def test_default_one = assert(digit_count('1210')) + + def test_default_two = assert(!digit_count('030')) end diff --git a/test/easy/test_2287_rearrange_characters_to_make_target_string.rb b/test/easy/test_2287_rearrange_characters_to_make_target_string.rb index 3cd7cd86..f675e349 100644 --- a/test/easy/test_2287_rearrange_characters_to_make_target_string.rb +++ b/test/easy/test_2287_rearrange_characters_to_make_target_string.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class RearrangeCharactersToMakeTargetStringTest < ::Minitest::Test - def test_default - assert_equal(2, rearrange_characters('ilovecodingonleetcode', 'code')) - assert_equal(1, rearrange_characters('abcba', 'abc')) - assert_equal(1, rearrange_characters('abbaccaddaeea', 'aaaaa')) + def test_default_one + assert_equal( + 2, + rearrange_characters( + 'ilovecodingonleetcode', + 'code' + ) + ) + end + + def test_default_two + assert_equal( + 1, + rearrange_characters( + 'abcba', + 'abc' + ) + ) + end + + def test_default_three + assert_equal( + 1, + rearrange_characters( + 'abbaccaddaeea', + 'aaaaa' + ) + ) end end diff --git a/test/easy/test_2293_min_max_game.rb b/test/easy/test_2293_min_max_game.rb index de08f775..a714277d 100644 --- a/test/easy/test_2293_min_max_game.rb +++ b/test/easy/test_2293_min_max_game.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class MinMaxGameTest < ::Minitest::Test - def test_default - assert_equal(1, min_max_game([1, 3, 5, 2, 4, 8, 2, 2])) - assert_equal(3, min_max_game([3])) + def test_default_one + assert_equal( + 1, + min_max_game( + [1, 3, 5, 2, 4, 8, 2, 2] + ) + ) + end + + def test_default_two + assert_equal( + 3, + min_max_game( + [3] + ) + ) end end diff --git a/test/easy/test_2299_strong_password_checker_ii.rb b/test/easy/test_2299_strong_password_checker_ii.rb index 7dddfb55..689adc03 100644 --- a/test/easy/test_2299_strong_password_checker_ii.rb +++ b/test/easy/test_2299_strong_password_checker_ii.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class StringPasswordCheckerIITest < ::Minitest::Test - def test_default - assert(strong_password_checker_ii('IloveLe3tcode!')) - assert(!strong_password_checker_ii('Me+You--IsMyDream')) - assert(!strong_password_checker_ii('1aB!')) - end + def test_default_one = assert(strong_password_checker_ii('IloveLe3tcode!')) + + def test_default_two = assert(!strong_password_checker_ii('Me+You--IsMyDream')) + + def test_default_three = assert(!strong_password_checker_ii('1aB!')) end diff --git a/test/easy/test_2303_calculate_amount_paid_in_taxes.rb b/test/easy/test_2303_calculate_amount_paid_in_taxes.rb index cf39f937..c7aa2d1b 100644 --- a/test/easy/test_2303_calculate_amount_paid_in_taxes.rb +++ b/test/easy/test_2303_calculate_amount_paid_in_taxes.rb @@ -5,13 +5,55 @@ require 'minitest/autorun' class CalculateAmountPaidInTaxesTest < ::Minitest::Test - def test_default - assert_equal(2.65000, calculate_tax([[3, 50], [7, 10], [12, 25]], 10)) - assert_equal(0.25000, calculate_tax([[1, 0], [4, 25], [5, 50]], 2)) - assert_equal(0.00000, calculate_tax([[2, 50]], 0)) + def test_default_one + assert_equal( + 2.65000, + calculate_tax( + [ + [3, 50], + [7, 10], + [12, 25] + ], + 10 + ) + ) end - def test_additional - assert_equal(0.33000, calculate_tax([[1, 33]], 1)) + def test_default_two + assert_equal( + 0.25000, + calculate_tax( + [ + [1, 0], + [4, 25], + [5, 50] + ], + 2 + ) + ) + end + + def test_default_three + assert_equal( + 0.00000, + calculate_tax( + [ + [2, 50] + ], + 0 + ) + ) + end + + def test_additional_one + assert_equal( + 0.33000, + calculate_tax( + [ + [1, 33] + ], + 1 + ) + ) end end diff --git a/test/easy/test_2309_greatest_english_letter_in_upper_and_lower_case.rb b/test/easy/test_2309_greatest_english_letter_in_upper_and_lower_case.rb index 31fc7a91..71b4757b 100644 --- a/test/easy/test_2309_greatest_english_letter_in_upper_and_lower_case.rb +++ b/test/easy/test_2309_greatest_english_letter_in_upper_and_lower_case.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class GreatestEnglishLetterInUpperAndLowerCaseTest < ::Minitest::Test - def test_default - assert_equal('E', greatest_letter('lEeTcOdE')) - assert_equal('R', greatest_letter('arRAzFif')) - assert_equal('', greatest_letter('AbCdEfGhIjK')) - end + def test_default_one = assert_equal('E', greatest_letter('lEeTcOdE')) + + def test_default_two = assert_equal('R', greatest_letter('arRAzFif')) + + def test_default_three = assert_equal('', greatest_letter('AbCdEfGhIjK')) end diff --git a/test/easy/test_2315_count_asterisks.rb b/test/easy/test_2315_count_asterisks.rb index 04c78287..8b197338 100644 --- a/test/easy/test_2315_count_asterisks.rb +++ b/test/easy/test_2315_count_asterisks.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CountAsterisksTest < ::Minitest::Test - def test_default - assert_equal(2, count_asterisks('l|*e*et|c**o|*de|')) - assert_equal(0, count_asterisks('iamprogrammer')) - assert_equal(5, count_asterisks('yo|uar|e**|b|e***au|tifu|l')) - end + def test_default_one = assert_equal(2, count_asterisks('l|*e*et|c**o|*de|')) + + def test_default_two = assert_equal(0, count_asterisks('iamprogrammer')) + + def test_default_three = assert_equal(5, count_asterisks('yo|uar|e**|b|e***au|tifu|l')) end diff --git a/test/easy/test_2319_check_if_matrix_is_x_matrix.rb b/test/easy/test_2319_check_if_matrix_is_x_matrix.rb index e5c54abf..f265a389 100644 --- a/test/easy/test_2319_check_if_matrix_is_x_matrix.rb +++ b/test/easy/test_2319_check_if_matrix_is_x_matrix.rb @@ -5,8 +5,28 @@ require 'minitest/autorun' class CheckIfMatrixIsXMatrixTest < ::Minitest::Test - def test_default - assert(check_x_matrix([[2, 0, 0, 1], [0, 3, 1, 0], [0, 5, 2, 0], [4, 0, 0, 2]])) - assert(!check_x_matrix([[5, 7, 0], [0, 3, 1], [0, 5, 0]])) + def test_default_one + assert( + check_x_matrix( + [ + [2, 0, 0, 1], + [0, 3, 1, 0], + [0, 5, 2, 0], + [4, 0, 0, 2] + ] + ) + ) + end + + def test_default_two + assert( + !check_x_matrix( + [ + [5, 7, 0], + [0, 3, 1], + [0, 5, 0] + ] + ) + ) end end diff --git a/test/easy/test_2325_decode_the_message.rb b/test/easy/test_2325_decode_the_message.rb index 015f5595..8c23436b 100644 --- a/test/easy/test_2325_decode_the_message.rb +++ b/test/easy/test_2325_decode_the_message.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class DecodeTheMessageTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 'this is a secret', decode_message( @@ -13,6 +13,9 @@ def test_default 'vkbs bs t suepuv' ) ) + end + + def test_default_two assert_equal( 'the five boxing wizards jump quickly', decode_message( diff --git a/test/easy/test_2331_evaluate_boolean_binary_tree.rb b/test/easy/test_2331_evaluate_boolean_binary_tree.rb index 69425a17..b121db55 100644 --- a/test/easy/test_2331_evaluate_boolean_binary_tree.rb +++ b/test/easy/test_2331_evaluate_boolean_binary_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class EvaluateBooleanBinaryTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( evaluate_tree( ::TreeNode.new( @@ -27,7 +27,15 @@ def test_default ) end - def test_additional + def test_default_two + assert( + !evaluate_tree( + ::TreeNode.new(0) + ) + ) + end + + def test_additional_one assert( !evaluate_tree( ::TreeNode.new( diff --git a/test/easy/test_2335_minimum_amount_of_time_to_fill_cups.rb b/test/easy/test_2335_minimum_amount_of_time_to_fill_cups.rb index dfe81aef..03166440 100644 --- a/test/easy/test_2335_minimum_amount_of_time_to_fill_cups.rb +++ b/test/easy/test_2335_minimum_amount_of_time_to_fill_cups.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MinimumAmountOfTimeToFillCupsTest < ::Minitest::Test - def test_default - assert_equal(4, fill_cups([1, 4, 2])) - assert_equal(7, fill_cups([5, 4, 4])) - assert_equal(5, fill_cups([5, 0, 0])) - end + def test_default_one = assert_equal(4, fill_cups([1, 4, 2])) + + def test_default_two = assert_equal(7, fill_cups([5, 4, 4])) + + def test_default_three = assert_equal(5, fill_cups([5, 0, 0])) end diff --git a/test/easy/test_2341_maximum_number_of_pairs_in_array.rb b/test/easy/test_2341_maximum_number_of_pairs_in_array.rb index 00d4042b..67708ef3 100644 --- a/test/easy/test_2341_maximum_number_of_pairs_in_array.rb +++ b/test/easy/test_2341_maximum_number_of_pairs_in_array.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumNumberOfPairsInArrayTest < ::Minitest::Test - def test_default - assert_equal([3, 1], number_of_pairs([1, 3, 2, 1, 3, 2, 2])) - assert_equal([1, 0], number_of_pairs([1, 1])) - assert_equal([0, 1], number_of_pairs([0])) - end + def test_default_one = assert_equal([3, 1], number_of_pairs([1, 3, 2, 1, 3, 2, 2])) + + def test_default_two = assert_equal([1, 0], number_of_pairs([1, 1])) + + def test_default_three = assert_equal([0, 1], number_of_pairs([0])) end diff --git a/test/easy/test_2347_best_poker_hand.rb b/test/easy/test_2347_best_poker_hand.rb index 6c402dab..85266b07 100644 --- a/test/easy/test_2347_best_poker_hand.rb +++ b/test/easy/test_2347_best_poker_hand.rb @@ -5,13 +5,43 @@ require 'minitest/autorun' class BestPokerHandTest < ::Minitest::Test - def test_default - assert_equal('Flush', best_hand([13, 2, 3, 1, 9], %w[a a a a a])) - assert_equal('Three of a Kind', best_hand([4, 4, 2, 4, 4], %w[d a a b c])) - assert_equal('Pair', best_hand([10, 10, 2, 12, 9], %w[a b c a d])) + def test_default_one + assert_equal( + 'Flush', + best_hand( + [13, 2, 3, 1, 9], + %w[a a a a a] + ) + ) end - def test_additional - assert_equal('High Card', best_hand([13, 2], %w[a b])) + def test_default_two + assert_equal( + 'Three of a Kind', + best_hand( + [4, 4, 2, 4, 4], + %w[d a a b c] + ) + ) + end + + def test_default_three + assert_equal( + 'Pair', + best_hand( + [10, 10, 2, 12, 9], + %w[a b c a d] + ) + ) + end + + def test_additional_one + assert_equal( + 'High Card', + best_hand( + [13, 2], + %w[a b] + ) + ) end end diff --git a/test/easy/test_2351_first_letter_to_appear_twice.rb b/test/easy/test_2351_first_letter_to_appear_twice.rb index 08ff32ce..5fdd8b37 100644 --- a/test/easy/test_2351_first_letter_to_appear_twice.rb +++ b/test/easy/test_2351_first_letter_to_appear_twice.rb @@ -5,12 +5,9 @@ require 'minitest/autorun' class FirstLetterToAppearTwiceTest < ::Minitest::Test - def test_default - assert_equal('c', repeated_character('abccbaacz')) - assert_equal('d', repeated_character('abcdd')) - end + def test_default_one = assert_equal('c', repeated_character('abccbaacz')) - def test_additional - assert_equal('0', repeated_character('abc')) - end + def test_default_two = assert_equal('d', repeated_character('abcdd')) + + def test_additional_one = assert_equal('0', repeated_character('abc')) end diff --git a/test/easy/test_2357_make_array_zero_by_subtracting_equal_amounts.rb b/test/easy/test_2357_make_array_zero_by_subtracting_equal_amounts.rb index 740b0215..568b7efa 100644 --- a/test/easy/test_2357_make_array_zero_by_subtracting_equal_amounts.rb +++ b/test/easy/test_2357_make_array_zero_by_subtracting_equal_amounts.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class MakeArrayZeroBySubtractingEqualAmountsTest < ::Minitest::Test - def test_default - assert_equal(3, minimum_operations([1, 5, 0, 3, 5])) - assert_equal(0, minimum_operations([0])) - end + def test_default_one = assert_equal(3, minimum_operations([1, 5, 0, 3, 5])) + + def test_default_two = assert_equal(0, minimum_operations([0])) end diff --git a/test/easy/test_2363_merge_similar_items.rb b/test/easy/test_2363_merge_similar_items.rb index 2bca41df..7b6f0ec2 100644 --- a/test/easy/test_2363_merge_similar_items.rb +++ b/test/easy/test_2363_merge_similar_items.rb @@ -5,26 +5,66 @@ require 'minitest/autorun' class MergeSimilarItemsTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [[1, 6], [3, 9], [4, 5]], + [ + [1, 6], + [3, 9], + [4, 5] + ], merge_similar_items( - [[1, 1], [4, 5], [3, 8]], - [[3, 1], [1, 5]] + [ + [1, 1], + [4, 5], + [3, 8] + ], + [ + [3, 1], + [1, 5] + ] ) ) + end + + def test_default_two assert_equal( - [[1, 4], [2, 4], [3, 4]], + [ + [1, 4], + [2, 4], + [3, 4] + ], merge_similar_items( - [[1, 1], [3, 2], [2, 3]], - [[2, 1], [3, 2], [1, 3]] + [ + [1, 1], + [3, 2], + [2, 3] + ], + [ + [2, 1], + [3, 2], + [1, 3] + ] ) ) + end + + def test_default_three assert_equal( - [[1, 7], [2, 4], [7, 1]], + [ + [1, 7], + [2, 4], + [7, 1] + ], merge_similar_items( - [[1, 3], [2, 2]], - [[7, 1], [2, 2], [1, 4]] + [ + [1, 3], + [2, 2] + ], + [ + [7, 1], + [2, 2], + [1, 4] + ] ) ) end diff --git a/test/easy/test_2367_number_of_arithmetic_triplets.rb b/test/easy/test_2367_number_of_arithmetic_triplets.rb index 32e959c5..06b11b1f 100644 --- a/test/easy/test_2367_number_of_arithmetic_triplets.rb +++ b/test/easy/test_2367_number_of_arithmetic_triplets.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class NumberOfArithmeticTripletsTest < ::Minitest::Test - def test_default - assert_equal(2, arithmetic_triplets([0, 1, 4, 6, 7, 10], 3)) - assert_equal(2, arithmetic_triplets([4, 5, 6, 7, 8, 9], 2)) + def test_default_one + assert_equal( + 2, + arithmetic_triplets( + [0, 1, 4, 6, 7, 10], + 3 + ) + ) + end + + def test_default_two + assert_equal( + 2, + arithmetic_triplets( + [4, 5, 6, 7, 8, 9], + 2 + ) + ) end end diff --git a/test/easy/test_2373_largest_local_values_in_a_matrix.rb b/test/easy/test_2373_largest_local_values_in_a_matrix.rb index 7175e139..7d10e6c2 100644 --- a/test/easy/test_2373_largest_local_values_in_a_matrix.rb +++ b/test/easy/test_2373_largest_local_values_in_a_matrix.rb @@ -5,9 +5,12 @@ require 'minitest/autorun' class LargestLocalValuesInAMatrixTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [[9, 9], [8, 6]], + [ + [9, 9], + [8, 6] + ], largest_local( [ [9, 9, 8, 1], @@ -17,8 +20,15 @@ def test_default ] ) ) + end + + def test_default_two assert_equal( - [[2, 2, 2], [2, 2, 2], [2, 2, 2]], + [ + [2, 2, 2], + [2, 2, 2], + [2, 2, 2] + ], largest_local( [ [1, 1, 1, 1, 1], diff --git a/test/easy/test_2379_minimum_recolors_to_get_k_consecutive_black_blocks.rb b/test/easy/test_2379_minimum_recolors_to_get_k_consecutive_black_blocks.rb index 0b0c1d79..0c20ef58 100644 --- a/test/easy/test_2379_minimum_recolors_to_get_k_consecutive_black_blocks.rb +++ b/test/easy/test_2379_minimum_recolors_to_get_k_consecutive_black_blocks.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class MinimumRecolorsToGetKConsecutiveBlackBlocksTest < ::Minitest::Test - def test_default - assert_equal(3, minimum_recolors('WBBWWBBWBW', 7)) - assert_equal(0, minimum_recolors('WBWBBBW', 2)) - end + def test_default_one = assert_equal(3, minimum_recolors('WBBWWBBWBW', 7)) + + def test_default_two = assert_equal(0, minimum_recolors('WBWBBBW', 2)) end diff --git a/test/easy/test_2383_minimum_hours_of_training_to_win_a_competition.rb b/test/easy/test_2383_minimum_hours_of_training_to_win_a_competition.rb index 48a281b8..c991a051 100644 --- a/test/easy/test_2383_minimum_hours_of_training_to_win_a_competition.rb +++ b/test/easy/test_2383_minimum_hours_of_training_to_win_a_competition.rb @@ -5,8 +5,27 @@ require 'minitest/autorun' class MinimumHoursOfTrainingToWinACompetitionTest < ::Minitest::Test - def test_default - assert_equal(8, min_number_of_hours(5, 3, [1, 4, 3, 2], [2, 6, 3, 1])) - assert_equal(0, min_number_of_hours(2, 4, [1], [3])) + def test_default_one + assert_equal( + 8, + min_number_of_hours( + 5, + 3, + [1, 4, 3, 2], + [2, 6, 3, 1] + ) + ) + end + + def test_default_two + assert_equal( + 0, + min_number_of_hours( + 2, + 4, + [1], + [3] + ) + ) end end diff --git a/test/easy/test_2389_longest_subsequence_with_limited_sum.rb b/test/easy/test_2389_longest_subsequence_with_limited_sum.rb index 69b23ad9..fc94a48a 100644 --- a/test/easy/test_2389_longest_subsequence_with_limited_sum.rb +++ b/test/easy/test_2389_longest_subsequence_with_limited_sum.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class LongestSubsequenceWithLimitedSumTest < ::Minitest::Test - def test_default - assert_equal([2, 3, 4], answer_queries([4, 5, 2, 1], [3, 10, 21])) - assert_equal([0], answer_queries([2, 3, 4, 5], [1])) + def test_default_one + assert_equal( + [2, 3, 4], + answer_queries( + [4, 5, 2, 1], + [3, 10, 21] + ) + ) + end + + def test_default_two + assert_equal( + [0], + answer_queries( + [2, 3, 4, 5], + [1] + ) + ) end end diff --git a/test/easy/test_2395_find_subarrays_with_equal_sum.rb b/test/easy/test_2395_find_subarrays_with_equal_sum.rb index d0e88e4c..12cb7ba7 100644 --- a/test/easy/test_2395_find_subarrays_with_equal_sum.rb +++ b/test/easy/test_2395_find_subarrays_with_equal_sum.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FindSubarraysWithEqualSumTest < ::Minitest::Test - def test_default - assert(find_subarrays([4, 2, 4])) - assert(!find_subarrays([1, 2, 3, 4, 5])) - assert(find_subarrays([0, 0, 0])) - end + def test_default_one = assert(find_subarrays([4, 2, 4])) + + def test_default_two = assert(!find_subarrays([1, 2, 3, 4, 5])) + + def test_default_three = assert(find_subarrays([0, 0, 0])) end diff --git a/test/easy/test_2399_check_distances_between_same_letters.rb b/test/easy/test_2399_check_distances_between_same_letters.rb index 978b0ca7..6e84c85c 100644 --- a/test/easy/test_2399_check_distances_between_same_letters.rb +++ b/test/easy/test_2399_check_distances_between_same_letters.rb @@ -5,13 +5,16 @@ require 'minitest/autorun' class CheckDistancesBetweenSameLettersTest < ::Minitest::Test - def test_default + def test_default_one assert( check_distances( 'abaccb', [1, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ) ) + end + + def test_default_two assert( !check_distances( 'aa', diff --git a/test/easy/test_2404_most_frequent_even_element.rb b/test/easy/test_2404_most_frequent_even_element.rb index 375f47d4..8fe24c0e 100644 --- a/test/easy/test_2404_most_frequent_even_element.rb +++ b/test/easy/test_2404_most_frequent_even_element.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class MostFrequentEvenElementTest < ::Minitest::Test - def test_default - assert_equal(2, most_frequent_even([0, 1, 2, 2, 4, 4, 1])) - assert_equal(4, most_frequent_even([4, 4, 4, 9, 2, 4])) - assert_equal(-1, most_frequent_even([29, 47, 21, 41, 13, 37, 25, 7])) + def test_default_one + assert_equal( + 2, + most_frequent_even( + [0, 1, 2, 2, 4, 4, 1] + ) + ) + end + + def test_default_two + assert_equal( + 4, + most_frequent_even( + [4, 4, 4, 9, 2, 4] + ) + ) + end + + def test_default_three + assert_equal( + -1, + most_frequent_even( + [29, 47, 21, 41, 13, 37, 25, 7] + ) + ) end end diff --git a/test/easy/test_2413_smallest_even_multiple.rb b/test/easy/test_2413_smallest_even_multiple.rb index 8e1e2f0f..7eac25de 100644 --- a/test/easy/test_2413_smallest_even_multiple.rb +++ b/test/easy/test_2413_smallest_even_multiple.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class SmallestEvenMultipleTest < ::Minitest::Test - def test_default - assert_equal(10, smallest_even_multiple(5)) - assert_equal(6, smallest_even_multiple(6)) - end + def test_default_one = assert_equal(10, smallest_even_multiple(5)) + + def test_default_two = assert_equal(6, smallest_even_multiple(6)) end diff --git a/test/easy/test_2418_sort_the_people.rb b/test/easy/test_2418_sort_the_people.rb index 9d69fe8c..d289c873 100644 --- a/test/easy/test_2418_sort_the_people.rb +++ b/test/easy/test_2418_sort_the_people.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class SortThePeopleTest < ::Minitest::Test - def test_default - assert_equal(%w[Mary Emma John], sort_people(%w[Mary John Emma], [180, 165, 170])) - assert_equal(%w[Bob Alice Bob], sort_people(%w[Alice Bob Bob], [155, 185, 150])) + def test_default_one + assert_equal( + %w[Mary Emma John], + sort_people( + %w[Mary John Emma], + [180, 165, 170] + ) + ) + end + + def test_default_two + assert_equal( + %w[Bob Alice Bob], + sort_people( + %w[Alice Bob Bob], + [155, 185, 150] + ) + ) end end diff --git a/test/easy/test_2423_remove_letter_to_equalize_frequency.rb b/test/easy/test_2423_remove_letter_to_equalize_frequency.rb index b2564357..fb212971 100644 --- a/test/easy/test_2423_remove_letter_to_equalize_frequency.rb +++ b/test/easy/test_2423_remove_letter_to_equalize_frequency.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class RemoveLetterToEqualizeFrequencyTest < ::Minitest::Test - def test_default - assert(equal_frequency('abcc')) - assert(!equal_frequency('aazz')) - end + def test_default_one = assert(equal_frequency('abcc')) + + def test_default_two = assert(!equal_frequency('aazz')) end diff --git a/test/easy/test_2427_number_of_common_factors.rb b/test/easy/test_2427_number_of_common_factors.rb index 35db2c2e..2524ffce 100644 --- a/test/easy/test_2427_number_of_common_factors.rb +++ b/test/easy/test_2427_number_of_common_factors.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class NumberOfCommonFactorsTest < ::Minitest::Test - def test_default - assert_equal(4, common_factors(12, 6)) - assert_equal(2, common_factors(25, 30)) - end + def test_default_one = assert_equal(4, common_factors(12, 6)) + + def test_default_two = assert_equal(2, common_factors(25, 30)) end diff --git a/test/easy/test_2432_the_employee_that_worked_on_the_longest_task.rb b/test/easy/test_2432_the_employee_that_worked_on_the_longest_task.rb index d85d16a4..2d3a6001 100644 --- a/test/easy/test_2432_the_employee_that_worked_on_the_longest_task.rb +++ b/test/easy/test_2432_the_employee_that_worked_on_the_longest_task.rb @@ -5,8 +5,33 @@ require 'minitest/autorun' class TheEmployeeThatWorkedOnTheLongestTaskTest < ::Minitest::Test - def test_default - assert_equal(1, hardest_worker(10, [[0, 3], [2, 5], [0, 9], [1, 15]])) - assert_equal(3, hardest_worker(26, [[1, 1], [3, 7], [2, 12], [7, 17]])) + def test_default_one + assert_equal( + 1, + hardest_worker( + 10, + [ + [0, 3], + [2, 5], + [0, 9], + [1, 15] + ] + ) + ) + end + + def test_default_two + assert_equal( + 3, + hardest_worker( + 26, + [ + [1, 1], + [3, 7], + [2, 12], + [7, 17] + ] + ) + ) end end diff --git a/test/easy/test_2441_largest_positive_integer_that_exists_with_its_negative.rb b/test/easy/test_2441_largest_positive_integer_that_exists_with_its_negative.rb index 5c81bfbe..1f61c612 100644 --- a/test/easy/test_2441_largest_positive_integer_that_exists_with_its_negative.rb +++ b/test/easy/test_2441_largest_positive_integer_that_exists_with_its_negative.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class LargestPositiveIntegerThatExistsWithItsNegativeTest < ::Minitest::Test - def test_default - assert_equal(3, find_max_k([-1, 2, -3, 3])) - assert_equal(7, find_max_k([-1, 10, 6, 7, -7, 1])) - assert_equal(-1, find_max_k([-10, 8, 6, 7, -2, -3])) + def test_default_one + assert_equal( + 3, + find_max_k( + [-1, 2, -3, 3] + ) + ) + end + + def test_default_two + assert_equal( + 7, + find_max_k( + [-1, 10, 6, 7, -7, 1] + ) + ) + end + + def test_default_three + assert_equal( + -1, + find_max_k( + [-10, 8, 6, 7, -2, -3] + ) + ) end end diff --git a/test/easy/test_2446_determine_if_two_events_have_conflict.rb b/test/easy/test_2446_determine_if_two_events_have_conflict.rb index 4ca459a0..2851e4c9 100644 --- a/test/easy/test_2446_determine_if_two_events_have_conflict.rb +++ b/test/easy/test_2446_determine_if_two_events_have_conflict.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class DetermineIfTwoEventsHaveConflictTest < ::Minitest::Test - def test_default - assert(have_conflict(%w[01:15 02:00], %w[02:00 03:00])) - assert(have_conflict(%w[01:00 02:00], %w[01:20 03:00])) - assert(!have_conflict(%w[10:00 11:00], %w[14:00 15:00])) + def test_default_one + assert( + have_conflict( + %w[01:15 02:00], + %w[02:00 03:00] + ) + ) + end + + def test_default_two + assert( + have_conflict( + %w[01:00 02:00], + %w[01:20 03:00] + ) + ) + end + + def test_default_three + assert( + !have_conflict( + %w[10:00 11:00], + %w[14:00 15:00] + ) + ) end end diff --git a/test/easy/test_2455_average_value_of_even_numbers_that_are_divisible_by_three.rb b/test/easy/test_2455_average_value_of_even_numbers_that_are_divisible_by_three.rb index 704ad647..af153fb0 100644 --- a/test/easy/test_2455_average_value_of_even_numbers_that_are_divisible_by_three.rb +++ b/test/easy/test_2455_average_value_of_even_numbers_that_are_divisible_by_three.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class AverageValueOfEvenNumbersThatAreDivisibleByThreeTest < ::Minitest::Test - def test_default - assert_equal(9, average_value([1, 3, 6, 10, 12, 15])) - assert_equal(0, average_value([1, 2, 4, 7, 10])) - end + def test_default_one = assert_equal(9, average_value([1, 3, 6, 10, 12, 15])) + + def test_default_two = assert_equal(0, average_value([1, 2, 4, 7, 10])) end diff --git a/test/easy/test_2460_apply_operations_to_an_array.rb b/test/easy/test_2460_apply_operations_to_an_array.rb index 0aebcc8c..de88a7ea 100644 --- a/test/easy/test_2460_apply_operations_to_an_array.rb +++ b/test/easy/test_2460_apply_operations_to_an_array.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class ApplyOperationsToAnArrayTest < ::Minitest::Test - def test_default - assert_equal([1, 4, 2, 0, 0, 0], apply_operations([1, 2, 2, 1, 1, 0])) - assert_equal([1, 0], apply_operations([0, 1])) + def test_default_one + assert_equal( + [1, 4, 2, 0, 0, 0], + apply_operations( + [1, 2, 2, 1, 1, 0] + ) + ) + end + + def test_default_two + assert_equal( + [1, 0], + apply_operations( + [0, 1] + ) + ) end end diff --git a/test/easy/test_2469_convert_the_temperature.rb b/test/easy/test_2469_convert_the_temperature.rb index 108beeb8..6a803b8c 100644 --- a/test/easy/test_2469_convert_the_temperature.rb +++ b/test/easy/test_2469_convert_the_temperature.rb @@ -5,8 +5,27 @@ require 'minitest/autorun' class ConvertTheTemperatureTest < ::Minitest::Test - def test_default - assert_equal([309.65000, 97.70000], convert_temperature(36.50)) - assert_equal([395.26000, 251.79800], convert_temperature(122.11)) + def test_default_one + assert_equal( + [ + 309.65000, + 97.70000 + ], + convert_temperature( + 36.50 + ) + ) + end + + def test_default_two + assert_equal( + [ + 395.26000, + 251.79800 + ], + convert_temperature( + 122.11 + ) + ) end end diff --git a/test/easy/test_2475_number_of_unequal_triplets_in_array.rb b/test/easy/test_2475_number_of_unequal_triplets_in_array.rb index 06b6c0a8..c4bda06c 100644 --- a/test/easy/test_2475_number_of_unequal_triplets_in_array.rb +++ b/test/easy/test_2475_number_of_unequal_triplets_in_array.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class NumberOfUnequalTripletsInArrayTest < ::Minitest::Test - def test_default - assert_equal(3, unequal_triplets([4, 4, 2, 4, 3])) - assert_equal(0, unequal_triplets([1, 1, 1, 1, 1])) - end + def test_default_one = assert_equal(3, unequal_triplets([4, 4, 2, 4, 3])) + + def test_default_two = assert_equal(0, unequal_triplets([1, 1, 1, 1, 1])) end diff --git a/test/easy/test_2481_minimum_cuts_to_divide_a_circle.rb b/test/easy/test_2481_minimum_cuts_to_divide_a_circle.rb index 52232a3d..4d86624f 100644 --- a/test/easy/test_2481_minimum_cuts_to_divide_a_circle.rb +++ b/test/easy/test_2481_minimum_cuts_to_divide_a_circle.rb @@ -5,12 +5,9 @@ require 'minitest/autorun' class MinimumCutsToDivideACircleTest < ::Minitest::Test - def test_default - assert_equal(2, number_of_cuts(4)) - assert_equal(3, number_of_cuts(3)) - end + def test_default_one = assert_equal(2, number_of_cuts(4)) - def test_additional - assert_equal(0, number_of_cuts(0)) - end + def test_default_two = assert_equal(3, number_of_cuts(3)) + + def test_additional_one = assert_equal(0, number_of_cuts(0)) end diff --git a/test/easy/test_2485_find_the_pivot_integer.rb b/test/easy/test_2485_find_the_pivot_integer.rb index 08cc5c10..ea25159a 100644 --- a/test/easy/test_2485_find_the_pivot_integer.rb +++ b/test/easy/test_2485_find_the_pivot_integer.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class FindThePivotIntegerTest < ::Minitest::Test - def test_default - assert_equal(6, pivot_integer(8)) - assert_equal(1, pivot_integer(1)) - assert_equal(-1, pivot_integer(4)) - end + def test_default_one = assert_equal(6, pivot_integer(8)) + + def test_default_two = assert_equal(1, pivot_integer(1)) + + def test_default_three = assert_equal(-1, pivot_integer(4)) end diff --git a/test/easy/test_2490_circular_sentence.rb b/test/easy/test_2490_circular_sentence.rb index a10ac425..25ea06dd 100644 --- a/test/easy/test_2490_circular_sentence.rb +++ b/test/easy/test_2490_circular_sentence.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CircularSentenceTest < ::Minitest::Test - def test_default - assert(is_circular_sentence('leetcode exercises sound delightful')) - assert(is_circular_sentence('eetcode')) - assert(!is_circular_sentence('Leetcode is cool')) - end + def test_default_one = assert(is_circular_sentence('leetcode exercises sound delightful')) + + def test_default_two = assert(is_circular_sentence('eetcode')) + + def test_default_three = assert(!is_circular_sentence('Leetcode is cool')) end diff --git a/test/easy/test_2496_maximum_value_of_a_string_in_an_array.rb b/test/easy/test_2496_maximum_value_of_a_string_in_an_array.rb index ec7e4623..e3b6814a 100644 --- a/test/easy/test_2496_maximum_value_of_a_string_in_an_array.rb +++ b/test/easy/test_2496_maximum_value_of_a_string_in_an_array.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class MaximumValueOfAStringInAnArrayTest < ::Minitest::Test - def test_default - assert_equal(5, maximum_value(%w[alic3 bob 3 4 00000])) - assert_equal(1, maximum_value(%w[1 01 001 0001])) + def test_default_one + assert_equal( + 5, + maximum_value( + %w[alic3 bob 3 4 00000] + ) + ) + end + + def test_default_two + assert_equal( + 1, + maximum_value( + %w[1 01 001 0001] + ) + ) end end diff --git a/test/easy/test_2500_delete_greatest_value_in_each_row.rb b/test/easy/test_2500_delete_greatest_value_in_each_row.rb index 14cf53e9..b4f2f7d7 100644 --- a/test/easy/test_2500_delete_greatest_value_in_each_row.rb +++ b/test/easy/test_2500_delete_greatest_value_in_each_row.rb @@ -5,8 +5,26 @@ require 'minitest/autorun' class DeleteGreatestValueInEachRowTest < ::Minitest::Test - def test_default - assert_equal(8, delete_greatest_value([[1, 2, 4], [3, 3, 1]])) - assert_equal(10, delete_greatest_value([[10]])) + def test_default_one + assert_equal( + 8, + delete_greatest_value( + [ + [1, 2, 4], + [3, 3, 1] + ] + ) + ) + end + + def test_default_two + assert_equal( + 10, + delete_greatest_value( + [ + [10] + ] + ) + ) end end diff --git a/test/easy/test_2506_count_pairs_of_similar_strings.rb b/test/easy/test_2506_count_pairs_of_similar_strings.rb index 1bfea4ed..9d1004af 100644 --- a/test/easy/test_2506_count_pairs_of_similar_strings.rb +++ b/test/easy/test_2506_count_pairs_of_similar_strings.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class CountPairsOfSimilarStringsTest < ::Minitest::Test - def test_default - assert_equal(2, similar_pairs(%w[aba aabb abcd bac aabc])) - assert_equal(3, similar_pairs(%w[aabb ab ba])) - assert_equal(0, similar_pairs(%w[nba cba dba])) + def test_default_one + assert_equal( + 2, + similar_pairs( + %w[aba aabb abcd bac aabc] + ) + ) + end + + def test_default_two + assert_equal( + 3, + similar_pairs( + %w[aabb ab ba] + ) + ) + end + + def test_default_three + assert_equal( + 0, + similar_pairs( + %w[nba cba dba] + ) + ) end end diff --git a/test/easy/test_2511_maximum_enemy_forts_that_can_be_captured.rb b/test/easy/test_2511_maximum_enemy_forts_that_can_be_captured.rb index f265e11e..7a05d84f 100644 --- a/test/easy/test_2511_maximum_enemy_forts_that_can_be_captured.rb +++ b/test/easy/test_2511_maximum_enemy_forts_that_can_be_captured.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class MaximumEnemyFortsThatCanBeCapturedTest < ::Minitest::Test - def test_default - assert_equal(4, capture_forts([1, 0, 0, -1, 0, 0, 0, 0, 1])) - assert_equal(0, capture_forts([0, 0, 1, -1])) + def test_default_one + assert_equal( + 4, + capture_forts( + [1, 0, 0, -1, 0, 0, 0, 0, 1] + ) + ) + end + + def test_default_two + assert_equal( + 0, + capture_forts( + [0, 0, 1, -1] + ) + ) end end diff --git a/test/easy/test_2515_shortest_distance_to_target_string_in_a_circular_array.rb b/test/easy/test_2515_shortest_distance_to_target_string_in_a_circular_array.rb index b92c2207..c57991cc 100644 --- a/test/easy/test_2515_shortest_distance_to_target_string_in_a_circular_array.rb +++ b/test/easy/test_2515_shortest_distance_to_target_string_in_a_circular_array.rb @@ -5,9 +5,36 @@ require 'minitest/autorun' class ShortestDistanceToTargetStringInACircularArrayTest < ::Minitest::Test - def test_default - assert_equal(1, closet_target(%w[hello i am leetcode hello], 'hello', 1)) - assert_equal(1, closet_target(%w[a b leetcode], 'leetcode', 0)) - assert_equal(-1, closet_target(%w[i eat leetcode], 'ate', 0)) + def test_default_one + assert_equal( + 1, + closet_target( + %w[hello i am leetcode hello], + 'hello', + 1 + ) + ) + end + + def test_default_two + assert_equal( + 1, + closet_target( + %w[a b leetcode], + 'leetcode', + 0 + ) + ) + end + + def test_default_three + assert_equal( + -1, + closet_target( + %w[i eat leetcode], + 'ate', + 0 + ) + ) end end diff --git a/test/easy/test_2520_count_the_digits_that_divide_a_number.rb b/test/easy/test_2520_count_the_digits_that_divide_a_number.rb index 3c0d3792..901d82b5 100644 --- a/test/easy/test_2520_count_the_digits_that_divide_a_number.rb +++ b/test/easy/test_2520_count_the_digits_that_divide_a_number.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class CountTheDigitsThatDivideANumberTest < ::Minitest::Test - def test_default - assert_equal(1, count_digits(7)) - assert_equal(2, count_digits(121)) - assert_equal(4, count_digits(1248)) - end + def test_default_one = assert_equal(1, count_digits(7)) + + def test_default_two = assert_equal(2, count_digits(121)) + + def test_default_three = assert_equal(4, count_digits(1248)) end diff --git a/test/easy/test_2525_categorize_box_according_to_criteria.rb b/test/easy/test_2525_categorize_box_according_to_criteria.rb index 3bc8644b..32383e86 100644 --- a/test/easy/test_2525_categorize_box_according_to_criteria.rb +++ b/test/easy/test_2525_categorize_box_according_to_criteria.rb @@ -5,13 +5,51 @@ require 'minitest/autorun' class CategorizeBoxAccordingToCriteriaTest < ::Minitest::Test - def test_default - assert_equal('Heavy', categorize_box(1000, 35, 700, 300)) - assert_equal('Neither', categorize_box(200, 50, 800, 50)) + def test_default_one + assert_equal( + 'Heavy', + categorize_box( + 1000, + 35, + 700, + 300 + ) + ) end - def test_additional - assert_equal('Both', categorize_box(2909, 3968, 3272, 727)) - assert_equal('Bulky', categorize_box(92_487, 6200, 58_423, 40)) + def test_default_two + assert_equal( + 'Neither', + categorize_box( + 200, + 50, + 800, + 50 + ) + ) + end + + def test_additional_one + assert_equal( + 'Both', + categorize_box( + 2909, + 3968, + 3272, + 727 + ) + ) + end + + def test_additional_two + assert_equal( + 'Bulky', + categorize_box( + 92_487, + 6200, + 58_423, + 40 + ) + ) end end diff --git a/test/easy/test_2529_maximum_count_of_positive_integer_and_negative_integer.rb b/test/easy/test_2529_maximum_count_of_positive_integer_and_negative_integer.rb index e1baa4a2..6523cf09 100644 --- a/test/easy/test_2529_maximum_count_of_positive_integer_and_negative_integer.rb +++ b/test/easy/test_2529_maximum_count_of_positive_integer_and_negative_integer.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class MaximumCountOfPositiveIntegerAndNegativeIntegerTest < ::Minitest::Test - def test_default - assert_equal(3, maximum_count([-2, -1, -1, 1, 2, 3])) - assert_equal(3, maximum_count([-3, -2, -1, 0, 0, 1, 2])) - assert_equal(4, maximum_count([5, 20, 66, 1314])) - end + def test_default_one = assert_equal(3, maximum_count([-2, -1, -1, 1, 2, 3])) + + def test_default_two = assert_equal(3, maximum_count([-3, -2, -1, 0, 0, 1, 2])) + + def test_default_three = assert_equal(4, maximum_count([5, 20, 66, 1314])) end diff --git a/test/easy/test_2535_difference_between_element_sum_and_digit_sum_of_an_array.rb b/test/easy/test_2535_difference_between_element_sum_and_digit_sum_of_an_array.rb index 36927179..dbbdddb0 100644 --- a/test/easy/test_2535_difference_between_element_sum_and_digit_sum_of_an_array.rb +++ b/test/easy/test_2535_difference_between_element_sum_and_digit_sum_of_an_array.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DifferenceBetweenElementSumAndDigitSumOfAnArrayTest < ::Minitest::Test - def test_default - assert_equal(9, difference_of_sum([1, 15, 6, 3])) - assert_equal(0, difference_of_sum([1, 2, 3, 4])) - end + def test_default_one = assert_equal(9, difference_of_sum([1, 15, 6, 3])) + + def test_default_two = assert_equal(0, difference_of_sum([1, 2, 3, 4])) end diff --git a/test/easy/test_2540_minimum_common_value.rb b/test/easy/test_2540_minimum_common_value.rb index 08ddb92d..b06c6c10 100644 --- a/test/easy/test_2540_minimum_common_value.rb +++ b/test/easy/test_2540_minimum_common_value.rb @@ -5,12 +5,33 @@ require 'minitest/autorun' class MinimumCommonValueTest < ::Minitest::Test - def test_default - assert_equal(2, get_common([1, 2, 3], [2, 4])) - assert_equal(2, get_common([1, 2, 3, 6], [2, 3, 4, 5])) + def test_default_one + assert_equal( + 2, + get_common( + [1, 2, 3], + [2, 4] + ) + ) end - def test_additional - assert_equal(-1, get_common([1], [4])) + def test_default_two + assert_equal( + 2, + get_common( + [1, 2, 3, 6], + [2, 3, 4, 5] + ) + ) + end + + def test_additional_one + assert_equal( + -1, + get_common( + [1], + [4] + ) + ) end end diff --git a/test/easy/test_2544_alternating_digit_sum.rb b/test/easy/test_2544_alternating_digit_sum.rb index 9547d3e0..a0f03b7c 100644 --- a/test/easy/test_2544_alternating_digit_sum.rb +++ b/test/easy/test_2544_alternating_digit_sum.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class AlternatingDigitSumTest < ::Minitest::Test - def test_default - assert_equal(4, alternate_digit_sum(521)) - assert_equal(1, alternate_digit_sum(111)) - assert_equal(0, alternate_digit_sum(886_996)) - end + def test_default_one = assert_equal(4, alternate_digit_sum(521)) + + def test_default_two = assert_equal(1, alternate_digit_sum(111)) + + def test_default_three = assert_equal(0, alternate_digit_sum(886_996)) end diff --git a/test/easy/test_2549_count_distinct_numbers_on_board.rb b/test/easy/test_2549_count_distinct_numbers_on_board.rb index 45d0aeba..3be4010a 100644 --- a/test/easy/test_2549_count_distinct_numbers_on_board.rb +++ b/test/easy/test_2549_count_distinct_numbers_on_board.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountDistinctNumbersOnBoardTest < ::Minitest::Test - def test_default - assert_equal(4, distinct_integers(5)) - assert_equal(2, distinct_integers(3)) - end + def test_default_one = assert_equal(4, distinct_integers(5)) + + def test_default_two = assert_equal(2, distinct_integers(3)) end diff --git a/test/medium/test_102_binary_tree_level_order_traversal.rb b/test/medium/test_102_binary_tree_level_order_traversal.rb index 10680419..858192a8 100644 --- a/test/medium/test_102_binary_tree_level_order_traversal.rb +++ b/test/medium/test_102_binary_tree_level_order_traversal.rb @@ -6,9 +6,13 @@ require 'minitest/autorun' class BinaryTreeLevelOrderTraversalTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [[3], [9, 20], [15, 7]], + [ + [3], + [9, 20], + [15, 7] + ], level_order( ::TreeNode.new( 3, @@ -21,12 +25,20 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( - [[1]], + [ + [1] + ], level_order( ::TreeNode.new(1) ) ) + end + + def test_default_three assert_equal( [], level_order(nil) diff --git a/test/medium/test_103_binary_tree_zigzag_level_order_traversal.rb b/test/medium/test_103_binary_tree_zigzag_level_order_traversal.rb index 8b710e31..61cbd809 100644 --- a/test/medium/test_103_binary_tree_zigzag_level_order_traversal.rb +++ b/test/medium/test_103_binary_tree_zigzag_level_order_traversal.rb @@ -6,9 +6,13 @@ require 'minitest/autorun' class BinaryTreeZigzagLevelOrderTraversalTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [[3], [20, 9], [15, 7]], + [ + [3], + [20, 9], + [15, 7] + ], zigzag_level_order( ::TreeNode.new( 3, @@ -21,12 +25,20 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( - [[1]], + [ + [1] + ], zigzag_level_order( ::TreeNode.new(1) ) ) + end + + def test_default_three assert_equal( [], zigzag_level_order(nil) diff --git a/test/medium/test_105_construct_binary_tree_from_preorder_and_inorder_traversal.rb b/test/medium/test_105_construct_binary_tree_from_preorder_and_inorder_traversal.rb index b5028861..cf36fc1d 100644 --- a/test/medium/test_105_construct_binary_tree_from_preorder_and_inorder_traversal.rb +++ b/test/medium/test_105_construct_binary_tree_from_preorder_and_inorder_traversal.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class ConstructBinaryTreeFromPreorderAndInorderTraversalTest < ::Minitest::Test - def test_default + def test_default_one assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -24,6 +24,9 @@ def test_default ) ) ) + end + + def test_default_two assert( ::TreeNode.are_equals( ::TreeNode.new(-1), diff --git a/test/medium/test_106_construct_binary_tree_from_inorder_and_postorder_traversal.rb b/test/medium/test_106_construct_binary_tree_from_inorder_and_postorder_traversal.rb index 4dd69197..af7ac756 100644 --- a/test/medium/test_106_construct_binary_tree_from_inorder_and_postorder_traversal.rb +++ b/test/medium/test_106_construct_binary_tree_from_inorder_and_postorder_traversal.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class ConstructBinaryTreeFromInorderAndPostorderTraversalTest < ::Minitest::Test - def test_default + def test_default_one assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -24,6 +24,9 @@ def test_default ) ) ) + end + + def test_default_two assert( ::TreeNode.are_equals( ::TreeNode.new(-1), diff --git a/test/medium/test_107_binary_tree_level_order_traversal_ii.rb b/test/medium/test_107_binary_tree_level_order_traversal_ii.rb index 7ffd2bf6..2df88199 100644 --- a/test/medium/test_107_binary_tree_level_order_traversal_ii.rb +++ b/test/medium/test_107_binary_tree_level_order_traversal_ii.rb @@ -6,9 +6,13 @@ require 'minitest/autorun' class BinaryTreeLevelOrderTraversalIITest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [[15, 7], [9, 20], [3]], + [ + [15, 7], + [9, 20], + [3] + ], level_order_bottom( ::TreeNode.new( 3, @@ -21,12 +25,20 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( - [[1]], + [ + [1] + ], level_order_bottom( ::TreeNode.new(1) ) ) + end + + def test_default_three assert_equal( [], level_order_bottom(nil) diff --git a/test/medium/test_109_convert_sorted_list_to_binary_search_tree.rb b/test/medium/test_109_convert_sorted_list_to_binary_search_tree.rb index 16b3cde5..95097804 100644 --- a/test/medium/test_109_convert_sorted_list_to_binary_search_tree.rb +++ b/test/medium/test_109_convert_sorted_list_to_binary_search_tree.rb @@ -7,7 +7,7 @@ require 'minitest/autorun' class ConvertSortedListToBinarySearchTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( ::TreeNode.are_equals( ::TreeNode.new( @@ -30,6 +30,9 @@ def test_default ) ) ) + end + + def test_default_two assert( ::TreeNode.are_equals( nil, diff --git a/test/medium/test_113_path_sum_ii.rb b/test/medium/test_113_path_sum_ii.rb index 98ade5ba..2b8f3097 100644 --- a/test/medium/test_113_path_sum_ii.rb +++ b/test/medium/test_113_path_sum_ii.rb @@ -6,9 +6,12 @@ require 'minitest/autorun' class PathSumIITest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [[5, 4, 11, 2], [5, 8, 4, 5]], + [ + [5, 4, 11, 2], + [5, 8, 4, 5] + ], path_sum( ::TreeNode.new( 5, @@ -34,6 +37,9 @@ def test_default 22 ) ) + end + + def test_default_two assert_equal( [], path_sum( @@ -45,6 +51,9 @@ def test_default 5 ) ) + end + + def test_default_three assert_empty( [], path_sum( diff --git a/test/medium/test_114_flatten_binary_tree_to_linked_list.rb b/test/medium/test_114_flatten_binary_tree_to_linked_list.rb index 11c0609e..e24602ab 100644 --- a/test/medium/test_114_flatten_binary_tree_to_linked_list.rb +++ b/test/medium/test_114_flatten_binary_tree_to_linked_list.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class FlattenBinaryTreeToLinkedListTest < ::Minitest::Test - def test_default + def test_default_one input = ::TreeNode.new( 1, ::TreeNode.new( @@ -48,12 +48,16 @@ def test_default input ) ) + end + def test_default_two input = nil flatten(input) assert_nil(input) + end + def test_default_three input = ::TreeNode.new(0) flatten(input) diff --git a/test/medium/test_116_populating_next_right_pointers_in_each_node.rb b/test/medium/test_116_populating_next_right_pointers_in_each_node.rb index 67bc01c2..ee7e3df5 100644 --- a/test/medium/test_116_populating_next_right_pointers_in_each_node.rb +++ b/test/medium/test_116_populating_next_right_pointers_in_each_node.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class PopulatingNextRightPointersInEachNodeTest < ::Minitest::Test - def test_default + def test_default_one l3n4 = ::NextTreeNode.new(7) l3n3 = ::NextTreeNode.new(6, nil, nil, l3n4) l3n2 = ::NextTreeNode.new(5, nil, nil, l3n3) @@ -39,7 +39,9 @@ def test_default ) ) ) + end + def test_default_two assert( ::NextTreeNode.are_equals( nil, diff --git a/test/medium/test_117_populating_next_right_pointers_in_each_node_ii.rb b/test/medium/test_117_populating_next_right_pointers_in_each_node_ii.rb index 1b15907d..cce306c0 100644 --- a/test/medium/test_117_populating_next_right_pointers_in_each_node_ii.rb +++ b/test/medium/test_117_populating_next_right_pointers_in_each_node_ii.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class PopulatingNextRightPointersInEachNodeIITest < ::Minitest::Test - def test_default + def test_default_one ntn3 = ::NextTreeNode.new(3) ntn5 = ::NextTreeNode.new(5) ntn7 = ::NextTreeNode.new(7) @@ -47,7 +47,9 @@ def test_default ) ) ) + end + def test_default_two assert( ::NextTreeNode.are_equals( nil, diff --git a/test/medium/test_11_container_with_most_water.rb b/test/medium/test_11_container_with_most_water.rb index fc6e69b1..a802812a 100644 --- a/test/medium/test_11_container_with_most_water.rb +++ b/test/medium/test_11_container_with_most_water.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ContainerWithMostWaterTest < ::Minitest::Test - def test_default - assert_equal(49, max_area([1, 8, 6, 2, 5, 4, 8, 3, 7])) - assert_equal(1, max_area([1, 1])) - end + def test_default_one = assert_equal(49, max_area([1, 8, 6, 2, 5, 4, 8, 3, 7])) + + def test_default_two = assert_equal(1, max_area([1, 1])) end diff --git a/test/medium/test_120_triangle.rb b/test/medium/test_120_triangle.rb index 6f6fb190..af95ba07 100644 --- a/test/medium/test_120_triangle.rb +++ b/test/medium/test_120_triangle.rb @@ -5,8 +5,28 @@ require 'minitest/autorun' class TriangleTest < ::Minitest::Test - def test_default - assert_equal(11, minimum_total([[2], [3, 4], [6, 5, 7], [4, 1, 8, 3]])) - assert_equal(-10, minimum_total([[-10]])) + def test_default_one + assert_equal( + 11, + minimum_total( + [ + [2], + [3, 4], + [6, 5, 7], + [4, 1, 8, 3] + ] + ) + ) + end + + def test_default_two + assert_equal( + -10, + minimum_total( + [ + [-10] + ] + ) + ) end end diff --git a/test/medium/test_128_longest_consecutive_sequence.rb b/test/medium/test_128_longest_consecutive_sequence.rb index af26706c..423e5c3f 100644 --- a/test/medium/test_128_longest_consecutive_sequence.rb +++ b/test/medium/test_128_longest_consecutive_sequence.rb @@ -5,8 +5,21 @@ require 'minitest/autorun' class LongestConsequtiveSequenceTest < ::Minitest::Test - def test_default - assert_equal(4, longest_consecutive([100, 4, 200, 1, 3, 2])) - assert_equal(9, longest_consecutive([0, 3, 7, 2, 5, 8, 4, 6, 0, 1])) + def test_default_one + assert_equal( + 4, + longest_consecutive( + [100, 4, 200, 1, 3, 2] + ) + ) + end + + def test_default_two + assert_equal( + 9, + longest_consecutive( + [0, 3, 7, 2, 5, 8, 4, 6, 0, 1] + ) + ) end end diff --git a/test/medium/test_129_sum_root_to_leaf_numbers.rb b/test/medium/test_129_sum_root_to_leaf_numbers.rb index 1f58edda..20c03a48 100644 --- a/test/medium/test_129_sum_root_to_leaf_numbers.rb +++ b/test/medium/test_129_sum_root_to_leaf_numbers.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class SumRootToLeafNumbersTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 25, sum_numbers( @@ -17,6 +17,9 @@ def test_default ) ) ) + end + + def test_default_two assert_equal( 1026, sum_numbers( diff --git a/test/medium/test_12_integer_to_roman.rb b/test/medium/test_12_integer_to_roman.rb index e273c801..76a93c75 100644 --- a/test/medium/test_12_integer_to_roman.rb +++ b/test/medium/test_12_integer_to_roman.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class IntegerToRomanTest < ::Minitest::Test - def test_default - assert_equal('MMMDCCXLIX', int_to_roman(3749)) - assert_equal('LVIII', int_to_roman(58)) - assert_equal('MCMXCIV', int_to_roman(1994)) - end + def test_default_one = assert_equal('MMMDCCXLIX', int_to_roman(3749)) + + def test_default_two = assert_equal('LVIII', int_to_roman(58)) + + def test_default_three = assert_equal('MCMXCIV', int_to_roman(1994)) end diff --git a/test/medium/test_133_clone_graph.rb b/test/medium/test_133_clone_graph.rb index 14e92e7e..bfeaa0b2 100644 --- a/test/medium/test_133_clone_graph.rb +++ b/test/medium/test_133_clone_graph.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class CloneGraphTest < ::Minitest::Test - def test_default + def test_default_one g1 = ::NodeWithNeighbors.new(1) g2 = ::NodeWithNeighbors.new(2) g3 = ::NodeWithNeighbors.new(3) @@ -26,15 +26,19 @@ def test_default clone_graph(g1) ) ) + end - g5 = ::NodeWithNeighbors.new(1) + def test_default_two + g1 = ::NodeWithNeighbors.new(1) assert( ::NodeWithNeighbors.are_equals( - g5, - clone_graph(g5) + g1, + clone_graph(g1) ) ) + end + def test_default_three assert( ::NodeWithNeighbors.are_equals( nil, diff --git a/test/medium/test_134_gas_station.rb b/test/medium/test_134_gas_station.rb index 3ba28eae..192ff31c 100644 --- a/test/medium/test_134_gas_station.rb +++ b/test/medium/test_134_gas_station.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class GasStationTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( 3, can_complete_circuit( @@ -13,6 +13,9 @@ def test_default [3, 4, 5, 1, 2] ) ) + end + + def test_default_two assert_equal( -1, can_complete_circuit( diff --git a/test/medium/test_15_3sum.rb b/test/medium/test_15_3sum.rb index 3d133556..a4650cd8 100644 --- a/test/medium/test_15_3sum.rb +++ b/test/medium/test_15_3sum.rb @@ -5,9 +5,19 @@ require 'minitest/autorun' class ThreeSumTest < ::Minitest::Test - def test_default - assert_equal([[-1, -1, 2], [-1, 0, 1]], three_sum([-1, 0, 1, 2, -1, -4])) - assert_equal([], three_sum([0, 1, 1])) - assert_equal([[0, 0, 0]], three_sum([0, 0, 0])) + def test_default_one + assert_equal( + [ + [-1, -1, 2], + [-1, 0, 1] + ], + three_sum( + [-1, 0, 1, 2, -1, -4] + ) + ) end + + def test_default_two = assert_equal([], three_sum([0, 1, 1])) + + def test_default_three = assert_equal([[0, 0, 0]], three_sum([0, 0, 0])) end diff --git a/test/medium/test_16_3sum_closest.rb b/test/medium/test_16_3sum_closest.rb index b142b213..e300f9fe 100644 --- a/test/medium/test_16_3sum_closest.rb +++ b/test/medium/test_16_3sum_closest.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class ThreeSumClosestTest < ::Minitest::Test - def test_default - assert_equal(2, three_sum_closest([-1, 2, 1, -4], 1)) - assert_equal(0, three_sum_closest([0, 0, 0], 1)) - end + def test_default_one = assert_equal(2, three_sum_closest([-1, 2, 1, -4], 1)) + + def test_default_two = assert_equal(0, three_sum_closest([0, 0, 0], 1)) end diff --git a/test/medium/test_17_letter_combinations_of_a_phone_number.rb b/test/medium/test_17_letter_combinations_of_a_phone_number.rb index 09cd5554..0eacc548 100644 --- a/test/medium/test_17_letter_combinations_of_a_phone_number.rb +++ b/test/medium/test_17_letter_combinations_of_a_phone_number.rb @@ -5,9 +5,19 @@ require 'minitest/autorun' class LetterCombinationsOfAPhoneNumberTest < ::Minitest::Test - def test_default - assert_equal(%w[ad ae af bd be bf cd ce cf], letter_combinations('23')) - assert_equal([], letter_combinations('')) - assert_equal(%w[a b c], letter_combinations('2')) + def test_default_one + assert_equal( + %w[ad ae af bd be bf cd ce cf], + letter_combinations('23') + ) + end + + def test_default_two = assert_equal([], letter_combinations('')) + + def test_default_three + assert_equal( + %w[a b c], + letter_combinations('2') + ) end end diff --git a/test/medium/test_19_remove_nth_node_from_end_of_list.rb b/test/medium/test_19_remove_nth_node_from_end_of_list.rb index c1119345..6131daff 100644 --- a/test/medium/test_19_remove_nth_node_from_end_of_list.rb +++ b/test/medium/test_19_remove_nth_node_from_end_of_list.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class RemoveNthNodeFromEndOfListTest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( ::ListNode.from_array( @@ -20,6 +20,9 @@ def test_default ) ) ) + end + + def test_default_two assert( ::ListNode.are_equals( ::ListNode.from_array([]), @@ -29,6 +32,9 @@ def test_default ) ) ) + end + + def test_default_three assert( ::ListNode.are_equals( ::ListNode.from_array([1]), diff --git a/test/medium/test_22_generate_parentheses.rb b/test/medium/test_22_generate_parentheses.rb index 8374512d..df6d6fc4 100644 --- a/test/medium/test_22_generate_parentheses.rb +++ b/test/medium/test_22_generate_parentheses.rb @@ -5,11 +5,17 @@ require 'minitest/autorun' class GenerateParenthesesTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( %w[()()() ()(()) (())() (()()) ((()))], generate_parenthesis(3) ) - assert_equal(['()'], generate_parenthesis(1)) + end + + def test_default_two + assert_equal( + ['()'], + generate_parenthesis(1) + ) end end diff --git a/test/medium/test_24_swap_nodes_in_pairs.rb b/test/medium/test_24_swap_nodes_in_pairs.rb index 5e7d31c4..726918ff 100644 --- a/test/medium/test_24_swap_nodes_in_pairs.rb +++ b/test/medium/test_24_swap_nodes_in_pairs.rb @@ -6,15 +6,22 @@ require 'minitest/autorun' class SwapNodesInPairsTest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( - ::ListNode.from_array([2, 1, 4, 3]), + ::ListNode.from_array( + [2, 1, 4, 3] + ), swap_pairs( - ::ListNode.from_array([1, 2, 3, 4]) + ::ListNode.from_array( + [1, 2, 3, 4] + ) ) ) ) + end + + def test_default_two assert( ::ListNode.are_equals( ::ListNode.from_array([]), @@ -23,6 +30,9 @@ def test_default ) ) ) + end + + def test_default_three assert( ::ListNode.are_equals( ::ListNode.from_array([1]), diff --git a/test/medium/test_29_divide_two_integers.rb b/test/medium/test_29_divide_two_integers.rb index f900877a..5a9c7d2f 100644 --- a/test/medium/test_29_divide_two_integers.rb +++ b/test/medium/test_29_divide_two_integers.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class DivideTwoIntegersTest < ::Minitest::Test - def test_default - assert_equal(3, divide(10, 3)) - assert_equal(-2, divide(7, -3)) - end + def test_default_one = assert_equal(3, divide(10, 3)) + + def test_default_two = assert_equal(-2, divide(7, -3)) end diff --git a/test/medium/test_2_add_two_numbers.rb b/test/medium/test_2_add_two_numbers.rb index d9e2b342..8e0d9117 100644 --- a/test/medium/test_2_add_two_numbers.rb +++ b/test/medium/test_2_add_two_numbers.rb @@ -6,16 +6,25 @@ require 'minitest/autorun' class AddTwoNumbersTest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( - ::ListNode.from_array([7, 0, 8]), + ::ListNode.from_array( + [7, 0, 8] + ), add_two_numbers( - ::ListNode.from_array([2, 4, 3]), - ::ListNode.from_array([5, 6, 4]) + ::ListNode.from_array( + [2, 4, 3] + ), + ::ListNode.from_array( + [5, 6, 4] + ) ) ) ) + end + + def test_default_two assert( ::ListNode.from_array([0]), add_two_numbers( @@ -23,28 +32,52 @@ def test_default ::ListNode.from_array([0]) ) ) + end + + def test_default_three assert( - ::ListNode.from_array([8, 9, 9, 9, 0, 0, 0, 1]), + ::ListNode.from_array( + [8, 9, 9, 9, 0, 0, 0, 1] + ), add_two_numbers( - ::ListNode.from_array([9, 9, 9, 9, 9, 9, 9]), - ::ListNode.from_array([9, 9, 9, 9]) + ::ListNode.from_array( + [9, 9, 9, 9, 9, 9, 9] + ), + ::ListNode.from_array( + [9, 9, 9, 9] + ) ) ) end - def test_additional + def test_additional_one assert( - ::ListNode.from_array([8, 9, 9, 9, 0, 0, 0]), + ::ListNode.from_array( + [8, 9, 9, 9, 0, 0, 0] + ), add_two_numbers( - ::ListNode.from_array([9, 9, 9, 9, 9, 9, 2]), - ::ListNode.from_array([9, 9, 9, 9]) + ::ListNode.from_array( + [9, 9, 9, 9, 9, 9, 2] + ), + ::ListNode.from_array( + [9, 9, 9, 9] + ) ) ) + end + + def test_additional_two assert( - ::ListNode.from_array([8, 9, 9, 9, 0, 0, 0]), + ::ListNode.from_array( + [8, 9, 9, 9, 0, 0, 0] + ), add_two_numbers( - ::ListNode.from_array([9, 9, 9, 9]), - ::ListNode.from_array([9, 9, 9, 9, 9, 9, 2]) + ::ListNode.from_array( + [9, 9, 9, 9] + ), + ::ListNode.from_array( + [9, 9, 9, 9, 9, 9, 2] + ) ) ) end diff --git a/test/medium/test_33_search_in_rotated_sorted_array.rb b/test/medium/test_33_search_in_rotated_sorted_array.rb index dbc65dd9..a4916887 100644 --- a/test/medium/test_33_search_in_rotated_sorted_array.rb +++ b/test/medium/test_33_search_in_rotated_sorted_array.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class SearchInRotatedSortedArrayTest < ::Minitest::Test - def test_default - assert_equal(4, search33([4, 5, 6, 7, 0, 1, 2], 0)) - assert_equal(-1, search33([4, 5, 6, 7, 0, 1, 2], 3)) - assert_equal(-1, search33([1], 0)) + def test_default_one + assert_equal( + 4, + search33( + [4, 5, 6, 7, 0, 1, 2], + 0 + ) + ) + end + + def test_default_two + assert_equal( + -1, + search33( + [4, 5, 6, 7, 0, 1, 2], + 3 + ) + ) + end + + def test_default_three + assert_equal( + -1, + search33( + [1], + 0 + ) + ) end end diff --git a/test/medium/test_34_find_first_and_last_position_of_element_in_sorted_array.rb b/test/medium/test_34_find_first_and_last_position_of_element_in_sorted_array.rb index 0c333c6f..4bf5556b 100644 --- a/test/medium/test_34_find_first_and_last_position_of_element_in_sorted_array.rb +++ b/test/medium/test_34_find_first_and_last_position_of_element_in_sorted_array.rb @@ -5,9 +5,33 @@ require 'minitest/autorun' class SearchInRotatedSortedArrayTest < ::Minitest::Test - def test_default - assert_equal([3, 4], search_range([5, 7, 7, 8, 8, 10], 8)) - assert_equal([-1, -1], search_range([5, 7, 7, 8, 8, 10], 6)) - assert_equal([-1, -1], search_range([], 0)) + def test_default_one + assert_equal( + [3, 4], + search_range( + [5, 7, 7, 8, 8, 10], + 8 + ) + ) + end + + def test_default_two + assert_equal( + [-1, -1], + search_range( + [5, 7, 7, 8, 8, 10], + 6 + ) + ) + end + + def test_default_three + assert_equal( + [-1, -1], + search_range( + [], + 0 + ) + ) end end diff --git a/test/medium/test_36_valid_sudoku.rb b/test/medium/test_36_valid_sudoku.rb index 58ec5466..f8867cdb 100644 --- a/test/medium/test_36_valid_sudoku.rb +++ b/test/medium/test_36_valid_sudoku.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class ValidSudokuTest < ::Minitest::Test - def test_default + def test_default_one assert( is_valid_sudoku( [ @@ -21,6 +21,9 @@ def test_default ] ) ) + end + + def test_default_two assert( !is_valid_sudoku( [ diff --git a/test/medium/test_38_count_and_say.rb b/test/medium/test_38_count_and_say.rb index 92248e39..c1047fc4 100644 --- a/test/medium/test_38_count_and_say.rb +++ b/test/medium/test_38_count_and_say.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class CountAndSayTest < ::Minitest::Test - def test_default - assert_equal('1211', count_and_say(4)) - assert_equal('1', count_and_say(1)) - end + def test_default_one = assert_equal('1211', count_and_say(4)) + + def test_default_two = assert_equal('1', count_and_say(1)) end diff --git a/test/medium/test_39_combination_sum.rb b/test/medium/test_39_combination_sum.rb index f415aadc..a9cd64e3 100644 --- a/test/medium/test_39_combination_sum.rb +++ b/test/medium/test_39_combination_sum.rb @@ -5,9 +5,40 @@ require 'minitest/autorun' class CombinationSumTest < ::Minitest::Test - def test_default - assert_equal([[2, 2, 3], [7]], combination_sum([2, 3, 6, 7], 7)) - assert_equal([[2, 2, 2, 2], [2, 3, 3], [3, 5]], combination_sum([2, 3, 5], 8)) - assert_equal([], combination_sum([2], 1)) + def test_default_one + assert_equal( + [ + [2, 2, 3], + [7] + ], + combination_sum( + [2, 3, 6, 7], + 7 + ) + ) + end + + def test_default_two + assert_equal( + [ + [2, 2, 2, 2], + [2, 3, 3], + [3, 5] + ], + combination_sum( + [2, 3, 5], + 8 + ) + ) + end + + def test_default_three + assert_equal( + [], + combination_sum( + [2], + 1 + ) + ) end end diff --git a/test/medium/test_3_longest_substring_without_repeating_characters.rb b/test/medium/test_3_longest_substring_without_repeating_characters.rb index b6cc725e..5558d446 100644 --- a/test/medium/test_3_longest_substring_without_repeating_characters.rb +++ b/test/medium/test_3_longest_substring_without_repeating_characters.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class LongestSubstringWithoutRepeatingCharactersTest < ::Minitest::Test - def test_default - assert_equal(3, length_of_longest_substring('abcabcbb')) - assert_equal(1, length_of_longest_substring('bbbbb')) - assert_equal(3, length_of_longest_substring('pwwkew')) - end + def test_default_one = assert_equal(3, length_of_longest_substring('abcabcbb')) + + def test_default_two = assert_equal(1, length_of_longest_substring('bbbbb')) + + def test_default_three = assert_equal(3, length_of_longest_substring('pwwkew')) end diff --git a/test/medium/test_43_multiply_strings.rb b/test/medium/test_43_multiply_strings.rb index f68e31c5..f4412f5b 100644 --- a/test/medium/test_43_multiply_strings.rb +++ b/test/medium/test_43_multiply_strings.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class MultiplyStringsTest < ::Minitest::Test - def test_default - assert_equal('6', multiply('2', '3')) - assert_equal('56088', multiply('123', '456')) - end + def test_default_one = assert_equal('6', multiply('2', '3')) + + def test_default_two = assert_equal('56088', multiply('123', '456')) end diff --git a/test/medium/test_46_permutations.rb b/test/medium/test_46_permutations.rb index f08c2c78..19aadce6 100644 --- a/test/medium/test_46_permutations.rb +++ b/test/medium/test_46_permutations.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class PermutationsTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [ [1, 2, 3], @@ -15,9 +15,32 @@ def test_default [3, 1, 2], [3, 2, 1] ], - permute([1, 2, 3]) + permute( + [1, 2, 3] + ) + ) + end + + def test_default_two + assert_equal( + [ + [0, 1], + [1, 0] + ], + permute( + [0, 1] + ) + ) + end + + def test_default_three + assert_equal( + [ + [1] + ], + permute( + [1] + ) ) - assert_equal([[0, 1], [1, 0]], permute([0, 1])) - assert_equal([[1]], permute([1])) end end diff --git a/test/medium/test_48_rotate_image.rb b/test/medium/test_48_rotate_image.rb index c60ac4f7..d12df747 100644 --- a/test/medium/test_48_rotate_image.rb +++ b/test/medium/test_48_rotate_image.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class RotateImageTest < ::Minitest::Test - def test_default + def test_default_one matrix = [ [1, 2, 3], [4, 5, 6], @@ -21,7 +21,9 @@ def test_default ], matrix ) + end + def test_default_two matrix = [ [5, 1, 9, 11], [2, 4, 8, 10], diff --git a/test/medium/test_49_group_anagrams.rb b/test/medium/test_49_group_anagrams.rb index a0998d23..62178f1c 100644 --- a/test/medium/test_49_group_anagrams.rb +++ b/test/medium/test_49_group_anagrams.rb @@ -5,12 +5,38 @@ require 'minitest/autorun' class GroupAnagramsTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [%w[eat tea ate], %w[tan nat], ['bat']], - group_anagrams(%w[eat tea tan ate nat bat]) + [ + %w[eat tea ate], + %w[tan nat], + ['bat'] + ], + group_anagrams( + %w[eat tea tan ate nat bat] + ) + ) + end + + def test_default_two + assert_equal( + [ + [''] + ], + group_anagrams( + [''] + ) + ) + end + + def test_default_three + assert_equal( + [ + ['a'] + ], + group_anagrams( + ['a'] + ) ) - assert_equal([['']], group_anagrams([''])) - assert_equal([['a']], group_anagrams(['a'])) end end diff --git a/test/medium/test_53_maximum_subarray.rb b/test/medium/test_53_maximum_subarray.rb index 124d47cb..253e7a20 100644 --- a/test/medium/test_53_maximum_subarray.rb +++ b/test/medium/test_53_maximum_subarray.rb @@ -5,9 +5,30 @@ require 'minitest/autorun' class MaximumSubarrayTest < ::Minitest::Test - def test_default - assert_equal(6, max_sub_array([-2, 1, -3, 4, -1, 2, 1, -5, 4])) - assert_equal(1, max_sub_array([1])) - assert_equal(23, max_sub_array([5, 4, -1, 7, 8])) + def test_default_one + assert_equal( + 6, + max_sub_array( + [-2, 1, -3, 4, -1, 2, 1, -5, 4] + ) + ) + end + + def test_default_two + assert_equal( + 1, + max_sub_array( + [1] + ) + ) + end + + def test_default_three + assert_equal( + 23, + max_sub_array( + [5, 4, -1, 7, 8] + ) + ) end end diff --git a/test/medium/test_54_spiral_matrix.rb b/test/medium/test_54_spiral_matrix.rb index 53975166..a34d2462 100644 --- a/test/medium/test_54_spiral_matrix.rb +++ b/test/medium/test_54_spiral_matrix.rb @@ -5,7 +5,7 @@ require 'minitest/autorun' class SpiralMatrixTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( [1, 2, 3, 6, 9, 8, 7, 4, 5], spiral_order( @@ -16,6 +16,9 @@ def test_default ] ) ) + end + + def test_default_two assert_equal( [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7], spiral_order( diff --git a/test/medium/test_55_jump_game.rb b/test/medium/test_55_jump_game.rb index a0d0e3f2..7dcd29b4 100644 --- a/test/medium/test_55_jump_game.rb +++ b/test/medium/test_55_jump_game.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class JumpGameTest < ::Minitest::Test - def test_default - assert(can_jump([2, 3, 1, 1, 4])) - assert(!can_jump([3, 2, 1, 0, 4])) - end + def test_default_one = assert(can_jump([2, 3, 1, 1, 4])) + + def test_default_two = assert(!can_jump([3, 2, 1, 0, 4])) end diff --git a/test/medium/test_56_merge_intervals.rb b/test/medium/test_56_merge_intervals.rb index 0aabf98c..4d8e666f 100644 --- a/test/medium/test_56_merge_intervals.rb +++ b/test/medium/test_56_merge_intervals.rb @@ -5,8 +5,35 @@ require 'minitest/autorun' class MergeIntervalsTest < ::Minitest::Test - def test_default - assert_equal([[1, 6], [8, 10], [15, 18]], merge56([[1, 3], [2, 6], [8, 10], [15, 18]])) - assert_equal([[1, 5]], merge56([[1, 4], [4, 5]])) + def test_default_one + assert_equal( + [ + [1, 6], + [8, 10], + [15, 18] + ], + merge56( + [ + [1, 3], + [2, 6], + [8, 10], + [15, 18] + ] + ) + ) + end + + def test_default_two + assert_equal( + [ + [1, 5] + ], + merge56( + [ + [1, 4], + [4, 5] + ] + ) + ) end end diff --git a/test/medium/test_57_insert_interval.rb b/test/medium/test_57_insert_interval.rb index f71311a8..6905376d 100644 --- a/test/medium/test_57_insert_interval.rb +++ b/test/medium/test_57_insert_interval.rb @@ -5,8 +5,39 @@ require 'minitest/autorun' class InsertIntervalTest < ::Minitest::Test - def test_default - assert_equal([[1, 5], [6, 9]], insert([[1, 3], [6, 9]], [2, 5])) - assert_equal([[1, 2], [3, 10], [12, 16]], insert([[1, 2], [3, 5], [6, 7], [8, 10], [12, 16]], [4, 8])) + def test_default_one + assert_equal( + [ + [1, 5], + [6, 9] + ], + insert( + [ + [1, 3], + [6, 9] + ], + [2, 5] + ) + ) + end + + def test_default_two + assert_equal( + [ + [1, 2], + [3, 10], + [12, 16] + ], + insert( + [ + [1, 2], + [3, 5], + [6, 7], + [8, 10], + [12, 16] + ], + [4, 8] + ) + ) end end diff --git a/test/medium/test_59_spiral_matrix_ii.rb b/test/medium/test_59_spiral_matrix_ii.rb index 1b81a57c..7bd89b0a 100644 --- a/test/medium/test_59_spiral_matrix_ii.rb +++ b/test/medium/test_59_spiral_matrix_ii.rb @@ -5,8 +5,23 @@ require 'minitest/autorun' class SpiralMatrixIITest < ::Minitest::Test - def test_default - assert_equal([[1, 2, 3], [8, 9, 4], [7, 6, 5]], generate_matrix(3)) - assert_equal([[1]], generate_matrix(1)) + def test_default_one + assert_equal( + [ + [1, 2, 3], + [8, 9, 4], + [7, 6, 5] + ], + generate_matrix(3) + ) + end + + def test_default_two + assert_equal( + [ + [1] + ], + generate_matrix(1) + ) end end diff --git a/test/medium/test_5_longest_palindromic_substring.rb b/test/medium/test_5_longest_palindromic_substring.rb index ec793ffa..0fd5643c 100644 --- a/test/medium/test_5_longest_palindromic_substring.rb +++ b/test/medium/test_5_longest_palindromic_substring.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class LongestPalindromicSubstringTest < ::Minitest::Test - def test_default - assert_equal('bab', longest_palindrome5('babad')) - assert_equal('bb', longest_palindrome5('cbbd')) - end + def test_default_one = assert_equal('bab', longest_palindrome5('babad')) + + def test_default_two = assert_equal('bb', longest_palindrome5('cbbd')) end diff --git a/test/medium/test_61_rotate_list.rb b/test/medium/test_61_rotate_list.rb index e4f14c41..5d9cbf8e 100644 --- a/test/medium/test_61_rotate_list.rb +++ b/test/medium/test_61_rotate_list.rb @@ -6,17 +6,34 @@ require 'minitest/autorun' class RotateListTest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( - ::ListNode.from_array([4, 5, 1, 2, 3]), - rotate_right(::ListNode.from_array([1, 2, 3, 4, 5]), 2) + ::ListNode.from_array( + [4, 5, 1, 2, 3] + ), + rotate_right( + ::ListNode.from_array( + [1, 2, 3, 4, 5] + ), + 2 + ) ) ) + end + + def test_default_two assert( ::ListNode.are_equals( - ::ListNode.from_array([2, 0, 1]), - rotate_right(::ListNode.from_array([0, 1, 2]), 4) + ::ListNode.from_array( + [2, 0, 1] + ), + rotate_right( + ::ListNode.from_array( + [0, 1, 2] + ), + 4 + ) ) ) end diff --git a/test/medium/test_62_unique_paths.rb b/test/medium/test_62_unique_paths.rb index ec84db96..46481cc8 100644 --- a/test/medium/test_62_unique_paths.rb +++ b/test/medium/test_62_unique_paths.rb @@ -5,8 +5,7 @@ require 'minitest/autorun' class UniquePathsTest < ::Minitest::Test - def test_default - assert_equal(28, unique_paths(3, 7)) - assert_equal(3, unique_paths(3, 2)) - end + def test_default_one = assert_equal(28, unique_paths(3, 7)) + + def test_default_two = assert_equal(3, unique_paths(3, 2)) end diff --git a/test/medium/test_71_simplify_path.rb b/test/medium/test_71_simplify_path.rb index 41417fc6..d662c338 100644 --- a/test/medium/test_71_simplify_path.rb +++ b/test/medium/test_71_simplify_path.rb @@ -5,11 +5,48 @@ require 'minitest/autorun' class SimplifyPathTest < ::Minitest::Test - def test_default - assert_equal('/home', simplify_path('/home/')) - assert_equal('/home/foo', simplify_path('/home//foo/')) - assert_equal('/home/user/Pictures', simplify_path('/home/user/Documents/../Pictures')) - assert_equal('/', simplify_path('/../')) - assert_equal('/.../b/d', simplify_path('/.../a/../b/c/../d/./')) + def test_default_one + assert_equal( + '/home', + simplify_path( + '/home/' + ) + ) + end + + def test_default_two + assert_equal( + '/home/foo', + simplify_path( + '/home//foo/' + ) + ) + end + + def test_default_three + assert_equal( + '/home/user/Pictures', + simplify_path( + '/home/user/Documents/../Pictures' + ) + ) + end + + def test_default_four + assert_equal( + '/', + simplify_path( + '/../' + ) + ) + end + + def test_default_five + assert_equal( + '/.../b/d', + simplify_path( + '/.../a/../b/c/../d/./' + ) + ) end end diff --git a/test/medium/test_74_search_a_2d_matrix.rb b/test/medium/test_74_search_a_2d_matrix.rb index 5cec1a81..9ef63e58 100644 --- a/test/medium/test_74_search_a_2d_matrix.rb +++ b/test/medium/test_74_search_a_2d_matrix.rb @@ -5,8 +5,29 @@ require 'minitest/autorun' class SearchA2DMatrixTest < ::Minitest::Test - def test_default - assert(search_matrix([[1, 3, 5, 7], [10, 11, 16, 20], [23, 30, 34, 60]], 3)) - assert(!search_matrix([[1, 3, 5, 7], [10, 11, 16, 20], [23, 30, 34, 60]], 13)) + def test_default_one + assert( + search_matrix( + [ + [1, 3, 5, 7], + [10, 11, 16, 20], + [23, 30, 34, 60] + ], + 3 + ) + ) + end + + def test_default_two + assert( + !search_matrix( + [ + [1, 3, 5, 7], + [10, 11, 16, 20], + [23, 30, 34, 60] + ], + 13 + ) + ) end end diff --git a/test/medium/test_75_sort_colors.rb b/test/medium/test_75_sort_colors.rb index c35df06c..588bf01d 100644 --- a/test/medium/test_75_sort_colors.rb +++ b/test/medium/test_75_sort_colors.rb @@ -5,11 +5,13 @@ require 'minitest/autorun' class SortColorsTest < ::Minitest::Test - def test_default + def test_default_one nums = [2, 0, 2, 1, 1, 0] sort_colors(nums) assert_equal([0, 0, 1, 1, 2, 2], nums) + end + def test_default_two nums = [2, 0, 1] sort_colors(nums) assert_equal([0, 1, 2], nums) diff --git a/test/medium/test_78_subsets.rb b/test/medium/test_78_subsets.rb index b67c59d1..3696fd49 100644 --- a/test/medium/test_78_subsets.rb +++ b/test/medium/test_78_subsets.rb @@ -5,11 +5,32 @@ require 'minitest/autorun' class SubsetsTest < ::Minitest::Test - def test_default + def test_default_one assert_equal( - [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]], - subsets([1, 2, 3]) + [ + [], + [1], + [2], + [1, 2], + [3], + [1, 3], + [2, 3], + [1, 2, 3] + ], + subsets( + [1, 2, 3] + ) + ) + end + + def test_default_two + assert_equal( + [ + [], [0] + ], + subsets( + [0] + ) ) - assert_equal([[], [0]], subsets([0])) end end diff --git a/test/medium/test_7_reverse_integer.rb b/test/medium/test_7_reverse_integer.rb index b99032a0..cccfa8d5 100644 --- a/test/medium/test_7_reverse_integer.rb +++ b/test/medium/test_7_reverse_integer.rb @@ -5,13 +5,11 @@ require 'minitest/autorun' class ReverseIntegerTest < ::Minitest::Test - def test_default - assert_equal(321, reverse7(123)) - assert_equal(-321, reverse7(-123)) - assert_equal(21, reverse7(120)) - end + def test_default_one = assert_equal(321, reverse7(123)) - def test_additional - assert_equal(0, reverse7(2**31)) - end + def test_default_two = assert_equal(-321, reverse7(-123)) + + def test_default_three = assert_equal(21, reverse7(120)) + + def test_additional_one = assert_equal(0, reverse7(2**31)) end diff --git a/test/medium/test_82_remove_duplicates_from_sorted_list_ii.rb b/test/medium/test_82_remove_duplicates_from_sorted_list_ii.rb index d19bc1cd..85bf7f4e 100644 --- a/test/medium/test_82_remove_duplicates_from_sorted_list_ii.rb +++ b/test/medium/test_82_remove_duplicates_from_sorted_list_ii.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class RemoveDuplicatesFromSortedListIITest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( ::ListNode.from_array( @@ -19,9 +19,14 @@ def test_default ) ) ) + end + + def test_default_two assert( ::ListNode.are_equals( - ::ListNode.from_array([2, 3]), + ::ListNode.from_array( + [2, 3] + ), delete_duplicates82( ::ListNode.from_array( [1, 1, 1, 2, 3] diff --git a/test/medium/test_86_partition_list.rb b/test/medium/test_86_partition_list.rb index 56967a5b..4ff389c8 100644 --- a/test/medium/test_86_partition_list.rb +++ b/test/medium/test_86_partition_list.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class PartitionListTest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( ::ListNode.from_array( @@ -20,11 +20,18 @@ def test_default ) ) ) + end + + def test_default_two assert( ::ListNode.are_equals( - ::ListNode.from_array([1, 2]), + ::ListNode.from_array( + [1, 2] + ), partition( - ::ListNode.from_array([2, 1]), + ::ListNode.from_array( + [2, 1] + ), 2 ) ) diff --git a/test/medium/test_8_string_to_integer_atoi.rb b/test/medium/test_8_string_to_integer_atoi.rb index c09d1f2a..a5a8779c 100644 --- a/test/medium/test_8_string_to_integer_atoi.rb +++ b/test/medium/test_8_string_to_integer_atoi.rb @@ -5,9 +5,9 @@ require 'minitest/autorun' class StringToIntegerAtoiTest < ::Minitest::Test - def test_default - assert_equal(42, my_atoi('42')) - assert_equal(-42, my_atoi('-042')) - assert_equal(1337, my_atoi('1337c0d3')) - end + def test_default_one = assert_equal(42, my_atoi('42')) + + def test_default_two = assert_equal(-42, my_atoi('-042')) + + def test_default_three = assert_equal(1337, my_atoi('1337c0d3')) end diff --git a/test/medium/test_92_reverse_linked_list_ii.rb b/test/medium/test_92_reverse_linked_list_ii.rb index 007c61f9..99313f7e 100644 --- a/test/medium/test_92_reverse_linked_list_ii.rb +++ b/test/medium/test_92_reverse_linked_list_ii.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class ReverseLinkedListIITest < ::Minitest::Test - def test_default + def test_default_one assert( ::ListNode.are_equals( ::ListNode.from_array( @@ -21,6 +21,9 @@ def test_default ) ) ) + end + + def test_default_two assert( ::ListNode.are_equals( ::ListNode.from_array([5]), diff --git a/test/medium/test_95_unique_binary_search_trees_ii.rb b/test/medium/test_95_unique_binary_search_trees_ii.rb index e920837f..a4e05af2 100644 --- a/test/medium/test_95_unique_binary_search_trees_ii.rb +++ b/test/medium/test_95_unique_binary_search_trees_ii.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class UniqueBinarySearchTreesIITest < ::Minitest::Test - def test_default + def test_default_one input = [ ::TreeNode.new( 1, @@ -61,7 +61,9 @@ def test_default ) ) end + end + def test_default_two input = [::TreeNode.new(1)] output = generate_trees(1) diff --git a/test/medium/test_96_unique_binary_search_trees.rb b/test/medium/test_96_unique_binary_search_trees.rb index f6fd09f8..c12005d1 100644 --- a/test/medium/test_96_unique_binary_search_trees.rb +++ b/test/medium/test_96_unique_binary_search_trees.rb @@ -6,8 +6,7 @@ require 'minitest/autorun' class UniqueBinarySearchTreesTest < ::Minitest::Test - def test_default - assert_equal(5, num_trees(3)) - assert_equal(1, num_trees(1)) - end + def test_default_one = assert_equal(5, num_trees(3)) + + def test_default_two = assert_equal(1, num_trees(1)) end diff --git a/test/medium/test_98_validate_binary_search_tree.rb b/test/medium/test_98_validate_binary_search_tree.rb index 09918881..09db9a61 100644 --- a/test/medium/test_98_validate_binary_search_tree.rb +++ b/test/medium/test_98_validate_binary_search_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class ValidateBinarySearchTreeTest < ::Minitest::Test - def test_default + def test_default_one assert( is_valid_bst( ::TreeNode.new( @@ -16,6 +16,9 @@ def test_default ) ) ) + end + + def test_default_two assert( !is_valid_bst( ::TreeNode.new( diff --git a/test/medium/test_99_recover_binary_search_tree.rb b/test/medium/test_99_recover_binary_search_tree.rb index 56b059b5..f9fd4d00 100644 --- a/test/medium/test_99_recover_binary_search_tree.rb +++ b/test/medium/test_99_recover_binary_search_tree.rb @@ -6,7 +6,7 @@ require 'minitest/autorun' class RecoverBinarySearchTreeTest < ::Minitest::Test - def test_default + def test_default_one input = ::TreeNode.new( 1, ::TreeNode.new( @@ -32,7 +32,9 @@ def test_default input ) ) + end + def test_default_two input = ::TreeNode.new( 3, ::TreeNode.new(1), From 7abb7989e92810694906b6e5695bbe1cbaa8254a Mon Sep 17 00:00:00 2001 From: fartem Date: Tue, 20 Aug 2024 21:26:03 +0300 Subject: [PATCH 9/9] 2024-08-20 v. 6.5.1.1: updated some tests --- test/easy/test_2243_calculate_digit_sum_of_a_string.rb | 4 +++- .../test_2259_remove_digit_from_number_to_maximize_result.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/easy/test_2243_calculate_digit_sum_of_a_string.rb b/test/easy/test_2243_calculate_digit_sum_of_a_string.rb index a30cf04b..078fe61a 100644 --- a/test/easy/test_2243_calculate_digit_sum_of_a_string.rb +++ b/test/easy/test_2243_calculate_digit_sum_of_a_string.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# rubocop:disable Style/FrozenStringLiteralComment, Style/DisableCopsWithinSourceCodeDirective require_relative '../test_helper' require_relative '../../lib/easy/2243_calculate_digit_sum_of_a_string' @@ -9,3 +9,5 @@ def test_default_one = assert_equal('135', digit_sum('11111222223', 3)) def test_default_two = assert_equal('000', digit_sum('00000000', 3)) end + +# rubocop:enable Style/FrozenStringLiteralComment, Style/DisableCopsWithinSourceCodeDirective diff --git a/test/easy/test_2259_remove_digit_from_number_to_maximize_result.rb b/test/easy/test_2259_remove_digit_from_number_to_maximize_result.rb index 66a8844d..8f46fc65 100644 --- a/test/easy/test_2259_remove_digit_from_number_to_maximize_result.rb +++ b/test/easy/test_2259_remove_digit_from_number_to_maximize_result.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# rubocop:disable Style/FrozenStringLiteralComment, Style/DisableCopsWithinSourceCodeDirective require_relative '../test_helper' require_relative '../../lib/easy/2259_remove_digit_from_number_to_maximize_result' @@ -11,3 +11,5 @@ def test_default_two = assert_equal('231', remove_digit('1231', '1')) def test_default_three = assert_equal('51', remove_digit('551', '5')) end + +# rubocop:enable Style/FrozenStringLiteralComment, Style/DisableCopsWithinSourceCodeDirective