MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / expectSyntaxChangeAfter

Function expectSyntaxChangeAfter

test/Particles.cpp:422–437  ·  view source on GitHub ↗

Assumes that the syntax changes after performing the given action on the named particle Optionally calls the given predicate with the syntax after the change

Source from the content-addressed store, hash-verified

420// Assumes that the syntax changes after performing the given action on the named particle
421// Optionally calls the given predicate with the syntax after the change
422inline void expectSyntaxChangeAfter(const std::string& defName,
423 std::function<void(const particles::IParticleDef::Ptr&)> action,
424 std::function<void(const std::string&)> predicate = [](const std::string&) { })
425{
426 auto decl = GlobalParticlesManager().getDefByName(defName);
427 auto blockSyntaxBeforeChange = decl->getBlockSyntax().contents;
428
429 action(decl);
430
431 // Block syntax should have changed by now
432 auto blockSyntaxAfterChange = decl->getBlockSyntax().contents;
433
434 EXPECT_NE(blockSyntaxBeforeChange, blockSyntaxAfterChange) << "Syntax block should have changed";
435
436 predicate(blockSyntaxAfterChange);
437}
438
439TEST_F(ParticlesTest, SyntaxChangeAddStage)
440{

Callers 1

TEST_FFunction · 0.85

Calls 1

getDefByNameMethod · 0.80

Tested by

no test coverage detected