@@ -45,10 +45,16 @@ namespace local_rsa
4545 {
4646 c_result = static_cast <char >((c - ' a' ) + char { 10 }); // NOLINT(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
4747 }
48+ // This example is known to use lower-case exclusively
49+ // at the calling point of this function. But we can't
50+ // really remove the upcoming lines from the subroutine.
51+ // So these lines are purposefully excluded from coverage.
52+ // LCOV_EXCL_START
4853 else if ((c >= ' A' ) && (c <= ' F' )) // NOLINT(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
4954 {
5055 c_result = static_cast <char >((c - ' A' ) + char { 10 }); // NOLINT(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
5156 }
57+ // LCOV_EXCL_STOP
5258
5359 return static_cast <unsigned char >(c_result);
5460 }
@@ -461,13 +467,13 @@ auto ::math::wide_integer::example012_rsa_crypto() -> bool
461467 result_is_ok = ((n == (p * q)) && result_is_ok);
462468 result_is_ok = ((n == rsa.get_n ()) && result_is_ok);
463469
464- // Select "abc" as the sample string to encrypt.
465- const std::string in_str { " Hello wide-integer RSA" };
470+ // Select a short, relevant string as the sample message to encrypt.
471+ const std::string message_in { " Hello wide-integer RSA" };
466472
467- const rsa_type::my_uintwide_t cipher_text { rsa.encrypt (in_str ) };
468- const std::string str_recover { rsa.decrypt (cipher_text) };
473+ const rsa_type::my_uintwide_t cipher_text { rsa.encrypt (message_in ) };
474+ const std::string msg_recover { rsa.decrypt (cipher_text) };
469475
470- result_is_ok = ((str_recover == in_str ) && result_is_ok);
476+ result_is_ok = ((msg_recover == message_in ) && result_is_ok);
471477
472478 return result_is_ok;
473479}
0 commit comments