import unittest
import a1
import sound

#For each of these variables, element 0 is the list used to generate the
#input sample and element 1 is the list used to generate the expected output

rem_vocals1 = [
[[-5,11], [11,-5], [3,3], [8,4]],
[[-8, -8], [8, 8], [0, 0], [2, 2]]]

rem_vocals2 = [
[[-5,11], [11,-5], [3,3]],
[[-8, -8], [8, 8], [0, 0]]]


def make_sound (lst):
  '''Return a sound object from List lst of sample values. Each element of
  lst is a 2-element list where the first is the left channel value and
  the second is the right channel value. '''

  snd = sound.create_sound (len(lst))
  for i in range(len(lst)):
    samp = sound.get_sample (snd, i)
    sound.set_left (samp, lst[i][0])
    sound.set_right (samp, lst[i][1])
  return snd
  

class TestCases(unittest.TestCase):

  def setUp(self):
    pass
  
  def test_rem_vocals_basic(self):
    '''basic test no floating point, sound of 4 samples.'''
    snd = make_sound (rem_vocals1[0])
    sol = make_sound (rem_vocals1[1])
    student = a1.rem_vocals (snd)
    self.assertEqual (student, sol)    

  def test_rem_vocals_basic2(self):
    '''basic test no floating point, sound of 3 samples.'''
    snd = make_sound (rem_vocals2[0])
    sol = make_sound (rem_vocals2[1])
    student = a1.rem_vocals (snd)
    self.assertEqual (student, sol)

if __name__ == '__main__':
    unittest.main()

