__init__.py 838 B

12345678910111213141516171819202122232425262728293031323334
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. """
  3. Randomize all dependent choices
  4. This is a somewhat tricky case for randconfig; the visibility of one choice is
  5. determined by a member of another choice. Randconfig should be able to generate
  6. all possible patterns.
  7. """
  8. def test(conf):
  9. expected0 = False
  10. expected1 = False
  11. expected2 = False
  12. for i in range(100):
  13. assert conf.randconfig(seed=i) == 0
  14. if conf.config_matches('expected_config0'):
  15. expected0 = True
  16. elif conf.config_matches('expected_config1'):
  17. expected1 = True
  18. elif conf.config_matches('expected_config2'):
  19. expected2 = True
  20. else:
  21. assert False
  22. if expected0 and expected1 and expected2:
  23. break
  24. assert expected0
  25. assert expected1
  26. assert expected2