def test_is_sorted_on_sorted_integers(self):
     # Positive test cases (examples) with lists of sorted integers
     assert is_sorted([]) is True  # Empty lists are vacuously sorted
     assert is_sorted([3]) is True  # Single item is trivially sorted
     assert is_sorted([3, 3]) is True  # Duplicate items are in order
     assert is_sorted([3, 5]) is True
     assert is_sorted([3, 5, 7]) is True
Beispiel #2
0
 def test_is_sorted_on_unsorted_strings(self):
     # Negative test cases (counterexamples) with lists of unsorted strings
     assert is_sorted(['B', 'A']) is False
     assert is_sorted(['A', 'B', 'A']) is False
     assert is_sorted(['C', 'B', 'A']) is False
     # Write more negative test cases with assert is False statements
     assert is_sorted(['Stringy', "String", "Strin"]) is False
     assert is_sorted(['Pinapples', "'"]) is False
 def test_is_sorted_on_unsorted_integers(self):
     # Negative test cases (counterexamples) with lists of unsorted integers
     assert is_sorted([5, 3]) is False
     assert is_sorted([3, 5, 3]) is False
     assert is_sorted([7, 5, 3]) is False
     assert is_sorted([
         77, 82, 26, 86, 17, 51, 31, 5, 40, 49, 13, 23, 3, 10, 64, 19, 2,
         92, 83, 61, 52, 16, 78, 55, 53, 79, 29, 97, 94, 18, 60, 24, 32, 43,
         42, 30, 57, 93, 67, 33, 6, 66, 59, 75, 69, 68, 96, 81, 11, 4
     ]) is False
 def test_is_sorted_on_unsorted_strings(self):
     # Negative test cases (counterexamples) with lists of unsorted strings
     assert is_sorted(['B', 'A']) is False
     assert is_sorted(['A', 'B', 'A']) is False
     assert is_sorted(['C', 'B', 'A']) is False
     assert is_sorted([
         'A', 'N', 'F', 'T', 'H', 'L', 'V', 'U', 'O', 'U', 'O', 'K', 'T',
         'E', 'V', 'J', 'Q', 'N', 'N', 'Y', 'U', 'J', 'Q', 'K', 'W', 'F',
         'M', 'O', 'R', 'C'
     ]) is False
 def test_is_sorted_on_sorted_strings(self):
     # Positive test cases (examples) with lists of sorted strings
     assert is_sorted(['A']) is True  # Single item is trivially sorted
     assert is_sorted(['A', 'A']) is True  # Duplicate items are in order
     assert is_sorted(['A', 'B']) is True
     assert is_sorted(['A', 'B', 'C']) is True
     assert is_sorted([
         'A', 'C', 'E', 'F', 'F', 'H', 'J', 'J', 'K', 'K', 'L', 'M', 'N',
         'N', 'N', 'O', 'O', 'O', 'Q', 'Q', 'R', 'T', 'T', 'U', 'U', 'U',
         'V', 'V', 'W', 'Y'
     ]) is True
Beispiel #6
0
 def test_is_sorted_on_unsorted_tuples(self):
     # Negative test cases (counterexamples) with lists of unsorted tuples
     assert is_sorted([(5, 'B'), (3, 'A')]) is False  # Both items unsorted
     assert is_sorted([(5, 'A'), (3, 'B')]) is False  # First item unsorted
     assert is_sorted([(3, 'B'), (3, 'A')]) is False  # Second item unsorted
     assert is_sorted([('B', 5), ('A', 3)]) is False  # Both items unsorted
     assert is_sorted([('B', 3), ('A', 5)]) is False  # First item unsorted
     assert is_sorted([('A', 5), ('A', 3)]) is False  # Second item unsorted
     assert is_sorted([('Z', 5), ('Z', 0)]) is False
     assert is_sorted([('Z', 5), ('A', 5)]) is False
     assert is_sorted([('A', 3), ('B', 1), ('A', 3)]) is False
     assert is_sorted([('A', 3), ('Z', 7), ('A', 1)]) is False
Beispiel #7
0
 def test_is_sorted_on_unsorted_strings(self):
     # Negative test cases (counterexamples) with lists of unsorted strings
     assert is_sorted(['B', 'A']) is False
     assert is_sorted(['A', 'B', 'A']) is False
     assert is_sorted(['C', 'B', 'A']) is False
     assert is_sorted(['C', 'C', 'A']) is False
     assert is_sorted(['A', 'B', 'A']) is False
     assert is_sorted(['Z', 'A', 'B']) is False
     assert is_sorted(['A', 'B', 'B', 'A']) is False
     assert is_sorted(['P', 'O', 'O']) is False
