barelymusician/algorithm/context_free_grammar_test.cpp
// Tests that the expected sequence is generated with a given substitution rule.
Tests that the expected sequence is generated with a given substitution rule.
Tests that the expected sequence is generated with a given substitution rule .
TEST(ContextFreeGrammarTest, GenerateSequence) {
  const std::string kStartSymbol = "Start";
  const std::vector<std::string> kSubstition = {"Intro", "Chorus", "Outro"};
  ContextFreeGrammar<std::string> grammar;
  grammar.AddRule(kStartSymbol, {kSubstition});
  Random random;
  const auto sequence = grammar.GenerateSequence(kStartSymbol, random);
  EXPECT_EQ(sequence, kSubstition);
}
TEST ( ContextFreeGrammarTest , GenerateSequence ) { const std :: string kStartSymbol = " " ; const std :: vector < std :: string > kSubstition = { " " , " " , " " } ; ContextFreeGrammar < std :: string > grammar ; grammar . AddRule ( kStartSymbol , { kSubstition } ) ; Random random ; const auto sequence = grammar . GenerateSequence ( kStartSymbol , random ) ; EXPECT_EQ ( sequence , kSubstition ) ; }
Tests that the expected sequence is generated with a given substitution rule.
Tests that the expected sequence is generated with a given substitution rule .