Skip to content

Conversation

@mnajibi
Copy link

@mnajibi mnajibi commented Dec 10, 2023

Description

This Pull Request introduces the first set of unit tests for the Proportions Controlling Genetic Algorithm (PCGA). Issue-1 The new tests are designed to ensure the correctness and reliability of key functionalities within the algorithm. This initial test suite focuses on the basic functionality of helper methods and core components of the PCGA class.

Changes

  • test_helper_functions.py:

    • Added test_count_to_proportions to validate the conversion from counts to proportions.
  • test_proportions_controlling_ga.py:

    • Added test_pcga_initialization to ensure the ProportionsControllingGA class initializes correctly with the provided parameters.
    • Added test_calculate_fitness_value to test the fitness value calculation logic within the ProportionsControllingGA class.

Impact

  • Code Quality and Reliability: The introduction of these tests increases the robustness of the PCGA codebase by catching potential bugs and ensuring that core functionalities behave as expected.
  • Maintainability: With these tests in place, it will be easier and safer to refactor or add new features to the PCGA project in the future.

Testing

  • The tests were executed using pytest, and all tests passed successfully.
    image

  • These tests are a starting point, and additional tests will be added in the future to cover more aspects of the algorithm.

How to Test

  1. Fetch the latest changes from the PR branch.
  2. Install pytest if it's not already installed: pip install pytest.
  3. Run pytest in the terminal from the root directory of the project.
  4. Verify that all tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant