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