Esempio n. 1
0
 def try_one(self, example):
     model = model_from_string(example)
     block = model.name2block['identity']
     names = block.get_output_signals_names()
     print "Obtained %s from '''%s'''" % (names, example)
     self.assertEqual(len(names), 1)
     self.assertEqual(names[0], 'x')
 def try_one(self, example):
     model = model_from_string(example)
     block = model.name2block['identity']
     names = block.get_output_signals_names()
     print "Obtained %s from '''%s'''" % (names, example)
     self.assertEqual(len(names), 1)
     self.assertEqual(names[0], 'x')
    def test1(self):
        for model_spec, config in examples_42:
            # don't pollute the main library with the block definitions
            library = Library(default_library)
            model = model_from_string(model_spec,
                                      config=config, library=library)
            
            print("Trying with '''%s'''" % model_spec)
            model.init()
            print("before")
            # at least the constant must be propagated
            assert model.has_more()
            
            while model.has_more():
                print("before iteration", model.get_output(0))
                model.update()
            model.finish()
            print("end", model.get_output(0))

            self.assertEqual(model.get_output(0), 42)