MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / simplifyCoroutines

Method simplifyCoroutines

test/testtokenize.cpp:8519–8533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8517 }
8518
8519 void simplifyCoroutines() {
8520 const Settings settings = settingsBuilder().cpp(Standards::CPP20).build();
8521
8522 const char code1[] = "generator<int> f() { co_yield start++; }";
8523 const char expected1[] = "generator < int > f ( ) { co_yield ( start ++ ) ; }";
8524 ASSERT_EQUALS(expected1, tokenizeAndStringify(code1, settings));
8525
8526 const char code2[] = "task<> f() { co_await foo(); }";
8527 const char expected2[] = "task < > f ( ) { co_await ( foo ( ) ) ; }";
8528 ASSERT_EQUALS(expected2, tokenizeAndStringify(code2, settings));
8529
8530 const char code3[] = "generator<int> f() { co_return 7; }";
8531 const char expected3[] = "generator < int > f ( ) { co_return ( 7 ) ; }";
8532 ASSERT_EQUALS(expected3, tokenizeAndStringify(code3, settings));
8533 }
8534
8535 void simplifySpaceshipOperator() {
8536 const Settings settings = settingsBuilder().cpp(Standards::CPP20).build();

Callers

nothing calls this directly

Calls 2

buildMethod · 0.80
cppMethod · 0.80

Tested by

no test coverage detected