hellcdvsra

This commit is contained in:
soybby 2020-04-26 22:50:52 +02:00
parent c676b93150
commit 276239ee0d

66
routeTests.py Normal file
View File

@ -0,0 +1,66 @@
import numpy as np
import math
import unittest
from route1 import distance, Agent, change_value, check_done
import pygame
class DistanceTest(unittest.TestCase):
def test_distance(self):
result=distance([2,3],[4,5])
self.assertEqual(result, 2.8284271247461903)
result2 = distance([4, 8], [2, 12])
self.assertEqual(result, 2.8284271247461903)
result3 = distance([12,5], [6.3,5.88])
self.assertEqual(result3,5.76752980052986 )
def test_empty_distance(self):
result=distance([0,0],[0,0])
self.assertEqual(result,0.0)
result2 = distance([1,1], [1,1])
self.assertEqual(result2, 0.0)
result3 = distance([8,8], [8,8])
self.assertEqual(result3,0.0)
def test_minus_values(self):
result = distance([-3, -4], [-12, -4])
self.assertEqual(result, 9.0)
result2 = distance([-1.4, -2.13], [-1.2, -9.2])
self.assertEqual(result2, 7.072828288598557)
result3 = distance([8, -2.8], [2, -9.33])
self.assertEqual(result3, 8.867970455521377)
class ValueTest(unittest.TestCase):
def test_change_value_table(self):
result=change_value(2,2,2,1)
self.assertIsNone(result)
result2=change_value(2,12,2,1)
self.assertIsNone(result2)
result3 = change_value(7, 12, 2, 1)
self.assertIsNone(result3)
def test_change_value_kitchen(self):
result = change_value(13, 13, 3, 2)
self.assertIsNone(result)
def test_change_value_agent(self):
result = change_value(12, 12, 1, 3)
self.assertIsNone(result)
if __name__ == '__main__':
unittest.main()