barelymusician/engine/instrument_test.cpp
// Tests that instrument returns parameter as expected.
Tests that instrument returns parameter as expected.
Tests that instrument returns parameter as expected .
TEST(InstrumentTest, GetParameter) {
  Instrument instrument(GetTestDefinition(), kFrameRate);
  const auto* parameter = instrument.GetParameter(0);
  EXPECT_THAT(parameter, NotNull());
  const auto& definition = parameter->GetDefinition();
  EXPECT_DOUBLE_EQ(definition.default_value, 15.0);
  EXPECT_DOUBLE_EQ(definition.min_value, 10.0);
  EXPECT_DOUBLE_EQ(definition.max_value, 20.0);
  EXPECT_DOUBLE_EQ(parameter->GetValue(), 15.0);
  EXPECT_TRUE(instrument.SetParameter(0, 20.0, 0.0, 0.0));
  EXPECT_DOUBLE_EQ(parameter->GetValue(), 20.0);
  EXPECT_TRUE(instrument.ResetParameter(0, 0.0));
  EXPECT_DOUBLE_EQ(parameter->GetValue(), 15.0);
  EXPECT_TRUE(instrument.SetParameter(0, 50.0, 0.0, 0.0));
  EXPECT_DOUBLE_EQ(parameter->GetValue(), 20.0);
  instrument.ResetAllParameters(0.0);
  EXPECT_DOUBLE_EQ(parameter->GetValue(), 15.0);
  EXPECT_THAT(instrument.GetParameter(1), IsNull());
}
TEST ( InstrumentTest , GetParameter ) { Instrument instrument ( GetTestDefinition ( ) , kFrameRate ) ; const auto * parameter = instrument . GetParameter ( 0 ) ; EXPECT_THAT ( parameter , NotNull ( ) ) ; const auto & definition = parameter -> GetDefinition ( ) ; EXPECT_DOUBLE_EQ ( definition . default_value , 15.0 ) ; EXPECT_DOUBLE_EQ ( definition . min_value , 10.0 ) ; EXPECT_DOUBLE_EQ ( definition . max_value , 20.0 ) ; EXPECT_DOUBLE_EQ ( parameter -> GetValue ( ) , 15.0 ) ; EXPECT_TRUE ( instrument . SetParameter ( 0 , 20.0 , 0.0 , 0.0 ) ) ; EXPECT_DOUBLE_EQ ( parameter -> GetValue ( ) , 20.0 ) ; EXPECT_TRUE ( instrument . ResetParameter ( 0 , 0.0 ) ) ; EXPECT_DOUBLE_EQ ( parameter -> GetValue ( ) , 15.0 ) ; EXPECT_TRUE ( instrument . SetParameter ( 0 , 50.0 , 0.0 , 0.0 ) ) ; EXPECT_DOUBLE_EQ ( parameter -> GetValue ( ) , 20.0 ) ; instrument . ResetAllParameters ( 0.0 ) ; EXPECT_DOUBLE_EQ ( parameter -> GetValue ( ) , 15.0 ) ; EXPECT_THAT ( instrument . GetParameter ( 1 ) , IsNull ( ) ) ; }
Tests that instrument returns parameter as expected.
Tests that instrument returns parameter as expected .
// Parameter does not exist.