def test_crack2(self):
        w = Grammar('root   b\n'
                    'b{7}  c\n'
                    'c  1   "1"\n'
                    '   1   "2"\n'
                    '   1   "3"\n'
                    '   4   "4"')
        r = GrammarCracker(w)
        for _ in range(10):
            g = w.generate()
            nw = r.crack(g)
            ref = {}
            for c in g:
                try:
                    ref[c] += 1
                except __HOLE__:
                    ref[c] = 1
            stats = {}
            for _ in range(100):
                for c in nw.generate():
                    try:
                        stats[c] += 1
                    except KeyError:
                        stats[c] = 1
            for c, v in stats.items():
                self.assertAlmostEqual(v / 100, ref[c], 0)
dataset/ETHPy150Open blackberry/ALF/alf/fuzz/grammr2_test.py/GrammarTests.test_crack2