Beispiel #8
0
 def test_is_sorted_on_sorted_strings(self):
     # Positive test cases (examples) with lists of sorted strings
     assert is_sorted(['A']) is True  # Single item is trivially sorted
     assert is_sorted(['Z']) is True
     assert is_sorted(['A', 'A']) is True  # Duplicate items are in order
     assert is_sorted(['A', 'B']) is True
     assert is_sorted(['A', 'B', 'C']) is True
     assert is_sorted(['B', 'B', 'C']) is True
     assert is_sorted(['A', 'A', 'C', 'D']) is True
     assert is_sorted(['A', 'Z', 'Z']) is True
Beispiel #9
0
 def test_is_sorted_on_sorted_strings(self):
     # Positive test cases (examples) with lists of sorted strings
     assert is_sorted(['A']) is True  # Single item is trivially sorted
     assert is_sorted(['A', 'A']) is True  # Duplicate items are in order
     assert is_sorted(['A', 'B']) is True
     assert is_sorted(['A', 'B', 'C']) is True
     #Wrote More tests
     assert is_sorted(["B", "C", "A"]) is False
     assert is_sorted(["B", "c", "A"]) is False
     assert is_sorted(["r", "S", "T", "r", "S", "T"]) is False
     assert is_sorted(["98", "A", "a", "b"]) is True
Beispiel #10
0
 def test_is_sorted_on_sorted_integers(self):
     # Positive test cases (examples) with lists of sorted integers
     assert is_sorted([]) is True  # Empty lists are vacuously sorted
     assert is_sorted([3]) is True  # Single item is trivially sorted
     assert is_sorted([3, 3]) is True  # Duplicate items are in order
     assert is_sorted([3, 5]) is True
     assert is_sorted([3, 5, 7]) is True
     # Write more positive test cases with assert is True statements
     assert is_sorted([0, 1, 10, 100])
     assert is_sorted([-2, -1, 0])
     assert is_sorted([1234, 12345, 123456])
Beispiel #11
0
 def test_is_sorted_on_unsorted_tuples(self):
     # Negative test cases (counterexamples) with lists of unsorted tuples
     assert is_sorted([(5, 'B'), (3, 'A')]) is False  # Both items unsorted
     assert is_sorted([(5, 'A'), (3, 'B')]) is False  # First item unsorted
     assert is_sorted([(3, 'B'), (3, 'A')]) is False  # Second item unsorted
     assert is_sorted([('B', 5), ('A', 3)]) is False  # Both items unsorted
     assert is_sorted([('B', 3), ('A', 5)]) is False  # First item unsorted
     assert is_sorted([('A', 5), ('A', 3)]) is False  # Second item unsorted
     # Write more negative test cases with assert is False statements
     assert is_sorted([(3, 3), (4, 3), (3, 3)]) is False
     assert is_sorted([("The", "CAT"), ("Is", 3), ("Carosel", 0)]) is False
    def test_is_sorted_on_sorted_integers(self):
        # Positive test cases (examples) with lists of sorted integers
        assert is_sorted([]) is True  # Empty lists are vacuously sorted
        assert is_sorted([3]) is True  # Single item is trivially sorted
        assert is_sorted([3, 3]) is True  # Duplicate items are in order
        assert is_sorted([3, 5]) is True
        assert is_sorted([3, 5, 7]) is True
        # Write more positive test cases with assert is True statements
        # You'll need a lot more than this to test sorting algorithm robustness

        # Let's go for negatives
        assert is_sorted([-4, -3, -2, -1]) is True
        assert is_sorted([-4, -4, -4, -4]) is True
        assert is_sorted([-4, 0, 4]) is True
        assert is_sorted([-4, 0, -0, 4]) is True
Beispiel #13
0
 def test_is_sorted_on_sorted_strings(self):
     # Positive test cases (examples) with lists of sorted strings
     assert is_sorted(['A']) is True  # Single item is trivially sorted
     assert is_sorted(['A', 'A']) is True  # Duplicate items are in order
     assert is_sorted(['A', 'B']) is True
     assert is_sorted(['A', 'B', 'C']) is True
     # Write more positive test cases with assert is True statements
     # You'll need a lot more than this to test sorting algorithm robustness
     assert is_sorted(['A', 'B', 'C', 'Z']) is True
     assert is_sorted(['A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B']) is True
     assert is_sorted(['A', 'AB', 'AC']) is True
