File indexing completed on 2026-04-09 07:49:15
0001
0002
0003 #include <cassert>
0004 #include "SBacktrace.h"
0005
0006 struct SBT
0007 {
0008 static constexpr const char* x_summary_0 = R"(
0009 SBT::red
0010 SBT::green
0011 SBT::blue
0012 SBT::cyan
0013 SBT::magenta
0014 SBT::yellow
0015 )" ;
0016
0017 static constexpr const char* x_summary_1 = R"(
0018 SBT::green
0019 SBT::blue
0020 SBT::cyan
0021 SBT::magenta
0022 SBT::yellow
0023 )" ;
0024
0025 static constexpr const char* x_summary_2 = R"(
0026 SBT::green
0027 SBT::blue
0028 SBT::cyan
0029 SBT::yellow
0030 )" ;
0031
0032 static void red();
0033 static void green();
0034 static void blue();
0035 static void cyan();
0036 static void magenta();
0037 static void yellow();
0038 };
0039
0040
0041 void SBT::red(){
0042 std::cerr << "red" << std::endl ;
0043
0044 SBacktrace::Dump();
0045 SBacktrace::DumpSummary();
0046
0047 char* summary = SBacktrace::Summary() ;
0048 bool match_0 = strstr( summary, x_summary_0 ) != nullptr ;
0049 bool match_1 = strstr( summary, x_summary_1 ) != nullptr ;
0050 bool match_2 = strstr( summary, x_summary_2 ) != nullptr ;
0051
0052 bool match_0s = SBacktrace::SummaryMatch(x_summary_0);
0053 bool match_1s = SBacktrace::SummaryMatch(x_summary_1);
0054 bool match_2s = SBacktrace::SummaryMatch(x_summary_2);
0055
0056 assert( match_0 == match_0s );
0057 assert( match_1 == match_1s );
0058 assert( match_2 == match_2s );
0059
0060 std::cout << std::endl
0061 << " match_0 " << ( match_0 ? "YES" : "NO" )
0062 << " match_1 " << ( match_1 ? "YES" : "NO" )
0063 << " match_2 " << ( match_2 ? "YES" : "NO" )
0064 << "[" << summary << "]"
0065 << std::endl
0066 ;
0067 }
0068 void SBT::green(){
0069 std::cerr << "green" << std::endl ;
0070 red();
0071 }
0072 void SBT::blue(){
0073 std::cerr << "blue" << std::endl ;
0074 green();
0075 }
0076 void SBT::cyan(){
0077 std::cerr << "cyan" << std::endl ;
0078 blue();
0079 }
0080 void SBT::magenta(){
0081 std::cerr << "magenta" << std::endl ;
0082 cyan();
0083 }
0084 void SBT::yellow(){
0085 std::cerr << "yellow" << std::endl ;
0086 magenta();
0087 }
0088
0089
0090 int main(int argc, char** argv)
0091 {
0092 SBT::yellow();
0093 return 0 ;
0094 }
0095
0096
0097
0098