MCPcopy Create free account
hub / github.com/approvals/ApprovalTests.cpp / Greeting

Class Greeting

tests/DocTest_Tests/docs/DocTestDocsSamples.cpp:15–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13};
14
15struct Greeting
16{
17 Nationality nationality;
18 explicit Greeting() : nationality(British)
19 {
20 }
21
22 explicit Greeting(Nationality nationality_) : nationality(nationality_)
23 {
24 }
25
26 std::string getGreeting() const
27 {
28 return getGreetingFor(nationality);
29 }
30
31 std::string getGreetingFor(Nationality aNationality) const
32 {
33 switch (aNationality)
34 {
35 case British:
36 return "Cheers";
37 case American:
38 return "Howdy";
39 case French:
40 return "Bonjour";
41 default:
42 return "Unknown";
43 }
44 }
45
46 std::string getNationality() const
47 {
48 switch (nationality)
49 {
50 case British:
51 return "British";
52 case American:
53 return "American";
54 case French:
55 return "French";
56 default:
57 return "Unknown";
58 }
59 }
60};
61
62// begin-snippet: doctest_multiple_output_files_hard_coded
63TEST_CASE("MultipleOutputFiles-ForOneObject")

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected