Beispiel #1
0
 def test_bblsort_empty(self):
     val = tuple()
     result = bblSort(val)
     self.assertNotEqual(result,
                         None)  # Check that function does return something
     self.assertEqual(len(val),
                      len(result))  # Check that no elements were lost
     self.assertTupleEqual(
         result, ())  # Check that function returns the correct thing
Beispiel #2
0
 def test_bblSort_twoElNotSorted(self):
     val = (2, 1)
     result = bblSort(val)
     self.assertNotEqual(result,
                         None)  # Check that function does return something
     self.assertEqual(len(val),
                      len(result))  # Check that no elements were lost
     self.assertTupleEqual(
         result, (1, 2))  # Check that function returns the correct thing
Beispiel #3
0
 def test_bblSort_fiveElDupes(self):
     val = (7, 3, 7, 42, 42)
     result = bblSort(val)
     self.assertNotEqual(result,
                         None)  # Check that function does return something
     self.assertEqual(len(val),
                      len(result))  # Check that no elements were lost
     self.assertTupleEqual(
         result,
         (3, 7, 7, 42, 42))  # Check that function returns the correct thing
Beispiel #4
0
 def test_bblSort_fiveElReversed(self):
     val = (13, 11, 7, 5, 3)
     result = bblSort(val)
     self.assertNotEqual(result,
                         None)  # Check that function does return something
     self.assertEqual(len(val),
                      len(result))  # Check that no elements were lost
     self.assertTupleEqual(
         result,
         (3, 5, 7, 11, 13))  # Check that function returns the correct thing
Beispiel #5
0
 def test_bblSort_stringsfiveElDupes(self):
     val = ('echo', 'charlie', 'echo', 'zulu', 'zulu')
     result = bblSort(val)
     self.assertNotEqual(result,
                         None)  # Check that function does return something
     self.assertEqual(len(val),
                      len(result))  # Check that no elements were lost
     self.assertTupleEqual(
         result, ('charlie', 'echo', 'echo', 'zulu',
                  'zulu'))  # Check that function returns the correct thing
Beispiel #6
0
 def test_bblSort_stringsfiveElReversed(self):
     val = ('echo', 'delta', 'charlie', 'bravo', 'alpha')
     result = bblSort(val)
     self.assertNotEqual(result,
                         None)  # Check that function does return something
     self.assertEqual(len(val),
                      len(result))  # Check that no elements were lost
     self.assertTupleEqual(
         result, ('alpha', 'bravo', 'charlie', 'delta',
                  'echo'))  # Check that function returns the correct thing
Beispiel #7
0
 def test_bblsort_stringstwoElAlreadySorted(self):
     val = ('alice', 'bob')
     result = bblSort(val)
     self.assertNotEqual(result,
                         None)  # Check that function does return something
     self.assertEqual(len(val),
                      len(result))  # Check that no elements were lost
     self.assertTupleEqual(
         result,
         ('alice', 'bob'))  # Check that function returns the correct thing