예제 #1
0
    def test_junc(self):
        for num, curve in enumerate(self.curves):
            if num == 0:
                pcurve = curve.forget(allow_time_rev=True)
            else:
                pcurve = curve.forget()

            junc_info = pcurve.get_junctions_info()
            for junc in junc_info:
                if any(dx not in set([0, 1, -1]) for dx in junc.delta_x):
                    raise Exception("Bad delta!")

            for curve in FractalCurve.gen_possible_curves(pcurve):
                juncs = curve.get_junctions()
                # проверяем, что для каждого найденного стыка есть порождающая кривая
                for junc in juncs:
                    if junc not in junc_info:
                        raise Exception("Unknown junc!")
                    if not any(
                            curve.is_specialization(tmpl)
                            for tmpl in junc_info[junc]):
                        raise Exception("Can't found consistent curve!")

                # проверяем, что для каждого не найденного стыка нет порождающих кривых
                for junc, curves in junc_info.items():
                    if junc in juncs:
                        continue
                    if any(
                            curve.is_specialization(tmpl)
                            for tmpl in junc_info[junc]):
                        raise Exception(
                            "Found consistent curve for wrong junc!")
예제 #2
0
    def test_curves(self):
        for curve in self.curves:
            pcurve = curve.forget()
            rrcurve = pcurve.reverse().reverse()
            self.assertEqual(pcurve.proto, rrcurve.proto)
            self.assertEqual(pcurve.bm_info(), rrcurve.bm_info())

        for curve in self.curves:
            pcurve = curve.forget(allow_time_rev=True)
            cnum = 0
            for bm in pcurve.gen_allowed_maps(cnum):
                scurve = pcurve.specify(cnum, bm)
                piece = scurve.get_fraction(cnum)

        curve0 = self.curves[0].forget()
        for c in FractalCurve.gen_possible_curves(curve0):
            c.check()

        curve0 = self.curves[0].forget(allow_time_rev=True)
        for c in FractalCurve.gen_possible_curves(curve0):
            c.check()
예제 #3
0
    def test_curves(self):
        for pcurve in self.curves:
            for curve in FractalCurve.gen_possible_curves(pcurve):
                adapter = CurveSATAdapter(dim=pcurve.dim)
                adapter.init_curve(pcurve)
                model = adapter.get_model_from_curve(curve)
                juncs = curve.get_junctions()
                for junc in juncs:
                    junc_var = adapter.get_junc_var(junc)
                    if not model[junc_var]:
                        raise Exception("Bad junc_var: False for existent junc!")
#                for junc in junc_info:
#                    if junc not in juncs:
#                        junc_var = adapter.get_junc_var(junc)
#                        if model[junc_var]:
#                            raise Exception("Bad junc_var: True for non-existent junc!")
                print('.', end='', flush=True)

            print('*', flush=True)