Beispiel #14
0
 def test_is_sorted_on_unsorted_integers(self):
     # Negative test cases (counterexamples) with lists of unsorted integers
     assert is_sorted([5, 3]) is False
     assert is_sorted([3, 5, 3]) is False
     assert is_sorted([7, 5, 3]) is False
     assert is_sorted([1, 3, 5, 9, 7]) is False
     assert is_sorted([3, 3, 3, 7, 5]) is False
     assert is_sorted([2, 4, 2]) is False
Beispiel #15
0
 def test_is_sorted_on_unsorted_integers(self):
     # Negative test cases (counterexamples) with lists of unsorted integers
     assert is_sorted([5, 3]) is False
     assert is_sorted([3, 5, 3]) is False
     assert is_sorted([7, 5, 3]) is False
     # Write more negative test cases with assert is False statements
     # You'll need a lot more than this to test sorting algorithm robustness
     assert is_sorted([7, 5, 3, 4]) is False
     assert is_sorted([-1, 0, 7, 5, 3]) is False
     assert is_sorted([5, 5, 3, 3, 3]) is False
     assert is_sorted([1, 2, 3, 2
                       ]) is False  # All numbers except last are sorted
Beispiel #16
0
 def test_is_sorted_on_unsorted_integers(self):
     # Negative test cases (counterexamples) with lists of unsorted integers
     assert is_sorted([5, 3]) is False
     assert is_sorted([3, 5, 3]) is False
     assert is_sorted([7, 5, 3]) is False
     # Write more negative test cases with assert is False statements
     assert is_sorted([5577, 577, 77]) is False
     assert is_sorted([0, 1, 2, 3, 0]) is False
     assert is_sorted([22, 222, 2222, 2]) is False
 def test_is_sorted_on_unsorted_strings(self):
     # Negative test cases (counterexamples) with lists of unsorted strings
     assert is_sorted(['B', 'A']) is False
     assert is_sorted(['A', 'B', 'A']) is False
     assert is_sorted(['C', 'B', 'A']) is False
     # Write more negative test cases with assert is False statements
     # You'll need a lot more than this to test sorting algorithm robustness
     # Multiple
     assert is_sorted(['CCC', 'BBB', 'AAA']) is False
     assert is_sorted(['CCCC', 'CCC', 'C']) is False
     # Lowercase
     assert is_sorted(['c', 'b', 'a']) is False
     assert is_sorted(['c', 'c', 'a']) is False
 def test_is_sorted_on_sorted_integers(self):
     # Positive test cases (examples) with lists of sorted integers
     assert is_sorted([]) is True  # Empty lists are vacuously sorted
     assert is_sorted([3]) is True  # Single item is trivially sorted
     assert is_sorted([3, 3]) is True  # Duplicate items are in order
     assert is_sorted([3, 5]) is True
     assert is_sorted([3, 5, 7]) is True
     # TODO: Write more positive test cases with assert is True statements
     # You'll need a lot more than this to test sorting algorithm robustness
     # ...
     assert is_sorted([1, 3, 3, 3, 3, 6, 3, 4, 6]) is False
 def test_is_sorted_on_unsorted_integers(self):
     # Negative test cases (counterexamples) with lists of unsorted integers
     assert is_sorted([5, 3]) is False
     assert is_sorted([3, 5, 3]) is False
     assert is_sorted([7, 5, 3]) is False
     # TODO: Write more negative test cases with assert is False statements
     # You'll need a lot more than this to test sorting algorithm robustness
     # MORE negatives
     assert is_sorted([-11, 3, 2]) is False
     assert is_sorted([2, -1, 1, 1]) is False
     assert is_sorted([4, -3, 2, -1]) is False
 def test_is_sorted_on_sorted_integers(self):
     # Positive test cases (examples) with lists of sorted integers
     assert is_sorted([]) is True  # Empty lists are vacuously sorted
     assert is_sorted([3]) is True  # Single item is trivially sorted
     assert is_sorted([3, 3]) is True  # Duplicate items are in order
     assert is_sorted([3, 5]) is True
     assert is_sorted([3, 5, 7]) is True
     assert is_sorted([
         2, 3, 4, 7, 8, 11, 14, 19, 20, 23, 24, 25, 33, 34, 36, 39, 41, 42,
         47, 48, 50, 52, 53, 56, 57, 59, 60, 61, 62, 63, 66, 67, 70, 71, 72,
         75, 76, 77, 78, 79, 84, 85, 86, 89, 90, 91, 92, 93, 96, 99
     ]) is True
 def test_is_sorted_on_sorted_tuples(self):
     # Positive test cases (examples) with lists of sorted tuples
     assert is_sorted([(3, 5)]) is True  # Single item
     assert is_sorted([(3, 'A')]) is True  # Single item
     assert is_sorted([('A', 3)]) is True  # Single item
     assert is_sorted([('A', 'B')]) is True  # Single item
     assert is_sorted([(3, 5), (3, 5)]) is True  # Duplicate items
     assert is_sorted([(3, 'A'), (3, 'A')]) is True  # Duplicate items
     assert is_sorted([('A', 3), ('A', 3)]) is True  # Duplicate items
     assert is_sorted([('A', 'B'), ('A', 'B')]) is True  # Duplicate items
     assert is_sorted([('A', 3), ('B', 5)]) is True  # Both items sorted
     assert is_sorted([('A', 3), ('B', 3)]) is True  # First item sorted
     assert is_sorted([('A', 3), ('A', 5)]) is True  # Second item sorted
     assert is_sorted([(3, 'A'), (5, 'B')]) is True  # Both items sorted
     assert is_sorted([(3, 'A'), (5, 'A')]) is True  # First item sorted
     assert is_sorted([(3, 'A'), (3, 'B')]) is True  # Second item sorted
    def test_is_sorted_on_sorted_strings(self):
        # Positive test cases (examples) with lists of sorted strings
        assert is_sorted(['A']) is True  # Single item is trivially sorted
        assert is_sorted(['A', 'A']) is True  # Duplicate items are in order
        assert is_sorted(['A', 'B']) is True
        assert is_sorted(['A', 'B', 'C']) is True
        # TODO: Write more positive test cases with assert is True statements
        # You'll need a lot more than this to test sorting algorithm robustness
        # Multiple
        assert is_sorted(['AA', 'BB', 'CC']) is True
        assert is_sorted(['AA', 'BA', 'CA']) is True
        assert is_sorted(['AAAA', 'BB', 'CCC']) is True
        assert is_sorted(['AA', 'AAA', 'AAAA']) is True

        # lowercase
        assert is_sorted(['a', 'b', 'c']) is True
        assert is_sorted(['a', 'a', 'c']) is True
        # Mixed
        assert is_sorted(['A', 'a', 'b']) is True
        assert is_sorted(['C', 'a', 'b']) is True
