barelymusician/engine/conductor_test.cpp
// Tests that conductor transforms note as expected.
Tests that conductor transforms note as expected.
Tests that conductor transforms note as expected .
TEST(ConductorTest, TransformNote) {
  const Note kNote = {4.0, -0.5, 1.0};
  const Note::Definition kDefinition = Note::Definition(
      kNote.duration, Note::PitchDefinition::AbsolutePitch(kNote.pitch),
      kNote.intensity);
  Conductor conductor;
  EXPECT_EQ(conductor.TransformNote(kDefinition, false), kNote);
  EXPECT_EQ(conductor.TransformNote(kDefinition, true), kNote);
  conductor.SetAdjustNoteCallback([](Note::Definition* definition) {
    definition->duration += 0.5;
    definition->pitch.absolute_pitch *= 2.0;
    definition->intensity = 0.1;
  });
  EXPECT_EQ(conductor.TransformNote(kDefinition, false),
            Note(kNote.duration + 0.5, kNote.pitch * 2.0, 0.1));
  EXPECT_EQ(conductor.TransformNote(kDefinition, true), kNote);
}
TEST ( ConductorTest , TransformNote ) { const Note kNote = { 4.0 , -0.5 , 1.0 } ; const Note :: Definition kDefinition = Note :: Definition ( kNote . duration , Note :: PitchDefinition :: AbsolutePitch ( kNote . pitch ) , kNote . intensity ) ; Conductor conductor ; EXPECT_EQ ( conductor . TransformNote ( kDefinition , false ) , kNote ) ; EXPECT_EQ ( conductor . TransformNote ( kDefinition , true ) , kNote ) ; conductor . SetAdjustNoteCallback ( [ ] ( Note :: Definition * definition ) { definition -> duration += 0.5 ; definition -> pitch . absolute_pitch *= 2.0 ; definition -> intensity = 0.1 ; } ) ; EXPECT_EQ ( conductor . TransformNote ( kDefinition , false ) , Note ( kNote . duration + 0.5 , kNote . pitch * 2.0 , 0.1 ) ) ; EXPECT_EQ ( conductor . TransformNote ( kDefinition , true ) , kNote ) ; }
Tests that conductor transforms note as expected.
Tests that conductor transforms note as expected .