October 2013
Intermediate to advanced
368 pages
9h 20m
English
Since we’re ready to check in, let’s take a look at our solution. We decide that we don’t yet have a compelling reason to split out an implementation (.cpp) file, though that might be an essential part of making it production-ready in your system.
| c2/40/SoundexTest.cpp | |
| | #include "gmock/gmock.h" |
| | #include "Soundex.h" |
| | using namespace testing; |
| | |
| | class SoundexEncoding: public Test { |
| | public: |
| | Soundex soundex; |
| | }; |
| | |
| | TEST_F(SoundexEncoding, RetainsSoleLetterOfOneLetterWord) { |
| | ASSERT_THAT(soundex.encode("A"), Eq("A000")); |
| | } |
| | |
| | TEST_F(SoundexEncoding, PadsWithZerosToEnsureThreeDigits) { |
| | ASSERT_THAT(soundex.encode("I"), Eq("I000")); |
| | } |
| | |
| | TEST_F(SoundexEncoding, ReplacesConsonantsWithAppropriateDigits) ... |