コード例 #1
0
ファイル: main.py プロジェクト: stillbreeze/UnifiedTech-test
	elif choice=='2':
		user1,user2 = raw_input("Enter the usernames of each user seperated by a tab:\t").split('\t')
		c = createFriends(user1,user2,g,m)
		if c.makeLinks():
			print "Friendship link established"
		else:
			print "Either user doesn't exist or both names given are the same"
	elif choice=='3':
		print "Enter names seperated by Enter key. Press 0 to stop\n\n"
		l=[]
		while 1:
			temp=raw_input("Enter name:\t")
			if temp=='0':
				break
			l.append(temp)
		d = checkConnectivity(l,g,m)
		temp = d.check()
		if temp==-1:
			print "User doesn't exist"
		elif temp==0:
			print "Given network of users are not connected"
		else:
			print "Given network of users are connected"
	elif choice=='4':
		user1,user2 = raw_input("Enter the usernames of each user seperated by a tab:\t").split('\t')
		e = getDegree(user1,user2,g,m)
		temp = e.get()
		if temp==-1:
			print "User doesn't exist"
		elif temp==0:
			print "Given network of users are not connected"
コード例 #2
0
ファイル: tests.py プロジェクト: stillbreeze/UnifiedTech-test
else:
	print "TEST CASE FAILED"

c = createFriends("Abraham Lincoln","Stephen Hawking",g,m)
if c.makeLinks():
	print "Link added successfully"
else:
	print "TEST CASE FAILED"


print "\n\nTesting connectivity:\n"



userlist=["Immanuel Kant","Bertrand Russel"]
d = checkConnectivity(userlist,g,m)
if d.check():
	print "TEST CASE PASSED"
else:
	print "TEST CASE FAILED"

userlist=["Elon Musk","Voltaire","Abraham Lincoln"]
d = checkConnectivity(userlist,g,m)
if not d.check():
	print "TEST CASE PASSED"
else:
	print "TEST CASE FAILED"

userlist=["Immanuel Kant","Bertrand Russel","Stephen Hawking","Steve Jobs"]
d = checkConnectivity(userlist,g,m)
if not d.check():