Beispiel #23
0
def test_sort(ary):
    assert not is_sorted(ary)
    sorting.sort(ary)
    assert is_sorted(ary)
Beispiel #24
0
def test_is_sorted(ary):
    assert not is_sorted(ary)
    ary.sort()
    assert is_sorted(ary)
Beispiel #25
0
 def test_is_sorted_on_sorted_tuples(self):
     # Positive test cases (examples) with lists of sorted tuples
     assert is_sorted([(3, 5)]) is True  # Single item
     assert is_sorted([(3, 'A')]) is True  # Single item
     assert is_sorted([('A', 3)]) is True  # Single item
     assert is_sorted([('A', 'B')]) is True  # Single item
     assert is_sorted([(3, 5), (3, 5)]) is True  # Duplicate items
     assert is_sorted([(3, 'A'), (3, 'A')]) is True  # Duplicate items
     assert is_sorted([('A', 3), ('A', 3)]) is True  # Duplicate items
     assert is_sorted([('A', 'B'), ('A', 'B')]) is True  # Duplicate items
     assert is_sorted([('A', 3), ('B', 5)]) is True  # Both items sorted
     assert is_sorted([('A', 3), ('B', 3)]) is True  # First item sorted
     assert is_sorted([('A', 3), ('A', 5)]) is True  # Second item sorted
     assert is_sorted([(3, 'A'), (5, 'B')]) is True  # Both items sorted
     assert is_sorted([(3, 'A'), (5, 'A')]) is True  # First item sorted
     assert is_sorted([(3, 'A'), (3, 'B')]) is True  # Second item sorted
     #Write more positive test cases with assert is True statements
     assert is_sorted([(3, 3), (3, 4), (4, 3)]) is True
     assert is_sorted([("ABA", 3), ("ABB", 3), ("ABB", 3)]) is True