示例#1
0
    def test_linear_search(self):
        L = [1, 2, 3, 4, 5, 6]

        r = get_tissue_samples.linear_search(3, L)
        self.assertEqual(r, 2)

        r = get_tissue_samples.linear_search(10, L)
        self.assertEqual(r, -1)
示例#2
0
 def test_linear_search(self):
     L = [0, 1, 2, 3]
     # First test whether we return the first key location
     r = get_tissue_samples.linear_search(0, L)
     self.assertEqual(r, 0)
     # then test whether we return a last value
     r = get_tissue_samples.linear_search(3, L)
     self.assertEqual(r, 3)
     # Then whether we get a -1 if the value isn't present
     r = get_tissue_samples.linear_search(5, L)
     self.assertEqual(r, -1)
 def test_linear_search_with_val(self):
     res = get_tissue_samples.linear_search(3, self.linear_data)
     self.assertEqual(res, 1)
 def test_linear_search_empty_list(self):
     res = get_tissue_samples.linear_search(0, [])
     self.assertEqual(res, -1)
示例#5
0
 def test_linear_search(self):
     '''Test for linear search'''
     L = [2, 4, 5, 6, 7, 8]
     self.assertEqual(pg.linear_search(4, L), 1)
示例#6
0
 def test_linear_search_not_found(self):
     '''Test for linear search'''
     L = [2, 4, 5, 6, 7, 8]
     self.assertEqual(pg.linear_search(1, L), -1)
示例#7
0
 def test_linear_search_empty(self):
     '''Test for linear search'''
     L = []
     self.assertEqual(pg.linear_search(4, L), -1)