def test_wrap_to_system(self): system = WrapToSystem(2) system.set_interval(1, 1., 2.) context = system.CreateDefaultContext() output = system.AllocateOutput() def mytest(input, expected): context.FixInputPort(0, BasicVector(input)) system.CalcOutput(context, output) self.assertTrue(np.allclose(output.get_vector_data( 0).CopyToVector(), expected)) mytest((-1.5, 0.5), (-1.5, 1.5)) mytest((.2, .3), (.2, 1.3))
def test_wrap_to_system(self): system = WrapToSystem(2) system.set_interval(1, 1., 2.) context = system.CreateDefaultContext() output = system.AllocateOutput() def mytest(input, expected): system.get_input_port(0).FixValue(context, input) system.CalcOutput(context, output) self.assertTrue(np.allclose(output.get_vector_data( 0).CopyToVector(), expected)) mytest((-1.5, 0.5), (-1.5, 1.5)) mytest((.2, .3), (.2, 1.3))