def test_nClosest_3(): tag_a.initialize(1,3,9,-1) tag_b.initialize(2,4,2,6) tag_c.initialize(3,9,6,1) tag_d.initialize(4,2,5,12) missing = Rfid_tag(11) missing.initialize(5,5,5,1) myList = [tag_a, tag_b, tag_c, tag_d] answer = nClosest(4, myList, missing) assert answer[3][1].getID() == 2 assert answer[3] == [tag_c, tag_b] print "\n\nnClosest_TEST3: PASS :)"
def test_nClosest_2(): tag_a.initialize(1,3,9,7) tag_b.initialize(2,4,2,6) tag_c.initialize(3,9,6,1) tag_d.initialize(4,2,5,12) missing = Rfid_tag(11) missing.initialize(5,5,5,5) myList = [tag_a, tag_b, tag_c, tag_d] answer = nClosest(4, myList, missing) assert answer[0] == [tag_d, tag_c] assert answer[1] == [tag_b, tag_a] assert answer[2] == [tag_d, tag_c] assert answer[3] == [tag_b, tag_a] print "\n\nnClosest_TEST2: PASS :)"
def test_nClosest_1(): tag_a.initialize(1,3,9,7) tag_b.initialize(2,4,2,6) tag_c.initialize(2,9,6,1) tag_d.initialize(4,2,5,12) tag_e.initialize(3,6,2,1) tag_f.initialize(2,4,2,5) tag_g.initialize(9,8,5,2) tag_h.initialize(1,3,1,9) tag_i.initialize(4,2,3,1) missing = Rfid_tag(11) missing.initialize(5,5,5,5) myList = [tag_a, tag_b, tag_c, tag_d, tag_e, tag_f, tag_g, tag_h, tag_i] solutionDict = nClosest(4, myList, missing) assert len(solutionDict) == 4 # assert solutionDict[0] == [tag_d, tag_i, tag_e] assert solutionDict[1] == [tag_b,tag_e, tag_f] assert solutionDict[2] == [tag_d, tag_g, tag_c] assert solutionDict[3] == [tag_f, tag_b, tag_a] print "\n\nnClosest_TEST1: PASS :)"