def test_sum_too_small(self): # Initialize parameters north_percentage = 5 east_percentage = 10 south_percentage = 20 west_percentage = 15 try: # Create wind settings particleframework.WindSettings(north_percentage, east_percentage, south_percentage, west_percentage) self.fail() except Exception as e: self.assertIsNotNone(e)
def test_get_next_east(self): # Initialize parameters north_percentage = 0 east_percentage = 100 south_percentage = 0 west_percentage = 0 # Create wind settings wind_settings = particleframework.WindSettings(north_percentage, east_percentage, south_percentage, west_percentage) # Verify the next direction next_direction = wind_settings.get_next() self.assertEqual(next_direction, particleframework.Direction.EAST)
def test_init(self): # Initialize parameters north_percentage = 5 east_percentage = 10 south_percentage = 20 west_percentage = 65 # Create wind settings wind_settings = particleframework.WindSettings(north_percentage, east_percentage, south_percentage, west_percentage) # Verify the wind settings self.assertIsNotNone(wind_settings) self.assertEqual(wind_settings.north_percentage, north_percentage) self.assertEqual(wind_settings.east_percentage, east_percentage) self.assertEqual(wind_settings.south_percentage, south_percentage) self.assertEqual(wind_settings.west_percentage, west_percentage)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Particle unit tests @author: Anthony Jarrett """ import unittest from python.src.simulation import particleframework # Initialize test parameters TEST_PARTICLE_FALL_SETTINGS = particleframework.ParticleFallSettings() TEST_WIND_SETTINGS = particleframework.WindSettings() TEST_POSITION = particleframework.Position(1, 2) TEST_BUILDING_HEIGHT = 12 class ParticleTestCase(unittest.TestCase): def test_init(self): # Create test particle particle = ParticleTestCase.create_particle() # Verify particle state self.assertIsNotNone(particle) self.assertTrue( particle._particle_fall_settings.equals( TEST_PARTICLE_FALL_SETTINGS)) self.assertTrue(particle._wind_settings.equals(TEST_WIND_SETTINGS))